prog
This commit is contained in:
2
lib/SDL
2
lib/SDL
Submodule lib/SDL updated: 87a83787a3...c9aec268fa
Submodule lib/openal-soft updated: d66107e9f0...fde74453a6
@ -9,6 +9,7 @@ target_sources(${DAWN_TARGET_NAME}
|
||||
UICanvas.cpp
|
||||
UIComponent.cpp
|
||||
UILabel.cpp
|
||||
UIMenuController.cpp
|
||||
)
|
||||
|
||||
tool_scenecomponent(UICanvas scene/components/ui/UICanvas.hpp)
|
@ -1,14 +0,0 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "scene/SceneItemComponent.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class UIMenuController : public SceneItemComponent {
|
||||
public:
|
||||
|
||||
};
|
||||
}
|
30
src/dawn/scene/components/ui/UIMenuController.cpp
Normal file
30
src/dawn/scene/components/ui/UIMenuController.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "UIMenuController.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
UIMenuController::UIMenuController(SceneItem *item) :
|
||||
SceneItemComponent(item),
|
||||
active(false),
|
||||
menuX(0),
|
||||
menuY(0),
|
||||
columns(4),
|
||||
rows(4)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void UIMenuController::onStart() {
|
||||
useEffectWithTeardown([&]{
|
||||
if(!active) return activeTeardown = [&]{ };
|
||||
|
||||
return activeTeardown = [&]{
|
||||
|
||||
};
|
||||
}, active)();
|
||||
}
|
28
src/dawn/scene/components/ui/UIMenuController.hpp
Normal file
28
src/dawn/scene/components/ui/UIMenuController.hpp
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "scene/SceneItemComponent.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class UIMenuController : public SceneItemComponent {
|
||||
private:
|
||||
std::function<void()> activeTeardown;
|
||||
|
||||
public:
|
||||
StateProperty<bool_t> active;
|
||||
StateProperty<int32_t> menuX;
|
||||
StateProperty<int32_t> menuY;
|
||||
StateProperty<int32_t> columns;
|
||||
StateProperty<int32_t> rows;
|
||||
|
||||
StateEvent<int32_t, int32_t> eventItemChange;
|
||||
StateEvent<int32_t, int32_t> eventItemSelected;
|
||||
|
||||
UIMenuController(SceneItem *item);
|
||||
|
||||
void onStart();
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user