Finished camera controller.
This commit is contained in:
@ -8,6 +8,7 @@
|
||||
#include "assert/assert.hpp"
|
||||
#include "util/flag.hpp"
|
||||
#include "event/Event.hpp"
|
||||
#include "state/StateEvent.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class SceneItem;
|
||||
@ -40,7 +41,8 @@ namespace Dawn {
|
||||
|
||||
public:
|
||||
// I have no idea if I'm keeping this
|
||||
Event<> eventTransformUpdated;
|
||||
// Event<> eventTransformUpdated;
|
||||
StateEvent<> eventTransformUpdated;
|
||||
SceneItem *item;
|
||||
|
||||
/**
|
||||
|
@ -1,27 +0,0 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "Prefab.hpp"
|
||||
#include "ui/UIComponent.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
template<class T, class P>
|
||||
class UIPrefab :
|
||||
public Prefab<T, UICanvas, P>
|
||||
{
|
||||
public:
|
||||
static void apply(T *item) {
|
||||
assertNotNull(item);
|
||||
P::prefabApply(&item->getGame()->assetManager , item);
|
||||
}
|
||||
|
||||
static T * prefabCreate(UICanvas *canvas) {
|
||||
T * item = canvas->addElement<T>();
|
||||
P::apply(item);
|
||||
return item;
|
||||
}
|
||||
};
|
||||
}
|
@ -59,6 +59,8 @@ void CharacterController2D::onStart() {
|
||||
}
|
||||
}
|
||||
|
||||
if(mathAbs<float_t>(moveAmount.x) <= 0.001f && mathAbs<float_t>(moveAmount.y) <= 0.001f) return;
|
||||
|
||||
transform->setLocalPosition(
|
||||
transform->getLocalPosition() + (glm::vec3(moveAmount.x, 0, moveAmount.y) * delta)
|
||||
);
|
||||
|
Reference in New Issue
Block a user