Game Development Community

Dragging window

by anycast · in Torque Game Builder · 12/29/2008 (5:16 am) · 2 replies

Hello all,

I'm making a small game in windowed mode. Whenever I drag the game's window, the game freezes (this is ok) but apparently the physics engine keeps ticking away. This means that when I stop dragging the window, some objects will jump around if they we're moving, since a lot of time has elapsed during the window dragging process.

Is there any workaround for this? Any way to detect that the app window is being dragged so that I can call setscenepause ?

Best regards,
Alex

#1
12/29/2008 (6:53 am)
Yeah it's funny how TGB has no handling for this event whatsoever.

Assuming you let the onWindowFocusChange function pause the game, you can try something like this (requires a TGB pro
version...)

in winWindow.cc around line 900:
case WM_MOVING:
       if( Game->isRunning() )
      {
         if (Con::isFunction("onWindowFocusChange"))
            Con::executef( 2, "onWindowFocusChange", "0" );
      }
      return 1;
   break;

It doesn't work perfect for me but this should put you in the right direction.
#2
12/29/2008 (7:40 am)
Thanks, this is exactly what I was looking for (well, I was hoping that there was some callback function called onWindowDragged, but I guess it never made it on GG's roadmap :-) ).

Alex