-
Notifications
You must be signed in to change notification settings - Fork 0
/
game-types.sml
110 lines (90 loc) · 2.74 KB
/
game-types.sml
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
signature GAME_TYPES =
sig
datatype player_type = DAY | NIGHT
datatype block_type = LIGHT | DARK
type ball =
{player: player_type, xPos: int, yPos: int, xMove: int, yMove: int}
type block = {block: block_type, vertexData: Real32.real vector}
type game_board =
{ dayBall: ball
, nightBall: ball
(* Vector containing vectors of blocks. *)
, blocks: block vector vector
(* RGB values for day side. *)
, dr: Real32.real
, dg: Real32.real
, db: Real32.real
(* RGB values for night side. *)
, nr: Real32.real
, ng: Real32.real
, nb: Real32.real
, dayVertexBuffer: Gles3.buffer
, dayVertexShader: Gles3.shader
, dayFragmentBuffer: Gles3.buffer
, dayFragmentShader: Gles3.shader
, dayProgram: Gles3.program
, nightVertexBuffer: Gles3.buffer
, nightVertexShader: Gles3.shader
, nightFragmentBuffer: Gles3.buffer
, nightFragmentShader: Gles3.shader
, nightProgram: Gles3.program
, ballVertexBuffer: Gles3.buffer
, ballVertexShader: Gles3.shader
, ballFragmentBuffer: Gles3.buffer
, ballFragmentShader: Gles3.shader
, ballProgram: Gles3.program
}
end
structure GameTypes: GAME_TYPES =
struct
datatype player_type = DAY | NIGHT
datatype block_type = LIGHT | DARK
type ball =
{ player: player_type
(* top left x coordinate *)
, xPos: int
(* top left y coordinate *)
, yPos: int
(* How the ball is moving in a particular direction. *)
, xMove: int
, yMove: int
}
type block =
{ block: block_type
(* block's position is implicitly implied
* by position in block vector vector.
Outer vector indicates line/row number,
while inner vector indicates position of block in individual line/row.
*)
(* Vertex data (size/position) is expected to stay mostly the same, except
* when resizing if that is supported. *)
, vertexData: Real32.real vector
}
type game_board =
{ dayBall: ball
, nightBall: ball
(* Vector containing vectors of blocks. *)
, blocks: block vector vector
, dr: Real32.real
, dg: Real32.real
, db: Real32.real
, nr: Real32.real
, ng: Real32.real
, nb: Real32.real
, dayVertexBuffer: Gles3.buffer
, dayVertexShader: Gles3.shader
, dayFragmentBuffer: Gles3.buffer
, dayFragmentShader: Gles3.shader
, dayProgram: Gles3.program
, nightVertexBuffer: Gles3.buffer
, nightVertexShader: Gles3.shader
, nightFragmentBuffer: Gles3.buffer
, nightFragmentShader: Gles3.shader
, nightProgram: Gles3.program
, ballVertexBuffer: Gles3.buffer
, ballVertexShader: Gles3.shader
, ballFragmentBuffer: Gles3.buffer
, ballFragmentShader: Gles3.shader
, ballProgram: Gles3.program
}
end