-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
GfxWinGfx.exw
62 lines (42 loc) · 1.2 KB
/
GfxWinGfx.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
57
58
59
60
61
62
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 - Image",sfClose,0)
if win = -1 then
puts(1,"Could not create render window!\n")
abort(0)
end if
atom tex = sfTexture_createFromFile("sfml-logo-small.png",0,0,0,0)
if tex = -1 then
puts(1,"Could not load image!\n")
abort(0)
end if
atom sprite = sfSprite_create()
sfSprite_setTexture(sprite,tex,sfTrue)
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 = sfEvtKeyPressed then
if code = sfKeyEscape then
sfRenderWindow_close(win)
end if
elsif eventType = sfEvtClosed then
sfRenderWindow_close(win)
end if
end while
sfRenderWindow_clear(win,sfBlack)
sfRenderWindow_drawSprite(win,sprite,0)
sfRenderWindow_display(win)
end while
sfSprite_destroy(sprite)
sfTexture_destroy(tex)
sfRenderWindow_destroy(win)
43.8