Results 1 to 3 of 3

Thread: [SOLVED]APP error on event handling

  1. #1

    [SOLVED]APP error on event handling

    Code:
    var
      screen: PSDL_Surface;
      dot: PSDL_Surface;
      event: PSDL_Event;
      Running: Boolean;
      nextstep: Cardinal;
    
    begin
      Running := True;
      SDL_Init(SDL_INIT_VIDEO);
      screen := SDL_SetVideoMode(640, 480, 24, SDL_HWSURFACE or SDL_HWACCEL);
      dot := imagingsdl.LoadSDLSurfaceFromFile('dot.png');
    
      repeat
        //  event manager
        while SDL_PollEvent(@event) > 0 do
        begin
          case event.type_ of
            SDL_QUITEV: Running := False;
          end;
        end;
    
        if SDL_GetTicks >= nextstep then
        begin
          drawbg;
          SDL_UpdateRect(screen, 0, 0, 640, 480);
          SDL_FillRect(screen, nil, 0);
          Inc(frames);
          Inc(nextstep, interval);
        end;
    
        SDL_Delay(1);
    
      until not Running;
    
      SDL_FreeSurface(dot);
      SDL_Quit;
    
    end.
    The app is crashing with this message on "case event.type_ of" line



    For me looks everything right :?
    What is the problem?
    From brazil (:

    Pascal pownz!

  2. #2

    [SOLVED]APP error on event handling

    The SDL_PollEvent(@event) call looks fishy to me. You're passing a pointer to a PSDL_Event (PPSDL_Event) and the function expects a PSDL_Event. Replace event variable declaration from PSDL_event to SDL_event and it should work.

  3. #3

    [SOLVED]APP error on event handling

    Quote Originally Posted by Setharian
    The SDL_PollEvent(@event) call looks fishy to me. You're passing a pointer to a PSDL_Event (PPSDL_Event) and the function expects a PSDL_Event. Replace event variable declaration from PSDL_event to SDL_event and it should work.
    opz, a T instead of P :? nice observation

    thx for the reply

    [SOLVED]
    From brazil (:

    Pascal pownz!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •