Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Projet l2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VAUTRIN Guillaume
Projet l2
Commits
410a5cfa
Commit
410a5cfa
authored
4 years ago
by
VUILLEMARD Juliette
Browse files
Options
Downloads
Patches
Plain Diff
Début du menu
parent
ea049db7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
menu.c
+61
-0
61 additions, 0 deletions
menu.c
with
61 additions
and
0 deletions
menu.c
0 → 100644
+
61
−
0
View file @
410a5cfa
#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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment