diff --git a/menu.c b/menu.c new file mode 100644 index 0000000000000000000000000000000000000000..30906f0c0038ff9c9b58981495183f425a080d98 --- /dev/null +++ b/menu.c @@ -0,0 +1,61 @@ +#include "SDL/SDL.h" +#include "SDL/SDL_image.h" +#include "SDL_ttf" +#include <string> + +//Ecran +const int SCREEN_WIDTH = 640; +const int SCREEN_HEIGHT = 480; +//const int SCREEN_BPP = ?? + +//Surfaces +SDL_Surface *image = NULL; +SDL_Surface *screen = NULL; + +SDL_Event event; + +int main(int argc, char* args[]){ + + bool quit = false; + + //coordonnées des cases "Nouvelle partie" et "Reprendre" (à définir) + int xc1, yc1, xc2, yc2; + int xd1, yd1, xd2, yd2; + //coordonnées de la souris + int x, y; + Uint32 boutons; + + while(quit == false){ + while(SDL_PollEvent(&event)){ + if(event.type == SDL_QUIT){ + quit = true; + clean_up(); + return 0; + } + switch (event.type){ + case SDL_MOUSEBUTTONDOWN{ + //récupération des coordonnées de la souris + SDL_PumpEvents(); + boutons = SDL_GetMouseState(&x,&y); + + if(xc1<=x<=xc2 && yc1<=y<=yc2){ + //nouvelle partie + } + if(xd1<=x<=xd2 && yd1<=y<=yd2){ + //reprendre + } + } + } + } + } + + + + + + + + évènements : + SDL_MOUSEMOTION + SDL_MOUSEBUTTONDOWN + SDL_MOUSEBUTTONUP \ No newline at end of file