Actually managed to add SDL2 support somehow

This commit is contained in:
2023-01-16 11:10:18 -08:00
parent 23fc1206ba
commit 15a34bd70b
17 changed files with 347 additions and 1 deletions

View 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
)

View 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;
}

View 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);
};
}