Fixed input

This commit is contained in:
2024-09-10 20:17:32 -05:00
parent 0e5b85633c
commit 916396e175
14 changed files with 158 additions and 23 deletions

View File

@ -6,4 +6,5 @@
target_sources(${DAWN_TARGET_NAME}
PRIVATE
Entity.cpp
Player.cpp
)

View File

@ -10,7 +10,7 @@ using namespace Dawn;
void Entity::onInit() {
auto world = this->world.lock();
assertNotNull(world, "World is no longer active.");
assertNotNull(world, "World is no longer active? ");
}
void Entity::onDispose() {

View File

@ -0,0 +1,23 @@
// Copyright (c) 2024 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "Player.hpp"
#include "scene/Scene.hpp"
#include "input/InputBinds.hpp"
using namespace Dawn;
void Player::onInit() {
listenerUpdate = getScene()->onUnpausedUpdate.listen([this](float delta) {
InputManager &im = getGame()->inputManager;
if(im.isDown(InputBind::Up)) {
}
});
}
void Player::onDispose() {
listenerUpdate();
}

View File

@ -0,0 +1,18 @@
// Copyright (c) 2024 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "scene/SceneComponent.hpp"
namespace Dawn {
class Player : public SceneComponent {
protected:
std::function<void()> listenerUpdate;
public:
void onInit() override;
void onDispose() override;
};
}