mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
Separate input capturing from OSD drawing so that we don't have to wait for the OSD to scroll off the screen to un-grab everything
git-svn-id: https://svn.eduke32.com/eduke32@402 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
286dd4b519
commit
5d79272ac2
2 changed files with 23 additions and 7 deletions
|
@ -51,6 +51,9 @@ int OSD_HandleKey(int sc, int press);
|
|||
// handles the readjustment when screen resolution changes
|
||||
void OSD_ResizeDisplay(int w,int h);
|
||||
|
||||
// captures and frees osd input
|
||||
void OSD_CaptureInput(int cap);
|
||||
|
||||
// shows or hides the onscreen display
|
||||
void OSD_ShowDisplay(int onf);
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ static int osdcols=60; // width of onscreen display in text columns
|
|||
static int osdmaxrows=20; // maximum number of lines which can fit on the screen
|
||||
static int osdmaxlines=TEXTSIZE/60; // maximum lines which can fit in the buffer
|
||||
static char osdvisible=0; // onscreen display visible?
|
||||
static char osdinput=0; // capture input?
|
||||
static int osdhead=0; // topmost visible line number
|
||||
static BFILE *osdlog=NULL; // log filehandle
|
||||
static char osdinited=0; // text buffer initialised?
|
||||
|
@ -199,6 +200,8 @@ static int _internal_osdfunc_vars(const osdfuncparm_t *parm)
|
|||
osdrows = atoi(parm->parms[0]);
|
||||
if (osdrows < 1) osdrows = 1;
|
||||
else if (osdrows > osdmaxrows) osdrows = osdmaxrows;
|
||||
if (osdrowscur < osdrows) osdscroll = 1;
|
||||
else if (osdrowscur > osdrows) osdscroll = -1;
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
}
|
||||
|
@ -368,10 +371,11 @@ int OSD_HandleKey(int sc, int press)
|
|||
else if (osdrowscur == osdrows)
|
||||
osdscroll = -1;
|
||||
osdrowscur += osdscroll;
|
||||
OSD_CaptureInput(osdscroll == 1);
|
||||
bflushchars();
|
||||
}
|
||||
return 0;//sc;
|
||||
} else if (!osdvisible) {
|
||||
} else if (!osdinput) {
|
||||
return sc;
|
||||
}
|
||||
|
||||
|
@ -669,18 +673,27 @@ void OSD_ResizeDisplay(int w, int h)
|
|||
}
|
||||
|
||||
|
||||
//
|
||||
// OSD_CaptureInput()
|
||||
//
|
||||
void OSD_CaptureInput(int cap)
|
||||
{
|
||||
osdinput = (cap != 0);
|
||||
osdeditcontrol = 0;
|
||||
osdeditshift = 0;
|
||||
|
||||
grabmouse(osdinput == 0);
|
||||
onshowosd(osdinput);
|
||||
if (osdinput) releaseallbuttons();
|
||||
}
|
||||
|
||||
//
|
||||
// OSD_ShowDisplay() -- Shows or hides the onscreen display
|
||||
//
|
||||
void OSD_ShowDisplay(int onf)
|
||||
{
|
||||
osdvisible = (onf != 0);
|
||||
osdeditcontrol = 0;
|
||||
osdeditshift = 0;
|
||||
|
||||
grabmouse(osdvisible == 0);
|
||||
onshowosd(osdvisible);
|
||||
if (osdvisible) releaseallbuttons();
|
||||
OSD_CaptureInput(osdvisible);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue