1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

delete useless include and open joystick in InputSourceGameController constructor.

This commit is contained in:
kdmcser
2024-04-15 22:43:37 +08:00
parent cee8d34fc5
commit 876bae0b73
7 changed files with 2 additions and 15 deletions

View File

@ -7,6 +7,7 @@
* Full text of license available in license.txt file, in main folder
*
*/
#include <SDL.h>
#include "StdInc.h"
#include "GameControllerShortcuts.h"

View File

@ -10,8 +10,6 @@
#pragma once
#include <map>
#include <SDL.h>
#include "../gui/Shortcut.h"
using ButtonShortcutsMap = std::map<int, std::vector<EShortcut> >;

View File

@ -349,8 +349,3 @@ const Point & InputHandler::getCursorPosition() const
{
return cursorPosition;
}
void InputHandler::tryOpenGameController()
{
gameControllerHandler->tryOpenAllGameControllers();
}

View File

@ -87,6 +87,4 @@ public:
bool isKeyboardCtrlDown() const;
bool isKeyboardShiftDown() const;
/// If any game controller available, use it.
void tryOpenGameController();
};

View File

@ -34,7 +34,7 @@ InputSourceGameController::InputSourceGameController():
planDisX(0.0),
planDisY(0.0)
{
// SDL_init has not been called. so it is unnecessary to open joystick.
tryOpenAllGameControllers();
}
void InputSourceGameController::tryOpenAllGameControllers()

View File

@ -10,10 +10,8 @@
#pragma once
#include <memory>
#include <SDL.h>
#include "../../lib/Point.h"
#include "../gui/Shortcut.h"

View File

@ -79,9 +79,6 @@ void CGuiHandler::init()
inputHandlerInstance = std::make_unique<InputHandler>(); // Must be after windowHandlerInstance
shortcutsHandlerInstance = std::make_unique<ShortcutHandler>();
framerateManagerInstance = std::make_unique<FramerateManager>(settings["video"]["targetfps"].Integer());
// This must be called after SDL_init(), so put after screenHandlerInstance init.
inputHandlerInstance->tryOpenGameController();
}
void CGuiHandler::handleEvents()