-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
RenderWinEx.exw
56 lines (39 loc) · 1.16 KB
/
RenderWinEx.exw
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
--Render Window Example
--Written By Andy P.
--Copyright (c) 2022
without warning
without type_check
include std/machine.e
include std/dll.e
include flags.e
include System.ew
include Graphics.ew
include Audio.ew
atom win = sfRenderWindow_create(800,600,32,"Hello",sfClose,0)
if win = -1 then
puts(1,"Failed to create Render Window!\n")
abort(0)
end if
constant event = allocate(4 * 6) --allocate memory for events
atom blue = sfColor_fromRGB(0,0,255) --blue
--Use RGB values (i.e. red is 255,0,0)
--You can also use sfColor_fromRGBA to add in a alpha color
--use to change color of window
while sfRenderWindow_isOpen(win) do
while sfRenderWindow_pollEvent(win,event) do
atom eventType = peek4s(event)
atom code = peek4s(event+4)
atom alt = peek4s(event+8)
atom control = peek4s(event+13)
atom shift = peek4s(event+16)
atom system = peek4s(event+20)
if eventType = sfEvtClosed then
sfRenderWindow_close(win)
end if
end while
sfRenderWindow_clear(win,sfBLACK)
sfRenderWindow_display(win)
end while
free(event) --free event to prevent memory leaks
sfRenderWindow_destroy(win)
31.0