blob: 601c3e9beb77b2fe578d7e93c1250e6fd4cca1b7 (
plain)
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
|
with SDL;
with SDL.Timers;
with SDL.Video.Windows;
with SDL.Video.Renderers;
with SDL.Video.Palettes;
with Game;
use Game;
package Graphics is
WINDOW_TITLE: constant String := "Snake";
WINDOW_X: constant SDL.Natural_Coordinate := 10;
WINDOW_Y: constant SDL.Natural_Coordinate := 10;
WINDOW_WIDTH: constant SDL.Positive_Dimension := 400;
WINDOW_HEIGHT: constant SDL.Positive_Dimension := 400;
TIME_STEP: constant SDL.Timers.Milliseconds := 400;
COLOR_WHITE: constant SDL.Video.Palettes.Colour := (255, 255, 255, 255);
COLOR_BLACK: constant SDL.Video.Palettes.Colour := (0, 0, 0, 255);
COLOR_RED: constant SDL.Video.Palettes.Colour := (255, 0, 0, 255);
COLOR_GREEN: constant SDL.Video.Palettes.Colour := (0, 255, 0, 255);
type T_State is record
running: Boolean;
game: T_Game;
window: SDL.Video.Windows.Window;
renderer: SDL.Video.Renderers.Renderer;
end record;
procedure Init(state: out T_State);
procedure Quit(state: T_State);
procedure Run(state: in out T_State);
private
procedure Event_Handler(state: in out T_State);
procedure Update(state: in out T_State);
procedure Draw_Square(state: in out T_State;
pos: T_Position);
end Graphics;
|