diff options
author | Simon Howard | 2008-09-25 18:17:29 +0000 |
---|---|---|
committer | Simon Howard | 2008-09-25 18:17:29 +0000 |
commit | a8e1c601bc4807f64e716d5813c7f2c26fa92e71 (patch) | |
tree | b80876a97fdf853d9190c617ca1170a8f4059a05 | |
parent | 6ebcafd7003cce44d1edd1115e737f1aa826ba1c (diff) | |
download | chocolate-doom-a8e1c601bc4807f64e716d5813c7f2c26fa92e71.tar.gz chocolate-doom-a8e1c601bc4807f64e716d5813c7f2c26fa92e71.tar.bz2 chocolate-doom-a8e1c601bc4807f64e716d5813c7f2c26fa92e71.zip |
Add mouse grab callback for Heretic.
Subversion-branch: /branches/raven-branch
Subversion-revision: 1282
-rw-r--r-- | src/heretic/d_main.c | 20 | ||||
-rw-r--r-- | src/heretic/doomdef.h | 2 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c index cf844e70..94d51851 100644 --- a/src/heretic/d_main.c +++ b/src/heretic/d_main.c @@ -188,6 +188,24 @@ void D_Display(void) I_FinishUpdate(); } +// +// D_GrabMouseCallback +// +// Called to determine whether to grab the mouse pointer +// + +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; +} + //--------------------------------------------------------------------------- // // PROC D_DoomLoop @@ -203,6 +221,8 @@ void D_DoomLoop(void) debugfile = fopen(filename, "w"); } I_InitGraphics(); + I_SetGrabMouseCallback(D_GrabMouseCallback); + while (1) { // Frame syncronous IO operations diff --git a/src/heretic/doomdef.h b/src/heretic/doomdef.h index 63ad37f7..4aa4eee2 100644 --- a/src/heretic/doomdef.h +++ b/src/heretic/doomdef.h @@ -891,6 +891,8 @@ void SB_Drawer(void); // MENU (MN_menu.c) //----------------- +extern boolean MenuActive; + void MN_Init(void); void MN_ActivateMenu(void); void MN_DeactivateMenu(void); |