Re: [Sdl4fp-users] Event handling
Brought to you by:
trixx
From: Matthias <ma...@gm...> - 2006-02-28 18:52:25
|
Hi Samuel, thanks for your answer. Do you know why I don't have to allocate surface = pointer even though it is a pointer, too? Bye, Matthias ----- Original Message -----=20 From: Samuel Lid=E9n Borell=20 To: sdl...@li...=20 Sent: Saturday, February 25, 2006 11:05 PM Subject: Re: [Sdl4fp-users] Event handling Hi You're using a pointer that you haven't allocated yet (then it will be = NIL). Either you have to allocate it like this: VAR event_test:pSDL_EVENT; BEGIN New(event_test); Or you can use a record variable and pass it as a pointer to the = SDL_PollEvent function (this is what the C code does): USES SDL, SDL_VIDEO, SDL_EVENTS; VAR event_test: SDL_EVENT; ... SDL_INIT(SDL_INIT_VIDEO); ... WHILE SDL_POLLEVENT(@event_test)=3D1 do BEGIN CASE event_test.eventtype OF SDL_KEYDOWN: ... SDL_EVENTQUIT: ... END; END; /Samuel Matthias wrote:=20 Anytime the compiler gets to the line with expression = event_test^.eventtype it stops because protection fault. Actually = event_test^.eventtype should store an integer-value but allocating it to = a variable of such kind will also lead to abortion. What am I doing wrong? Thanks for your help. Matthias |