-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
700 lines (691 loc) · 20.5 KB
/
main.c
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
/**
* @file main.c
* @author Ahmed Debbech
* @brief The main entry point to the program, all the function calls are here.
*/
#include <stdio.h>
#include <stdlib.h>
#include "SDL/SDL_image.h"
#include "SDL/SDL.h"
#include "SDL/SDL_mixer.h"
#include "SDL/SDL_ttf.h"
#include <string.h>
#include "graphics.h"
#include "store.h"
#include "core.h"
int main(int argc, char **argv){
// this do-while loop is for checking if theme has been changed then the game should restart itself
int themeChanged = 0;
SDL_Surface *screen;
Mix_Music * music;
do{
//core initializations
char m[3][3]; //main game table containing Xs and Os
int td[3][3]; //defence table
int ta[3][3]; // attack table
computerEnteries ce;
//graphics initializations and declarations
SDL_Event event;
menu mc;
int scoreComputer=0, scorePlayer=0, whichMode = 0;
int scorePlayer1 = 0, scorePlayer2=0;
int played_once = 0, backToLevels = 0;
themeChanged = 0;
playgameScreen pgs;
about ab;
help hel;
picker p;
menuPlayGame mpg;
buttons bu;
soundFX sfx;
tics t;
store s;
points poi;
levelsPacks lp;
poi.user_points = 0;
// screen initialization
if(SDL_Init(SDL_INIT_VIDEO)!=0){
printf("unable to initialize SDL:%s \n",SDL_GetError());
return 1;
}
SDL_Surface * icon = IMG_Load("Resources/icon.png");
SDL_WM_SetIcon(icon, NULL);
screen = SDL_SetVideoMode(500,490,32,SDL_HWSURFACE|SDL_DOUBLEBUF);
if(Mix_OpenAudio(44100,MIX_DEFAULT_FORMAT,MIX_DEFAULT_CHANNELS,1024)==-1){
printf("No sounds %s\n",Mix_GetError());
return 1;
}
SDL_WM_SetCaption("Tic * Tac * Toe", NULL);
//flags declaration and initialization
int menuNotOver = 1, blitCheck = 0, choice;
int passToGame = 0, click, gameNotFinished = 1;
int game_isnot_going = 0;
int levels = 1;
//initializations
creating_files();
mc = initOffMenu();
sfx = initSounds();
bu = initButtons();
s = initStore();
lp = initLevelsMenu();
SDL_BlitSurface (mc.splash, NULL, screen, &mc.splashPos);
SDL_Flip(screen);
int empty = 0;
SDL_Delay(2500);
while (empty == 0){
if(SDL_PollEvent(&event) == 1){
empty = 0;
}else{
if(SDL_PollEvent(&event) == 0){
empty = 1;
}
}
} //empty the event queue
while (game_isnot_going == 0){
//official menu
while(menuNotOver == 1){
if(blitCheck == 0){
showOffMenu(mc, screen,sfx);
SDL_Flip(screen);
}
SDL_WaitEvent(&event);
switch(event.type){
case SDL_QUIT:
game_isnot_going = 1;
menuNotOver = 0;
break;
case SDL_MOUSEMOTION:
if(menuMotion(mc,screen, event, sfx) == 1){
blitCheck = 1;
}else{
blitCheck = 0;
}
break;
case SDL_MOUSEBUTTONDOWN:
choice = menuClicks(mc,screen, event,&sfx);
if(choice == 5){
menuNotOver = 1;
}else{
menuNotOver = 0;
blitCheck = 0;
}
break;
}
}
// manipulating choices comming from menu
switch (choice) {
case 1:
while(SDL_PollEvent(&event)){
if(event.type == SDL_QUIT){
game_isnot_going = 1;
}else{
//playgame menu screen
if(passToGame == 0){
mpg = initMenuPlay();
if(blitCheck == 0){
showMenuPlay(mpg,screen,bu);
SDL_Flip(screen);
}
if(event.type == SDL_MOUSEMOTION){
if(menuPlayMotion(bu, mpg,screen, event,sfx) == 1){
blitCheck = 1;
SDL_Flip(screen);
}else{
SDL_Flip(screen);
blitCheck = 0;
}
}else{
if(event.type == SDL_MOUSEBUTTONDOWN){
click = menuPlayClicks(event, bu,mpg,sfx);
if(click == 0){
//this initialization just to let back to the menu
choice = 0;
menuNotOver = 1;
blitCheck = 0;
}else{
if(click == -1){
passToGame = 0;
game_isnot_going = 1;
}else{
passToGame = 1;
}
}
}
}
}else{
//pass to game play
//picker menu screen
int userInput, won=0;
int winner = 0;
char whatComputerChose = 'n';
if(passToGame == 1){
//pass to computer mode
if(click == 1){
if(initPickScreen(&p) == 1){
while (SDL_PollEvent(&event) != 0);
p = getPick(screen, event,p,sfx);
whichMode = 0;
if(played_once == 1){
showScore(winner, scoreComputer, scorePlayer, screen,pgs, whichMode);
}
if(p.pick == 'n'){
passToGame = 0; // to be back to the playgame menu
}else{
if(p.pick == 'x'){
won=0;
winner = 0;
played_once = 1;
whatComputerChose = 'o';
init(m);
initDeffTable(td);
initAttTable(ta);
pgs = initGamePlay();
SDL_BlitSurface(pgs.splashCharIndicatorX,NULL, screen, &pgs.splashIndicatorPos);
SDL_Flip(screen);
SDL_Delay(750);
showGamePlay(pgs, screen);
showScore(winner, scoreComputer, scorePlayer, screen,pgs, whichMode);
printPoints(poi, screen);
printTics(t,screen);
SDL_Flip(screen);
while (SDL_PollEvent(&event) != 0); //empty the event queue before start to not crash the game with to many events from the splash screen
//actual game loop
do{
do{
SDL_WaitEvent(&event);
userInput = player(m, screen, pgs, p.pick,event,sfx);
}while(userInput == 0);
checkwin(m,&winner,whatComputerChose,&won, screen, pgs);
SDL_Delay(250);
while (SDL_PollEvent(&event) != 0); //empty the event queue
if((won != 1) && (checkfin(m) != 1) && ((userInput != -1) && (userInput != 3))){
computerBrain(m,&ce.xc, &ce.yc, td, ta,whatComputerChose);
printOnTable(ce,m,screen,pgs,p.pick);
checkwin(m,&winner,whatComputerChose,&won, screen, pgs);
}
}while(((checkfin(m) == 0) && (won == 0)) && ((userInput != -1) && (userInput != 3)));
SDL_Delay(1000);
if((won == 1) && ((userInput != -1) && (userInput != 3))){
manageScore (winner, &scoreComputer, &scorePlayer);
if(winner == 2){
if(sfx.soundMuted == 0){
Mix_PlayChannel(-1, sfx.winning, 0);
}
}else{
if(sfx.soundMuted == 0){
Mix_PlayChannel(-1, sfx.lose, 0);
}
}
showScore(winner, scoreComputer, scorePlayer, screen,pgs,whichMode);
managePoints(&poi, winner, scoreComputer, scorePlayer,screen);
t = manageTics(winner);
while (SDL_PollEvent(&event) != 0);
SDL_Flip(screen);
}else{
if(userInput == -1){
game_isnot_going = 1; // quit the game
}else{
if(userInput == 3){
passToGame = 0; // when pressing back button to back to menu
}
}
}
}else{
if(p.pick == 'o'){
won=0;
winner = 0;
played_once = 1;
whatComputerChose = 'x';
init(m);
initDeffTable(td);
initAttTable(ta);
pgs = initGamePlay();
SDL_BlitSurface(pgs.splashCharIndicatorO,NULL, screen, &pgs.splashIndicatorPos);
SDL_Flip(screen);
SDL_Delay(750);
showGamePlay(pgs, screen);
showScore(winner, scoreComputer, scorePlayer, screen,pgs, whichMode);
printPoints(poi, screen);
printTics(t,screen);
SDL_Flip(screen);
while (SDL_PollEvent(&event) != 0); //empty the event queue
//actual game loop
do{
SDL_Delay(250);
while (SDL_PollEvent(&event) != 0); //empty the event queue
computerBrain(m,&ce.xc, &ce.yc, td, ta,whatComputerChose);
printOnTable(ce,m,screen,pgs,p.pick);
checkwin(m,&winner,whatComputerChose,&won, screen, pgs);
if((won != 1) && (checkfin(m) != 1) && ((userInput != -1) && (userInput != 3))){
do{
SDL_WaitEvent(&event);
userInput = player(m, screen, pgs, p.pick, event,sfx);
}while(userInput == 0);
checkwin(m,&winner,whatComputerChose,&won, screen, pgs);
}
}while(((checkfin(m) == 0) && (won == 0)) && ((userInput != -1) && (userInput != 3)));
SDL_Delay(1000);
if((won == 1) && ((userInput != -1) && (userInput != 3))){
manageScore (winner, &scoreComputer, &scorePlayer);
if(winner == 2){
if(sfx.soundMuted == 0){
Mix_PlayChannel(-1, sfx.winning, 0);
}
}else{
if(sfx.soundMuted == 0){
Mix_PlayChannel(-1, sfx.lose, 0);
}
}
showScore(winner, scoreComputer, scorePlayer, screen,pgs, whichMode);
managePoints(&poi, winner, scoreComputer, scorePlayer,screen);
t = manageTics(winner);
while (SDL_PollEvent(&event) != 0);
SDL_Flip(screen);
}else{
if(userInput == -1){
game_isnot_going = 1; // quit the game
}else{
if(userInput == 3){
passToGame = 0; // when pressing back button to back to menu
}
}
}
}
}
}
}
}else{
//pass to friend mode
if(click == 2){
won=0;
winner = 0;
played_once = 1;
init(m);
pgs = initGamePlay();
showGamePlay(pgs, screen);
whichMode = 1; // this variable is set to 1 to say it is friend mode
showScore(winner, scorePlayer1, scorePlayer2, screen,pgs, whichMode);
SDL_Flip(screen);
//actual game loop
do{
do{
SDL_WaitEvent(&event);
userInput = player(m, screen, pgs, 'x', event,sfx);
}while(userInput == 0);
checkwin(m,&winner,'x',&won, screen, pgs);
if((won != 1) && (checkfin(m) != 1) && ((userInput != -1) && (userInput != 3))){
do{
SDL_WaitEvent(&event);
userInput = player(m, screen, pgs, 'o',event,sfx);
}while(userInput == 0);
checkwin(m,&winner,'x',&won, screen, pgs);
}
}while(((checkfin(m) == 0) && (won == 0)) && ((userInput != -1) && (userInput != 3)));
SDL_Delay(1000);
if((won == 1) && ((userInput != -1) && (userInput != 3))){
manageScore (winner, &scorePlayer1, &scorePlayer2);
if(sfx.soundMuted == 0){
Mix_PlayChannel(-1, sfx.winning, 0);
}
showScore(winner, scorePlayer1, scorePlayer2, screen,pgs, whichMode);
SDL_Flip(screen);
}else{
if(userInput == -1){
game_isnot_going = 1; // quit the game
}else{
if(userInput == 3){
passToGame = 0; // when pressing back button to back to menu
}
}
}
}else{
//pass to levels mode
if(click == 3){
int levels_limit = 0;
if(backToLevels == 0){
showLevelsMenu(lp, screen, bu);
while (SDL_PollEvent(&event) != 0);
lp = getPackChoice(lp, bu, sfx, screen);
switch(lp.packChosen){
case 1: levels_limit = 6;
break;
case 2: levels_limit = 11;
break;
case 3: levels_limit = 15;
break;
case -1:
game_isnot_going = 1;
break;
}
}
if((lp.packChosen != 0) && (lp.packChosen != -1)){
if(initPickScreen(&p) == 1){
while (SDL_PollEvent(&event) != 0);
p = getPick(screen, event,p,sfx);
whichMode = 0;
if(p.pick == 'n'){
backToLevels = 0; // this variable is set to go back to the levels pack choice
levels = 1;
}else{
backToLevels = 1; // to prevent going back to levels menu each itiration of the loop.
if(p.pick == 'x'){
won = 0;
winner = 0;
played_once = 1;
whatComputerChose = 'o';
init(m);
initDeffTable(td);
initAttTable(ta);
pgs = initGamePlay();
SDL_BlitSurface(pgs.splashCharIndicatorX,NULL, screen, &pgs.splashIndicatorPos);
SDL_Flip(screen);
SDL_Delay(750);
showGamePlay(pgs, screen);
showScore(winner, scoreComputer, scorePlayer, screen,pgs, whichMode);
printPoints(poi, screen);
printLevelsNumber(levels, lp.packChosen, screen);
SDL_Flip(screen);
while (SDL_PollEvent(&event) != 0); //empty the event queue before start to not crash the game with too many events comming from the splash screen
//actual game loop
do{
do{
SDL_WaitEvent(&event);
userInput = player(m, screen, pgs, p.pick,event,sfx);
}while(userInput == 0);
checkwin(m,&winner,whatComputerChose,&won, screen, pgs);
SDL_Delay(250);
while (SDL_PollEvent(&event) != 0); //empty the event queue
if((won != 1) && (checkfin(m) != 1) && ((userInput != -1) && (userInput != 3))){
computerBrain(m,&ce.xc, &ce.yc, td, ta,whatComputerChose);
printOnTable(ce,m,screen,pgs,p.pick);
checkwin(m,&winner,whatComputerChose,&won, screen, pgs);
}
}while(((checkfin(m) == 0) && (won == 0)) && ((userInput != -1) && (userInput != 3)));
SDL_Delay(1000);
if((won == 1) && ((userInput != -1) && (userInput != 3))){
manageScore (winner, &scoreComputer, &scorePlayer);
if(winner == 2){
if(sfx.soundMuted == 0){
Mix_PlayChannel(-1, sfx.winning, 0);
}
if(manageLevels(&levels, lp.packChosen, 1) == 1){
backToLevels = 0;
//show the win splash
SDL_Surface * winSplash =
IMG_Load("Resources/winthepack.png");
SDL_Rect pos;
pos.x = 0; pos.y = 0;
SDL_BlitSurface(winSplash, NULL, screen, &pos);
TTF_Init(); TTF_Font * police = NULL;
police = TTF_OpenFont("Resources/font.ttf", 64);
char ch [128]; int x;
switch(lp.packChosen){
case 1: x = 95; break;
case 2: x = 145; break;
case 3: x = 190; break;
}
sprintf(ch, "Tics: %d", x);
SDL_Color color = {240,100,0};
SDL_Rect posi; posi.x=120; posi.y =276;
SDL_Surface * value = TTF_RenderText_Solid(police, ch, color);
SDL_BlitSurface(value, NULL, screen, &posi);
TTF_CloseFont(police);
TTF_Quit();
SDL_Flip(screen);
SDL_Delay(1500);
levels = 1;
}
}else{
if(sfx.soundMuted == 0){
Mix_PlayChannel(-1, sfx.lose, 0);
}
manageLevels(&levels, lp.packChosen, 0);
if(levels == 0){
backToLevels = 0;
levels = 1;
//show the lose splash
SDL_Surface * loseSplash =
IMG_Load("Resources/losingpack.png");
SDL_Rect pos;
pos.x = 100; pos.y = 150;
SDL_BlitSurface(loseSplash, NULL, screen, &pos);
SDL_Flip(screen);
SDL_Delay(1500);
}
}
showScore(winner, scoreComputer, scorePlayer, screen,pgs,whichMode);
managePoints(&poi, winner, scoreComputer, scorePlayer,screen);
while (SDL_PollEvent(&event) != 0);
SDL_Flip(screen);
}else{
if(userInput == -1){
game_isnot_going = 1; // quit the game
}else{
if(userInput == 3){
backToLevels = 0; // when pressing back button to back it goes back to levels menu
levels = 1; // reinitialize levels number
}
}
}
}else{
if(p.pick == 'o'){
won=0;
winner = 0;
played_once = 1;
whatComputerChose = 'x';
init(m);
initDeffTable(td);
initAttTable(ta);
pgs = initGamePlay();
SDL_BlitSurface(pgs.splashCharIndicatorO,NULL, screen, &pgs.splashIndicatorPos);
SDL_Flip(screen);
SDL_Delay(750);
showGamePlay(pgs, screen);
showScore(winner, scoreComputer, scorePlayer, screen,pgs, whichMode);
printPoints(poi, screen);
printLevelsNumber(levels, lp.packChosen, screen);
SDL_Flip(screen);
while (SDL_PollEvent(&event) != 0); //empty the event queue
//actual game loop
do{
SDL_Delay(250);
while (SDL_PollEvent(&event) != 0); //empty the event queue
computerBrain(m,&ce.xc, &ce.yc, td, ta,whatComputerChose);
printOnTable(ce,m,screen,pgs,p.pick);
checkwin(m,&winner,whatComputerChose,&won, screen, pgs);
if((won != 1) && (checkfin(m) != 1) && ((userInput != -1) && (userInput != 3))){
do{
SDL_WaitEvent(&event);
userInput = player(m, screen, pgs, p.pick, event,sfx);
}while(userInput == 0);
checkwin(m,&winner,whatComputerChose,&won, screen, pgs);
}
}while(((checkfin(m) == 0) && (won == 0)) && ((userInput != -1) && (userInput != 3)));
SDL_Delay(1000);
if((won == 1) && ((userInput != -1) && (userInput != 3))){
manageScore (winner, &scoreComputer, &scorePlayer);
if(winner == 2){
if(sfx.soundMuted == 0){
Mix_PlayChannel(-1, sfx.winning, 0);
if(manageLevels(&levels, lp.packChosen, 1) == 1){
backToLevels = 0;
//show the win splash
SDL_Surface * winSplash =
IMG_Load("Resources/winthepack.png");
SDL_Rect pos;
pos.x = 0; pos.y = 0;
SDL_BlitSurface(winSplash, NULL, screen, &pos);
TTF_Init(); TTF_Font * police = NULL;
police = TTF_OpenFont("Resources/font.ttf", 64);
char ch [128]; int x;
switch(lp.packChosen){
case 1: x = 95; break;
case 2: x = 145; break;
case 3: x = 190; break;
}
sprintf(ch, "Tics: %d", x);
SDL_Color color = {240,100,0};
SDL_Rect posi; posi.x=120; posi.y =276;
SDL_Surface * value = TTF_RenderText_Solid(police, ch, color);
SDL_BlitSurface(value, NULL, screen, &posi);
TTF_CloseFont(police);
TTF_Quit();
SDL_Flip(screen);
SDL_Delay(1500);
levels = 1;
}
}
}else{
if(sfx.soundMuted == 0){
Mix_PlayChannel(-1, sfx.lose, 0);
manageLevels(&levels, lp.packChosen, 0);
if(levels == 0){
backToLevels = 0;
levels = 1;
//show the lose splash
SDL_Surface * loseSplash =
IMG_Load("Resources/losingpack.png");
SDL_Rect pos;
pos.x = 100; pos.y = 150;
SDL_BlitSurface(loseSplash, NULL, screen, &pos);
SDL_Flip(screen);
SDL_Delay(1500);
}
}
}
showScore(winner, scoreComputer, scorePlayer, screen,pgs, whichMode);
managePoints(&poi, winner, scoreComputer, scorePlayer,screen);
while (SDL_PollEvent(&event) != 0);
SDL_Flip(screen);
}else{
if(userInput == -1){
game_isnot_going = 1; // quit the game
}else{
if(userInput == 3){
backToLevels = 0; // when pressing back button it goes back to levels menu
levels = 1;
}
}
}
}
}
}
}
}else{
//processing: if the user pressed back button
passToGame = 0;
}
}
}
}
}
}
}
}
break;
case 2:
SDL_WaitEvent(&event);
if(event.type == SDL_QUIT){
game_isnot_going = 1;
}else{
if(blitCheck == 0){
showStore(s,screen,bu);
SDL_Flip(screen);
}
if(event.type == SDL_MOUSEBUTTONDOWN){
int o = -1;
o = storeClicks(event, bu,sfx);
//if back button was pressed
if(o == 0){
choice = 0;
menuNotOver = 1;
}else{
//if any of the items was pressed
if(buyingManger(o,screen) == 1){
//the image that contains restart instruction to excute the new changes
SDL_Surface * restart = IMG_Load("Resources/restart.png");
SDL_Rect rest;
rest.x = 100;
rest.y = 150;
rest.h = restart->h;
rest.w = restart->w;
SDL_BlitSurface(restart, NULL, screen, &rest);
SDL_Flip(screen);
SDL_FreeSurface(restart);
SDL_Delay(4000);
themeChanged = 1;
game_isnot_going = 1;
}
}
}
}
break;
case 3:
SDL_WaitEvent(&event);
if(event.type == SDL_QUIT){
game_isnot_going = 1;
}else{
hel = initHelp();
if(blitCheck == 0){
showHelp(hel,screen,bu);
SDL_Flip(screen);
}
if(event.type == SDL_MOUSEMOTION){
if(helpMotion(bu, hel,screen, event) == 1){
blitCheck = 1;
SDL_Flip(screen);
}else{
SDL_Flip(screen);
blitCheck = 0;
}
}else{
if(event.type == SDL_MOUSEBUTTONDOWN){
if(helpClicks(event, bu,sfx) == 1){
choice = 0;
menuNotOver = 1;
}
}
}
}
break;
case 4:
SDL_WaitEvent(&event);
if(event.type == SDL_QUIT){
game_isnot_going = 1;
}else{
ab = initAbout();
if(blitCheck == 0){
showAbout(ab,screen,bu);
SDL_Flip(screen);
}
if(event.type == SDL_MOUSEMOTION){
if(aboutMotion(bu, ab,screen, event) == 1){
blitCheck = 1;
SDL_Flip(screen);
}else{
SDL_Flip(screen);
blitCheck = 0;
}
}else{
if(event.type == SDL_MOUSEBUTTONDOWN){
if(aboutClicks(event, bu,sfx) == 1){
choice = 0;
menuNotOver = 1;
}
}
}
}
break;
//power button processing
case 6:
game_isnot_going = 1;
break;
}
}
//end game loop
}while(themeChanged == 1);
SDL_FreeSurface(screen);
Mix_FreeMusic(music);
SDL_Quit();
return 0;
}