-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathraylib.cbl
257 lines (257 loc) · 9.32 KB
/
raylib.cbl
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
copy "cabi.cpy".
*
******************************************************************
*Initialize Raylib proper, takes a procedure pointer
identification division.
program-id. raylib-init.
data division.
working-storage section.
01 ws-title picture x(24) value is z"Raylib-Cobol".
01 ws-screen-width usage is binary-short value is 1024.
01 ws-screen-height usage is binary-short value is 720.
01 ws-fps usage is binary-short value is 30.
01 ws-should-close usage is binary-short.
linkage section.
01 ls-user usage is pointer.
01 ls-load usage is program-pointer.
01 ls-prog usage is program-pointer.
procedure division using by value ls-user
by value ls-load
by value ls-prog
returning omitted.
*
call "InitWindow" using
by value ws-screen-width
by value ws-screen-height
by reference ws-title end-call.
call "SetTargetFPS" using by value ws-fps end-call.
*
if ls-load is not equal to null then
call ls-load using by value ls-user end-call
end-if.
*
perform until ws-should-close is not equal zero
perform window-loop
end-perform.
*
call "CloseWindow" end-call.
goback.
window-loop.
call "WindowShouldClose"
returning ws-should-close end-call.
call ls-prog using by value ls-user end-call.
end program raylib-init.
******************************************************************
*Draw text onscreen
identification division.
program-id. raylib-draw-text.
data division.
working-storage section.
01 ws-text picture is x(81).
01 ws-count picture is 9(4).
linkage section.
01 ls-text picture x(80).
01 ls-x usage is binary-short.
01 ls-y usage is binary-short.
01 ls-size usage is binary-short.
copy "rcol.cpy" replacing ==:pref:== by ==ls-colour==
==:level:== by ==01==.
procedure division using
by reference ls-text
by value ls-x
by value ls-y
by value ls-size
by value ls-colour
returning omitted.
*
string ls-text delimited by space into ws-text end-string.
initialize ws-count.
inspect ws-text tallying ws-count
for characters before space.
add 1 to ws-count giving ws-count end-add.
*
call "COB_RayLib_DrawText" using
by reference ws-text
by value ls-x
by value ls-y
by value ls-size
by value ls-colour-r
by value ls-colour-g
by value ls-colour-b
by value ls-colour-a end-call.
goback.
end program raylib-draw-text.
******************************************************************
*Draw lines onscreen
identification division.
program-id. raylib-draw-line.
data division.
linkage section.
01 ls-sx usage is binary-short.
01 ls-sy usage is binary-short.
01 ls-ex usage is binary-short.
01 ls-ey usage is binary-short.
copy "rcol.cpy" replacing ==:pref:== by ==ls-colour==
==:level:== by ==01==.
procedure division using
by value ls-sx
by value ls-sy
by value ls-ex
by value ls-ey
by value ls-colour
returning omitted.
*
call "COB_RayLib_DrawLine" using
by value ls-sx
by value ls-sy
by value ls-ex
by value ls-ey
by value ls-colour-r
by value ls-colour-g
by value ls-colour-b
by value ls-colour-a end-call.
goback.
end program raylib-draw-line.
******************************************************************
*Load a texture given a name
identification division.
program-id. raylib-load-texture.
data division.
working-storage section.
01 ws-text picture is x(81).
01 ws-count picture is 9(4).
linkage section.
01 ls-text picture is x(80).
copy "rtex.cpy" replacing ==:pref:== by ==ls-tex==
==:level:== by ==01==.
procedure division using by reference ls-text
by reference ls-tex
returning omitted.
*
string ls-text delimited by space into ws-text end-string.
initialize ws-count.
inspect ws-text tallying ws-count
for characters before space.
add 1 to ws-count giving ws-count end-add.
*
call "COB_RayLib_LoadTexture" using
by reference ws-text
by reference ls-tex end-call.
goback.
end program raylib-load-texture.
******************************************************************
*Draw a texture rectangle
identification division.
program-id. raylib-draw-texture-rec.
data division.
working-storage section.
linkage section.
copy "rtex.cpy" replacing ==:pref:== by ==ls-tex==
==:level:== by ==01==.
copy "rrec.cpy" replacing ==:pref:== by ==ls-rec==
==:level:== by ==01==.
copy "rve2.cpy" replacing ==:pref:== by ==ls-pos==
==:level:== by ==01==.
copy "rcol.cpy" replacing ==:pref:== by ==ls-colour==
==:level:== by ==01==.
procedure division using by reference ls-tex
by reference ls-rec
by reference ls-pos
by reference ls-colour
returning omitted.
*
call "COB_RayLib_DrawTextureRec" using
by reference ls-tex
by value ls-rec-x
by value ls-rec-y
by value ls-rec-width
by value ls-rec-height
by value ls-pos-x
by value ls-pos-y
by value ls-colour-r
by value ls-colour-g
by value ls-colour-b
by value ls-colour-a end-call.
goback.
end program raylib-draw-texture-rec.
******************************************************************
*Check if key is being pressed
identification division.
program-id. raylib-iskeydown.
data division.
working-storage section.
01 ws-status :tp-int: synchronized.
linkage section.
01 ls-key :tp-int: synchronized.
procedure division using
by value ls-key.
*
call "IsKeyDown" using by value ls-key
returning ws-status end-call.
set return-code to ws-status.
goback.
end program raylib-iskeydown.
******************************************************************
*Draw lines onscreen
identification division.
program-id. raylib-clear-background.
data division.
linkage section.
copy "rcol.cpy" replacing ==:pref:== by ==ls-colour==
==:level:== by ==01==.
procedure division using
by value ls-colour
returning omitted.
*
call "COB_RayLib_ClearBackground" using
by value ls-colour-r
by value ls-colour-g
by value ls-colour-b
by value ls-colour-a end-call.
goback.
end program raylib-clear-background.
******************************************************************
*Begin/End drawing
identification division.
program-id. raylib-draw.
data division.
working-storage section.
linkage section.
01 ls-user usage is pointer.
01 ls-prog usage is program-pointer.
procedure division using by value ls-user
by value ls-prog
returning omitted.
*
call "BeginDrawing" end-call.
call ls-prog using by value ls-user end-call.
call "EndDrawing" end-call.
goback.
end program raylib-draw.
******************************************************************
*Begin/End 2D drawing
identification division.
program-id. raylib-mode-2d.
data division.
working-storage section.
linkage section.
01 ls-user usage is pointer.
01 ls-prog usage program-pointer.
copy "rc2d.cpy" replacing ==:pref:== by ==ls-cam==
==:level:== by ==01==.
procedure division using by value ls-user
by reference ls-cam
by value ls-prog
returning omitted.
*
call "COB_RayLib_BeginMode2D" using
by value ls-cam-offset-x
by value ls-cam-offset-y
by value ls-cam-target-x
by value ls-cam-target-y
by value ls-cam-rotation
by value ls-cam-zoom end-call.
call ls-prog using by value ls-user end-call.
call "EndMode2D" end-call.
goback.
end program raylib-mode-2d.