From 88dd6235bcf78c545796795ac6a1f0732e4fab9e Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 9 Oct 2008 19:23:50 +0000 Subject: Add mouse grab callback for Hexen. Subversion-branch: /branches/raven-branch Subversion-revision: 1347 --- src/hexen/h2_main.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src') diff --git a/src/hexen/h2_main.c b/src/hexen/h2_main.c index 6c7e4aa4..aadf647c 100644 --- a/src/hexen/h2_main.c +++ b/src/hexen/h2_main.c @@ -180,6 +180,24 @@ void D_BindVariables(void) } } +// +// D_GrabMouseCallback +// +// Called to determine whether to grab the mouse pointer +// + +static boolean D_GrabMouseCallback(void) +{ + // when menu is active or game is paused, release the mouse + + if (MenuActive || paused) + return false; + + // only grab mouse when playing levels (but not demos) + + return (gamestate == GS_LEVEL) && !demoplayback; +} + //========================================================================== // // H2_Main @@ -518,6 +536,8 @@ void H2_GameLoop(void) debugfile = fopen(filename, "w"); } I_InitGraphics(); + I_SetGrabMouseCallback(D_GrabMouseCallback); + while (1) { // Frame syncronous IO operations -- cgit v1.2.3