Actually managed to add SDL2 support somehow
This commit is contained in:
10
src/dawnsdl2/input/CMakeLists.txt
Normal file
10
src/dawnsdl2/input/CMakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
||||
# Copyright (c) 2022 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Sources
|
||||
target_sources(${DAWN_TARGET_NAME}
|
||||
PRIVATE
|
||||
InputManager.cpp
|
||||
)
|
20
src/dawnsdl2/input/InputManager.cpp
Normal file
20
src/dawnsdl2/input/InputManager.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
// Copyright (c) 2022 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "InputManager.hpp"
|
||||
#include "game/DawnGame.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
InputManager::InputManager(DawnGame *game) : IInputManager<int32_t>(game) {
|
||||
|
||||
}
|
||||
|
||||
float_t InputManager::getInputValue(int32_t axis) {
|
||||
auto exist = this->rawInputValues.find(axis);
|
||||
if(exist == this->rawInputValues.end()) return 0.0f;
|
||||
|
||||
return exist->second;
|
||||
}
|
19
src/dawnsdl2/input/InputManager.hpp
Normal file
19
src/dawnsdl2/input/InputManager.hpp
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright (c) 2022 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "input/_InputManager.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class InputManager : public IInputManager<int32_t> {
|
||||
protected:
|
||||
float_t getInputValue(int32_t axis) override;
|
||||
|
||||
public:
|
||||
std::map<int32_t, float_t> rawInputValues;
|
||||
|
||||
InputManager(DawnGame *game);
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user