Skip to content
Snippets Groups Projects
Commit 410a5cfa authored by VUILLEMARD Juliette's avatar VUILLEMARD Juliette
Browse files

Début du menu

parent ea049db7
No related branches found
No related tags found
No related merge requests found
menu.c 0 → 100644
#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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment