Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: When i move sdl window the app freeze...

  1. #1

    When i move sdl window the app freeze...

    When i move sdl window or the console window the app freeze... :? It's a problem on the code or what ?

    [pascal]
    program onMines;

    {$APPTYPE CONSOLE}

    uses
    SysUtils,
    SDL,
    const_unit,
    type_unit;

    var
    screen: PSDL_Surface;
    ltick: Cardinal;
    event: TSDL_Event;

    const
    fps = Trunc(1000 / 30);

    begin
    SDL_Init(SDL_INIT_VIDEO);
    screen := SDL_SetVideoMode(640, 480, 24, SDL_SWSURFACE or SDL_DOUBLEBUF);
    while True do
    begin
    ltick := SDL_GetTicks;
    SDL_PollEvent(@event);
    case event.type_ of
    SDL_MOUSEMOTION:
    Writeln(Format('mouse moved to x:%s | y:%s',[IntToStr(event.motion.x), IntToStr(event.motion.y)]));
    SDL_KEYDOWN:
    Writeln(Format('tecla : %s foi pressionada',[IntToStr(event.key.keysym.scancode)]) );
    SDL_QUITEV:
    Break;
    end;
    SDL_Delay(fps - (SDL_GetTicks - ltick));
    end;
    SDL_Quit;


    end.
    [/pascal]


    and,
    how can i have the console window to make only sdl window visible?

    Edit: one more question, in that code when i press "A" it recognizes many many A presses
    From brazil (:

    Pascal pownz!

  2. #2

    When i move sdl window the app freeze...

    Hi

    I have noticed that when moving an SDL window about the app freezes , I think this happens in most SDL apps. It's just something that happens (please someone correct me )

    You can get rid of the Console window by removing the line

    [pascal]
    {$APPTYPE CONSOLE}
    [/pascal]

    This can be handy sometimes so I tend to use

    [pascal]
    {$IFOPT D+}
    {$APPTYPE CONSOLE}
    {$ENDIF}
    [/pascal]

    Which just enables the console window when debugging is enabled.

    To stop the same key being handled you have to either

    1) use SDL_EnableKeyRepeat to disable key repeat
    2) use SDL_GetKeyState to get the current state of the keyboard then check if the key is pressed. (See Demos in JEDI-SDLv1.0 to examples)

    Hope this helps

    Dean
    <A HREF="http://www.myhpf.co.uk/banner.asp?friend=139328">
    <br /><IMG SRC="http://www.myhpf.co.uk/banners/60x468.gif" BORDER="0">
    <br /></A>

  3. #3

    When i move sdl window the app freeze...

    Quote Originally Posted by technomage
    Hi

    I have noticed that when moving an SDL window about the app freezes , I think this happens in most SDL apps. It's just something that happens (please someone correct me )

    You can get rid of the Console window by removing the line

    [pascal]
    {$APPTYPE CONSOLE}
    [/pascal]

    This can be handy sometimes so I tend to use

    [pascal]
    {$IFOPT D+}
    {$APPTYPE CONSOLE}
    {$ENDIF}
    [/pascal]

    Which just enables the console window when debugging is enabled.

    To stop the same key being handled you have to either

    1) use SDL_EnableKeyRepeat to disable key repeat
    2) use SDL_GetKeyState to get the current state of the keyboard then check if the key is pressed. (See Demos in JEDI-SDLv1.0 to examples)

    Hope this helps

    Dean
    Thanks xD

    but the sdl window freezing is much bad =/
    From brazil (:

    Pascal pownz!

  4. #4

    When i move sdl window the app freeze...

    I've never noticed this.. (Sorry if this seems to contradict you Technomage)

    Could you please post an example of the freezing app so I can test it? I'm a little worried that this might be an SDL issue which I'm not aware of using a different hardware setup to my own.

  5. #5
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    When i move sdl window the app freeze...

    I get the same thing as Dean. Actually what happens is that while the window is being dragged the program will freeze for that time. Let go of the mouse button to stop dragging it and the program will resume.

    I believe it has to do with SDL's window management specifics.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  6. #6

    When i move sdl window the app freeze...

    Quote Originally Posted by WILL
    I get the same thing as Dean. Actually what happens is that while the window is being dragged the program will freeze for that time. Let go of the mouse button to stop dragging it and the program will resume.

    I believe it has to do with SDL's window management specifics.
    my english don't able me to understand if you proposed an solution or not ops:

    can you rewrite it ?

    sorry
    From brazil (:

    Pascal pownz!

  7. #7
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    When i move sdl window the app freeze...

    I'm trying to say that your problem is normal. SDL does that.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  8. #8

    When i move sdl window the app freeze...

    Quote Originally Posted by WILL
    I'm trying to say that your problem is normal. SDL does that.
    But it Freezes completly :? , it don't recover... it crashes..

    its normal :shock: ?

    Edit: its possible to create a surface based on a bitmap on memory ?
    From brazil (:

    Pascal pownz!

  9. #9
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    When i move sdl window the app freeze...

    Well, crashing like that is not normal... :?

    I think you might be either doing something wrong/unconventional(not normal) in your code or you something might be corrupt somewhere...


    When you create a SDL_Surface thats basically what you're doing. You're making achunk of memory that is the actual color data. You just have to know what pixel format you want to use and stick to it.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  10. #10

    When i move sdl window the app freeze...

    Quote Originally Posted by WILL
    Well, crashing like that is not normal... :?

    I think you might be either doing something wrong/unconventional(not normal) in your code or you something might be corrupt somewhere...


    When you create a SDL_Surface thats basically what you're doing. You're making achunk of memory that is the actual color data. You just have to know what pixel format you want to use and stick to it.
    :? looks simple, how can i do it ?
    From brazil (:

    Pascal pownz!

Page 1 of 2 12 LastLast

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
  •