mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-16 09:31:14 +00:00
- Make joystick input in the background CVAR controlled.
This commit is contained in:
parent
f340d411c3
commit
c3482b75fc
2 changed files with 22 additions and 2 deletions
|
@ -33,12 +33,18 @@
|
|||
#include <SDL.h>
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "version.h"
|
||||
#include "templates.h"
|
||||
#include "m_joy.h"
|
||||
|
||||
// Very small deadzone so that floating point magic doesn't happen
|
||||
#define MIN_DEADZONE 0.000001f
|
||||
|
||||
CUSTOM_CVAR(Bool, joy_background, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE|CVAR_NOINITCALL)
|
||||
{
|
||||
Printf("This won't take effect until " GAMENAME " is restarted.\n");
|
||||
}
|
||||
|
||||
class SDLInputJoystick: public IJoystickConfig
|
||||
{
|
||||
public:
|
||||
|
@ -298,7 +304,8 @@ static SDLInputJoystickManager *JoystickManager;
|
|||
|
||||
void I_StartupJoysticks()
|
||||
{
|
||||
SDL_SetHint("SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS", "1");
|
||||
if (joy_background)
|
||||
SDL_SetHint("SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS", "1");
|
||||
if(SDL_InitSubSystem(SDL_INIT_JOYSTICK) >= 0)
|
||||
JoystickManager = new SDLInputJoystickManager();
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "c_dispatch.h"
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "version.h"
|
||||
#include "win32iface.h"
|
||||
#include "templates.h"
|
||||
#include "gameconfigfile.h"
|
||||
|
@ -286,6 +287,11 @@ CUSTOM_CVAR(Bool, joy_dinput, true, CVAR_GLOBALCONFIG|CVAR_ARCHIVE|CVAR_NOINITCA
|
|||
D_PostEvent(&ev);
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Bool, joy_background, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE|CVAR_NOINITCALL)
|
||||
{
|
||||
Printf("This won't take effect until " GAMENAME " is restarted.\n");
|
||||
}
|
||||
|
||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||
|
||||
static const uint8_t POVButtons[9] = { 0x01, 0x03, 0x02, 0x06, 0x04, 0x0C, 0x08, 0x09, 0x00 };
|
||||
|
@ -389,7 +395,14 @@ bool FDInputJoystick::GetDevice()
|
|||
Printf(TEXTCOLOR_ORANGE "Setting data format for %s failed.\n", Name.GetChars());
|
||||
return false;
|
||||
}
|
||||
hr = Device->SetCooperativeLevel(Window, DISCL_NONEXCLUSIVE | DISCL_BACKGROUND);
|
||||
if (joy_background)
|
||||
{
|
||||
hr = Device->SetCooperativeLevel(Window, DISCL_NONEXCLUSIVE | DISCL_BACKGROUND);
|
||||
}
|
||||
else
|
||||
{
|
||||
hr = Device->SetCooperativeLevel(Window, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND);
|
||||
}
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Printf(TEXTCOLOR_ORANGE "Setting cooperative level for %s failed.\n", Name.GetChars());
|
||||
|
|
Loading…
Reference in a new issue