Initial commit
This commit is contained in:
commit
adaa5142c2
13 changed files with 75 additions and 0 deletions
1
libSDL-1.2.so.0
Symbolic link
1
libSDL-1.2.so.0
Symbolic link
|
@ -0,0 +1 @@
|
|||
libSDL-1.2.so.0.11.4
|
BIN
libSDL-1.2.so.0.11.4
Normal file
BIN
libSDL-1.2.so.0.11.4
Normal file
Binary file not shown.
BIN
libSDL.a
Normal file
BIN
libSDL.a
Normal file
Binary file not shown.
1
libSDL.so
Symbolic link
1
libSDL.so
Symbolic link
|
@ -0,0 +1 @@
|
|||
libSDL-1.2.so.0.11.4
|
1
libSDL2-2.0.so
Symbolic link
1
libSDL2-2.0.so
Symbolic link
|
@ -0,0 +1 @@
|
|||
libSDL2-2.0.so.0
|
1
libSDL2-2.0.so.0
Symbolic link
1
libSDL2-2.0.so.0
Symbolic link
|
@ -0,0 +1 @@
|
|||
libSDL2-2.0.so.0.10.0
|
BIN
libSDL2-2.0.so.0.10.0
Normal file
BIN
libSDL2-2.0.so.0.10.0
Normal file
Binary file not shown.
BIN
libSDL2.a
Normal file
BIN
libSDL2.a
Normal file
Binary file not shown.
1
libSDL2.so
Symbolic link
1
libSDL2.so
Symbolic link
|
@ -0,0 +1 @@
|
|||
libSDL2-2.0.so.0.10.0
|
BIN
libSDL2_test.a
Normal file
BIN
libSDL2_test.a
Normal file
Binary file not shown.
BIN
libSDL2main.a
Normal file
BIN
libSDL2main.a
Normal file
Binary file not shown.
BIN
libSDLmain.a
Normal file
BIN
libSDLmain.a
Normal file
Binary file not shown.
70
main.cpp
Normal file
70
main.cpp
Normal file
|
@ -0,0 +1,70 @@
|
|||
// Leopold Clement
|
||||
#include "SDL2/SDL.h"
|
||||
/*#include <exception.h>
|
||||
#include <string.h>
|
||||
#include <iostream.h>*/
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SDL_Window *pwindow;
|
||||
SDL_Renderer *prenderer;
|
||||
SDL_Event events;
|
||||
int isOpen = 1;
|
||||
|
||||
SDL_Rect rectangle1 = {20, 20, 100, 50};
|
||||
|
||||
//Initialisation de SDL avec la vidéo
|
||||
if (SDL_Init(SDL_INIT_VIDEO) != 0)
|
||||
printf("il y a un souci d'initialisation");
|
||||
|
||||
// make sure SDL cleans up before exit
|
||||
atexit(SDL_Quit);
|
||||
|
||||
//Création d'une fenetre pointée par m_window et de son rendu pointé par m_rendered
|
||||
//largeur 640 et hauteur 480
|
||||
if (SDL_CreateWindowAndRenderer(640, 480, SDL_WINDOW_SHOWN, &pwindow, &prenderer) != 0)
|
||||
printf("il y a un souci de création de fenêtre");
|
||||
|
||||
//Paramètre de rendu de la fenetre (R,G,B et transparence a 255 pour opaque)
|
||||
SDL_SetRenderDrawColor(prenderer, 200, 200, 200, 255);
|
||||
SDL_RenderClear(prenderer);
|
||||
|
||||
//Affichage de la fenetre
|
||||
SDL_RenderPresent(prenderer);
|
||||
|
||||
while (isOpen)
|
||||
{
|
||||
/* évènements de votre jeu */
|
||||
while (SDL_PollEvent(&events))
|
||||
{
|
||||
|
||||
switch (events.type)
|
||||
{
|
||||
case SDL_QUIT:
|
||||
isOpen = 0;
|
||||
break;
|
||||
|
||||
case SDL_KEYDOWN:
|
||||
if (events.key.keysym.sym == SDLK_v)
|
||||
{
|
||||
SDL_SetRenderDrawColor(prenderer, 00, 255, 00, 255);
|
||||
SDL_RenderFillRect(prenderer, &rectangle1);
|
||||
}
|
||||
if (events.key.keysym.sym == SDLK_b)
|
||||
{
|
||||
SDL_SetRenderDrawColor(prenderer, 00, 00, 255, 255);
|
||||
SDL_RenderFillRect(prenderer, &rectangle1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_RenderPresent(prenderer); // mets à jour la fenêtre
|
||||
}
|
||||
|
||||
SDL_DestroyRenderer(prenderer); //destruction du rendu
|
||||
SDL_DestroyWindow(pwindow); //destruction de la fenetre
|
||||
SDL_Quit();
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue