Re: SFML2 Demo Dilema
- Posted by Icy_Viking May 09, 2015
- 2590 views
Ok I got the window to stay open with this code. Now I just need to code the events so you can properly close the window, without it locking up the computer.
without warning include std/machine.e include EuSys2.ew include EuGfx2.ew include sfFlags.e atom win = sfRenderWindow_create(800,600,32,"My Window",sfClose,0) if win = -1 then puts(1,"Could not create render window!\n") abort(0) end if constant event = allocate(4 * 6) integer eventType = peek4s(event) integer code = peek4s(event+4) integer alt = peek4s(event+8) integer control = peek4s(event+12) integer shift = peek4s(event+16) integer system = peek4s(event+20) while sfRenderWindow_isOpen(win) do while sfRenderWindow_pollEvent(win,event) do if sfeventType = sfEvtClosed then sfRenderWindow_close(win) end if --This still dosen't close the window when clicking on the "X" button. Am I using it correctly? end while sfRenderWindow_clear(win,sfBlack) sfRenderWindow_display(win) end while sfRenderWindow_destroy(win)