Re: Allegro Wrapper Help
- Posted by Icy_Viking Jul 05, 2016
- 1600 views
petelomax said...
This quick hack worked for me, though I couldn't find any layout structures. I figured out the ev+20 from dumps, which is not exactly ideal.
atom display = 0 atom event = 0 atom key = 0 display = al_create_display(800,600) event = al_create_event_queue() --key = al_install_keyboard() if not al_install_keyboard() then ?9/0 end if --al_register_event_source(event,al_get_display_event_source(display)) al_register_event_source(event,al_get_keyboard_event_source()) atom run = 1 al_flip_display() atom ev = allocate(512) -- should be big enough... --program should end when ESC is pressed, but it does not happen while run = 1 do -- al_wait_for_event(event,0) al_wait_for_event(event,ev) if peek4s(ev)=ALLEGRO_EVENT_KEY_DOWN then key = peek4s(ev+20) if key = ALLEGRO_KEY_ESCAPE then run = 0 end if end if end while
Edit: I just found if key(KEY_ESC) then which may be what you are looking for? - oh, no, that's a much older version...
Thanks it worked. This "hack" is probably the more Euphoria way to make this kinds of programs.