merged uielement
This commit is contained in:
parent
39f151e865
commit
02a6a64c56
12 changed files with 200 additions and 506 deletions
|
|
@ -45,11 +45,12 @@ import Crafter.Event;
|
|||
|
||||
export namespace Crafter {
|
||||
class UiElement;
|
||||
class Transform;
|
||||
class Window {
|
||||
public:
|
||||
std::uint_fast32_t width;
|
||||
std::uint_fast32_t height;
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> lastFrameEnd;
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> lastFrameBegin;
|
||||
Event<void> onClose;
|
||||
Event<FrameTime> onUpdate;
|
||||
bool open = true;
|
||||
|
|
@ -63,6 +64,9 @@ export namespace Crafter {
|
|||
virtual void StartSync() = 0;
|
||||
virtual void StartUpdate() = 0;
|
||||
virtual void StopUpdate() = 0;
|
||||
void ScaleElement(Transform& element, Transform& parent);
|
||||
void ScaleElement(Transform& element);
|
||||
void ScaleMouse(Transform& element, Transform& parent);
|
||||
};
|
||||
|
||||
class WindowKeyboard {
|
||||
|
|
@ -76,7 +80,6 @@ export namespace Crafter {
|
|||
Event<char> onAnyKeyUp;
|
||||
};
|
||||
|
||||
class UiElementMouse;
|
||||
class WindowMouse {
|
||||
public:
|
||||
Event<MousePoint> onMouseRightClick;
|
||||
|
|
@ -94,7 +97,7 @@ export namespace Crafter {
|
|||
MousePoint mouseDelta;
|
||||
bool mouseLeftHeld = false;
|
||||
bool mouseRightHeld = false;
|
||||
std::vector<UiElementMouse*> mouseElements;
|
||||
std::vector<UiElement*> mouseElements;
|
||||
};
|
||||
|
||||
class WindowTitle {
|
||||
|
|
@ -115,9 +118,6 @@ export namespace Crafter {
|
|||
virtual Pixel_BU8_GU8_RU8_AU8* Get() = 0;
|
||||
virtual void Store() = 0;
|
||||
virtual void Render() = 0;
|
||||
void ScaleElement(Transform& element, Transform& parent);
|
||||
void ScaleElement(Transform& element);
|
||||
void ScaleMouse(Transform& element, Transform& parent);
|
||||
};
|
||||
|
||||
#ifdef CRAFTER_GRAPHICS_WAYLAND
|
||||
|
|
@ -125,7 +125,7 @@ export namespace Crafter {
|
|||
class WindowWayland final : public WindowKeyboard, public WindowMouse, public WindowFramebuffer, public WindowTitle {
|
||||
public:
|
||||
Pixel_BU8_GU8_RU8_AU8* framebuffer = nullptr;
|
||||
std::vector<UiElementBufferBuffer*> elements;
|
||||
std::vector<UiElement*> elements;
|
||||
WindowWayland(std::uint_fast32_t width, std::uint_fast32_t height);
|
||||
WindowWayland(std::uint_fast32_t width, std::uint_fast32_t height, const std::string_view title);
|
||||
~WindowWayland();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue