Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Allegro Question
#1
Can anyone tell me why this section of code does not work? Why is it when I hit escape, the program doesn't exit? It pretty much just freezes up on me.

Code:
'$include: "allegro.bi"

allegro_init
install_keyboard

ret = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 800, 600, 0, 0)
if ret <> 0 then
   allegro_message(allegro_error)
   allegro_exit
   end
end if

do
loop until inkey$ = chr$(27)

allegro_exit

Any help is appreciated.
o time for the old in-out Love, I've just come to check the meter.
Reply
#2
You can't use INKEY$ while using Allegro, as Allegro takes over the input system. You have to use Allegro input functions only after you call allegro_init...
A solution to your problem is to replace your keypress waiting loop with
Code:
while not keypressed: wend
ngelo Mottola - EC++
Reply
#3
Ah, thanks Angelo. Much appreciated.
o time for the old in-out Love, I've just come to check the meter.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)