From 95e5aa1eebf7826163acdf4763b76b957fbe654d Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Mon, 6 Mar 2023 22:04:47 -0800 Subject: [PATCH] prog --- lib/SDL | 2 +- lib/openal-soft | 2 +- src/dawn/scene/components/ui/CMakeLists.txt | 1 + src/dawn/scene/components/ui/UIMenu.hpp | 14 --------- .../scene/components/ui/UIMenuController.cpp | 30 +++++++++++++++++++ .../scene/components/ui/UIMenuController.hpp | 28 +++++++++++++++++ 6 files changed, 61 insertions(+), 16 deletions(-) delete mode 100644 src/dawn/scene/components/ui/UIMenu.hpp create mode 100644 src/dawn/scene/components/ui/UIMenuController.cpp create mode 100644 src/dawn/scene/components/ui/UIMenuController.hpp diff --git a/lib/SDL b/lib/SDL index 87a83787..c9aec268 160000 --- a/lib/SDL +++ b/lib/SDL @@ -1 +1 @@ -Subproject commit 87a83787a3a0a9922b02b35ba809d9da86930fc8 +Subproject commit c9aec268fa7f892e183219683160599a4a2b86db diff --git a/lib/openal-soft b/lib/openal-soft index d66107e9..fde74453 160000 --- a/lib/openal-soft +++ b/lib/openal-soft @@ -1 +1 @@ -Subproject commit d66107e9f008770b48f0df4fce041ee3e501e1e8 +Subproject commit fde74453a62a1ce4b5efaac0ec1835b9f5731e25 diff --git a/src/dawn/scene/components/ui/CMakeLists.txt b/src/dawn/scene/components/ui/CMakeLists.txt index a8d0aea3..324f1446 100644 --- a/src/dawn/scene/components/ui/CMakeLists.txt +++ b/src/dawn/scene/components/ui/CMakeLists.txt @@ -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) \ No newline at end of file diff --git a/src/dawn/scene/components/ui/UIMenu.hpp b/src/dawn/scene/components/ui/UIMenu.hpp deleted file mode 100644 index a28302e8..00000000 --- a/src/dawn/scene/components/ui/UIMenu.hpp +++ /dev/null @@ -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: - - }; -} \ No newline at end of file diff --git a/src/dawn/scene/components/ui/UIMenuController.cpp b/src/dawn/scene/components/ui/UIMenuController.cpp new file mode 100644 index 00000000..fd121a6c --- /dev/null +++ b/src/dawn/scene/components/ui/UIMenuController.cpp @@ -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)(); +} \ No newline at end of file diff --git a/src/dawn/scene/components/ui/UIMenuController.hpp b/src/dawn/scene/components/ui/UIMenuController.hpp new file mode 100644 index 00000000..d5eefdc6 --- /dev/null +++ b/src/dawn/scene/components/ui/UIMenuController.hpp @@ -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 activeTeardown; + + public: + StateProperty active; + StateProperty menuX; + StateProperty menuY; + StateProperty columns; + StateProperty rows; + + StateEvent eventItemChange; + StateEvent eventItemSelected; + + UIMenuController(SceneItem *item); + + void onStart(); + }; +} \ No newline at end of file