Hello everybody !
I'm having trouble using Allegro's Event system, and since i'm quite new to programming i can't figure out what's going wrong...
I'm trying to use a really simple test code:
Everything works fine, until i press a key, then my program crashes with this error code: 0xC0000005 (no more comments)
Where did I make a mistake ?
Thanks for your help !
PS: I'm on Win10 and i'm using C::B
That should be an ALLEGRO_EVENT, not an ALLEGRO_EVENT*. A pointer is an address, and in this case you didn't initialize the value either. So when al_wait_for_event returns and tries to fill in the data at the address of the ALLEGRO_EVENT you passed into it, it crashes, with an access violation.
Thank you alot (again ;p )
I think it will solve my problem !
That should fix it.
Bump if you have questions.
ALLEGRO_EVENT keyboardEvent; ... // also change this to pass the address of the event object
while (!al_get_next_event(keyboardEventQueue, @keyboardEvent))
while (!al_get_next_event(keyboardEventQueue, &keyboardEvent))
&keyboardEvent
FTFY. The address-of ('&') operator in C returns the address of its operand.
Looks like DanielH is using Pascal or some other Wirth-lesque language.
Thanks alot for your replies !
I shall ask you if I have any questions ! (I will definitely have some later ;p)