c++ - How do you fix a program from freezing when you move the window in SDL2? -
c++ - How do you fix a program from freezing when you move the window in SDL2? -
i'm making little game friend , 1 problem when drag window around, freezes , programme stops until allow go. searched simple solution found out happens everything. also, screws delta time since acts long frame. there way either have programme go on running while move or if that's complicated, prepare delta time? thanks?
your application "freezing" because has winmain loop similar this:
while (true) { if(peekmessage(&msg,null,0,0,pm_remove)) { translatemessage(&msg); dispatchmessage(&msg); } else { tickgame(); } }
so instead of ticking processing wm_move message . 1 simple work around phone call games tick function within move message, or perhaps makes sense pause game when first move message , unpause if haven't gotten 1 sec or two. is, people going dragging window while playing, unlikely.
to reply sec question, typically games (physics engines especially) utilize fixed time step stabilize simulation, read more fixed time step here.
c++ visual-studio-2013 windows-8 window sdl-2
Comments
Post a Comment