-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu.c
More file actions
112 lines (101 loc) · 2.31 KB
/
menu.c
File metadata and controls
112 lines (101 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#include "header.h"
void initButtons(image *A,image *B, image *C,image *D,image *E, image *F)
{
A->img = IMG_Load("1x/Startselected.png");
if (A->img== NULL) {
return ;
}
A->pos.x = 270;
A->pos.y = 300;
B->img = IMG_Load("1x/Settingsunselected.png");
if (B->img== NULL) {
return ;
}
B->pos.x = 270;
B->pos.y = 500;
C->img = IMG_Load("1x/Quitunselected.png");
if (C->img== NULL) {
return ;
}
C->pos.x = 320;
C->pos.y = 900;
D->img = IMG_Load("1x/Musicon.png");
if (D->img== NULL) {
return ;
}
D->pos.x = 1750;
D->pos.y = 30;
E->img = IMG_Load("1x/Scoreunselected.png");
if (D->img== NULL) {
return ;
}
E->pos.x = 270;
E->pos.y = 700;
F->img = IMG_Load("1x/subrosa.png");
if (D->img== NULL) {
return ;
}
F->pos.x = 200;
F->pos.y = 100;
}
void initBackground(image *Backg)
{
Backg->img= IMG_Load("1x/img.jpg");
if (Backg->img == NULL) {
printf("Unable to load : %s\n", SDL_GetError());
return;
}
Backg->pos.x=0;
Backg->pos.y=0;
/*Backg->pos.w=(SCREEN_W);
Backg->pos.h=SCREEN_H;*/
}
void libererButtons(image A,image B, image C,image E,image F,image G)
{
SDL_FreeSurface(A.img);
SDL_FreeSurface(B.img);
SDL_FreeSurface(C.img);
SDL_FreeSurface(E.img);
SDL_FreeSurface(F.img);
SDL_FreeSurface(G.img);
}
void afficher(image p,SDL_Surface *screen)
{
SDL_BlitSurface(p.img,NULL,screen,&p.pos);
}
void afficherparposition(int position, image *A,image *B, image *C,image *D)
{
switch (position)
{
case 1:
A->img = IMG_Load("1x/Startselected.png");
B->img=IMG_Load("1x/Settingsunselected.png");
C->img=IMG_Load("1x/Scoreunselected.png");
D->img = IMG_Load("1x/Quitunselected.png");
break;
case 2:
A->img = IMG_Load("1x/Startunselected.png");
B->img=IMG_Load("1x/Settingsselected.png");
C->img=IMG_Load("1x/Scoreunselected.png");
D->img = IMG_Load("1x/Quitunselected.png");
break;
case 3:
A->img = IMG_Load("1x/Startunselected.png");
B->img=IMG_Load("1x/Settingsunselected.png");
C->img=IMG_Load("1x/Scoreselected.png");
D->img = IMG_Load("1x/Quitunselected.png");
break;
case 4:
A->img = IMG_Load("1x/Startunselected.png");
B->img=IMG_Load("1x/Settingsunselected.png");
C->img=IMG_Load("1x/Scoreunselected.png");
D->img = IMG_Load("1x/Quitselected.png");
break;
}
}
void closeEverything()
{
//atexit(Mix_Quit);
atexit(IMG_Quit);
atexit(SDL_Quit);
}