-
Notifications
You must be signed in to change notification settings - Fork 2
/
MAINMENU.PAS
124 lines (94 loc) · 2.35 KB
/
MAINMENU.PAS
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
{$A+,B-,E+,F-,G+,I-,N+,P-,Q-,R-,S-,T-,V-,X+}
unit MainMenu;
interface
procedure DoMainMenu;
implementation
uses GDGfx, GDKeybrd, GDTimer, GDEvents, Assets, Draw, Shared;
var
menuSelection : integer;
procedure DrawMainMenu;
var
c : color;
x, y : integer;
begin
Cls(0);
BlitSpritef(24, 10, titleMain);
DrawUIFrame(68, 110, 184, 72, uiGeneralFrame);
UseFont(@fnt);
{ --- }
x := 100; y := 120;
if menuSelection = 0 then begin
c := 14;
BlitSpritef(x, y, sprites[18]);
end else
c := 15;
DrawString(x+16+8, y+4, c, 'Play!');
x := 100; y := 140;
if menuSelection = 1 then begin
c := 14;
BlitSpritef(x, y, sprites[18]);
end else
c := 15;
DrawString(x+16+8, y+4, c, 'Instructions');
x := 100; y := 160;
if menuSelection = 2 then begin
c := 14;
BlitSpritef(x, y, sprites[18]);
end else
c := 15;
DrawString(x+16+8, y+4, c, 'Quit');
{ --- }
UseFont(@chunkyFnt);
DrawString(94, 70, 22, 'GDR 4X4X4 CHALLENGE');
x := 112;
y := 80;
BlitSpritef(x, y, sprites[0]);
inc(x, 24);
BlitSpritef(x, y, sprites[6]);
inc(x, 24);
BlitSpritef(x, y, sprites[1]);
inc(x, 24);
BlitSpritef(x, y, sprites[5]);
DrawString(178, 193, 22, 'BY: GERED KING, 2021');
WaitForVsync;
Flip(BACKBUFFER_LAYER);
end;
procedure DoMainMenu;
var
quit : boolean;
event : PInputEvent;
begin
UseLayer(BACKBUFFER_LAYER);
menuSelection := 0;
DrawMainMenu;
FadeIn;
InitEvents;
quit := false;
while not quit do begin
while not IsEventsEmpty do begin
event := PollEvents;
if IsKeyReleasedEvent(event, KEY_ESC) then begin
menuSelection := 2;
quit := true;
end;
if IsKeyReleasedEvent(event, KEY_DOWN) then begin
inc(menuSelection);
if menuSelection > 2 then menuSelection := 0;
end;
if IsKeyReleasedEvent(event, KEY_UP) then begin
dec(menuSelection);
if menuSelection < 0 then menuSelection := 2;
end;
if IsKeyReleasedEvent(event, KEY_ENTER) then quit := true;
end;
DrawMainMenu;
end;
CloseEvents;
FadeOut;
case menuSelection of
0: currentGameState := StateLevelSelect;
1: currentGameState := StateHelp;
2: currentGameState := StateQuit;
end;
end;
end.