mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-26 08:05:38 +00:00
Print all Log messages to cout with --debug set.
Added startPolling and stopPolling to InputManager.
This commit is contained in:
parent
20d08587f2
commit
1dfb45e133
|
@ -28,7 +28,7 @@ bool InputDevice::operator==(const InputDevice & b) const
|
|||
|
||||
InputManager::InputManager(Window* window) : mWindow(window),
|
||||
mJoysticks(NULL), mInputConfigs(NULL), mKeyboardInputConfig(NULL), mPrevAxisValues(NULL),
|
||||
mNumJoysticks(0), mNumPlayers(0), devicePollingTimer(nullptr)
|
||||
mNumJoysticks(0), mNumPlayers(0), devicePollingTimer(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -164,14 +164,31 @@ void InputManager::init()
|
|||
SDL_JoystickEventState(SDL_ENABLE);
|
||||
|
||||
//start timer for input device polling
|
||||
devicePollingTimer = SDL_AddTimer(POLLING_INTERVAL, devicePollingCallback, (void *)this);
|
||||
startPolling();
|
||||
|
||||
loadConfig();
|
||||
}
|
||||
|
||||
void InputManager::startPolling()
|
||||
{
|
||||
if(devicePollingTimer != NULL)
|
||||
return;
|
||||
|
||||
devicePollingTimer = SDL_AddTimer(POLLING_INTERVAL, devicePollingCallback, (void *)this);
|
||||
}
|
||||
|
||||
void InputManager::stopPolling()
|
||||
{
|
||||
if(devicePollingTimer == NULL)
|
||||
return;
|
||||
|
||||
SDL_RemoveTimer(devicePollingTimer);
|
||||
devicePollingTimer = NULL;
|
||||
}
|
||||
|
||||
void InputManager::deinit()
|
||||
{
|
||||
SDL_RemoveTimer(devicePollingTimer);
|
||||
stopPolling();
|
||||
|
||||
SDL_JoystickEventState(SDL_DISABLE);
|
||||
|
||||
|
@ -380,6 +397,8 @@ void InputManager::loadConfig()
|
|||
LOG(LogInfo) << "No input configs loaded. Loading default keyboard config.";
|
||||
loadDefaultConfig();
|
||||
}
|
||||
|
||||
LOG(LogInfo) << "Loaded InputConfig data for " << getNumPlayers() << " devices.";
|
||||
}
|
||||
|
||||
//used in an "emergency" where no configs could be loaded from the inputmanager config file
|
||||
|
|
|
@ -77,6 +77,9 @@ public:
|
|||
bool parseEvent(const SDL_Event& ev);
|
||||
|
||||
InputConfig* getInputConfigByPlayer(int player);
|
||||
|
||||
void startPolling();
|
||||
void stopPolling();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -65,6 +65,7 @@ Log::~Log()
|
|||
fprintf(getOutput(), "%s", os.str().c_str());
|
||||
|
||||
//if it's an error, also print to console
|
||||
if(messageLevel == LogError)
|
||||
//print all messages if using --debug
|
||||
if(messageLevel == LogError || reportingLevel >= LogDebug)
|
||||
fprintf(stderr, "%s", os.str().c_str());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue