-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
GfxWinEvt.exw
46 lines (32 loc) · 919 Bytes
/
GfxWinEvt.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
without warning
include std/machine.e
include EuSys2.ew
include EuGfx2.ew
include sfFlags.e
constant event = allocate(4 * 6)
atom win = sfRenderWindow_create(800,600,32,"My Window - Event",sfClose,0)
if win = -1 then
puts(1,"Could not create render window!\n")
abort(0)
end if
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+14)
atom shift = peek4s(event+16)
atom system = peek4s(event+20)
if eventType = sfEvtClosed then
sfRenderWindow_close(win)
elsif eventType = sfEvtKeyPressed then
if code = sfKeyEscape then
sfRenderWindow_close(win)
end if
end if
end while
sfRenderWindow_clear(win,sfBlack)
sfRenderWindow_display(win)
end while
sfRenderWindow_destroy(win)
28.6