Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ profile/*
logs/*
private/*
.DS_Store
*.exe
1 change: 1 addition & 0 deletions config/sounds.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ registermusic "dcp/Dietmar_Pier_-_AssaultCube" // M_LASTMINUTE2
const preload_music [ loop m 3 [ musicpreload $m ] ]
// uncomment the line below if you want to preload the music (if you experience delay e.g. when picking up a flag)
//preload_music
musicvol 0
4 changes: 4 additions & 0 deletions source/src/cube.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ extern int hwtexsize, hwmaxaniso;
extern int maploaded, msctrl;
extern float waterlevel;

// global mouse pointer handling
extern bool grabinput;
void inputgrab(bool on, bool delay = false);

#define AC_MASTER_URI "ms.cubers.net"

// uncomment this line for production release
Expand Down
5 changes: 3 additions & 2 deletions source/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,14 @@ VARN(relativemouse, userelativemouse, 1, 1, 0);
VARNP(relativemouse, userelativemouse, 0, 1, 1);
#endif

static bool shouldgrab = false, grabinput = false, minimized = false, centerwindow = true, canrelativemouse = true, relativemouse = false;
static bool shouldgrab = false, minimized = false, centerwindow = true, canrelativemouse = true, relativemouse = false;
bool grabinput = false;

#ifdef SDL_VIDEO_DRIVER_X11
VAR(sdl_xgrab_bug, 0, 0, 1);
#endif

void inputgrab(bool on, bool delay = false)
void inputgrab(bool on, bool delay)
{
#ifdef SDL_VIDEO_DRIVER_X11
bool wasrelativemouse = relativemouse;
Expand Down
3 changes: 3 additions & 0 deletions source/src/menus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ inline gmenu *setcurmenu(gmenu *newcurmenu) // only change curmenu through

void menuset(void *m, bool save)
{
if (m == NULL) inputgrab(grabinput = true);
if(curmenu==m) return;
if(curmenu)
{
Expand All @@ -31,6 +32,8 @@ void menuset(void *m, bool save)

void showmenu(const char *name, bool top)
{
// enable cursor
inputgrab(grabinput = false);
menurighttabwidth = max(VIRTW/4, 15 * text_width("w")); // adapt to screen and font size every time a menu opens
if(!name)
{
Expand Down
Loading