wayland rewrite complete
This commit is contained in:
parent
5ff43e240c
commit
721ff8f42f
8 changed files with 134 additions and 87 deletions
|
|
@ -23,9 +23,8 @@ import Crafter.Event;
|
|||
import :Types;
|
||||
|
||||
export namespace Crafter {
|
||||
class Window;
|
||||
class UiElement {
|
||||
public:
|
||||
class Transform {
|
||||
public:
|
||||
std::int_fast32_t z;
|
||||
std::int_fast32_t anchorX;
|
||||
std::int_fast32_t anchorY;
|
||||
|
|
@ -34,19 +33,26 @@ export namespace Crafter {
|
|||
std::uint_fast32_t relativeWidth;
|
||||
std::uint_fast32_t relativeHeight;
|
||||
bool ignoreScaling;
|
||||
std::vector<UiElement*> children;
|
||||
ScaleData scaled;
|
||||
Transform(std::int_fast32_t anchorX, std::int_fast32_t anchorY, std::uint_fast32_t relativeWidth, std::uint_fast32_t relativeHeight, std::int_fast32_t anchorOffsetX = FractionalToMapped(0.5), std::int_fast32_t anchorOffsetY = FractionalToMapped(0.5), std::int_fast32_t z = 0, bool ignoreScaling = false);
|
||||
};
|
||||
|
||||
class WindowFramebuffer;
|
||||
class UiElement {
|
||||
public:
|
||||
Transform transform;
|
||||
std::vector<UiElement*> children;
|
||||
|
||||
UiElement(std::int_fast32_t anchorX, std::int_fast32_t anchorY, std::uint_fast32_t relativeWidth, std::uint_fast32_t relativeHeight, std::int_fast32_t anchorOffsetX = FractionalToMapped(0.5), std::int_fast32_t anchorOffsetY = FractionalToMapped(0.5), std::int_fast32_t z = 0, bool ignoreScaling = false);
|
||||
UiElement(UiElement&) = delete;
|
||||
UiElement& operator=(UiElement&) = delete;
|
||||
// void UpdatePosition(Window& window);
|
||||
// void UpdatePosition(UiElement& parent);
|
||||
void UpdatePosition(WindowFramebuffer& window);
|
||||
void UpdatePosition(WindowFramebuffer& window, UiElement& parent);
|
||||
};
|
||||
|
||||
class UiElementMouse {
|
||||
public:
|
||||
ScaleData clickArea;
|
||||
Transform transform;
|
||||
Event<MouseMoveEvent> onMouseMove;
|
||||
Event<MouseMoveEvent> onMouseEnter;
|
||||
Event<MouseMoveEvent> onMouseLeave;
|
||||
|
|
@ -56,6 +62,7 @@ export namespace Crafter {
|
|||
Event<MousePoint> onMouseLeftHold;
|
||||
Event<MousePoint> onMouseRightRelease;
|
||||
Event<MousePoint> onMouseLeftRelease;
|
||||
UiElementMouse(std::int_fast32_t anchorX = FractionalToMapped(0), std::int_fast32_t anchorY = FractionalToMapped(0), std::uint_fast32_t relativeWidth = FractionalToMapped(1), std::uint_fast32_t relativeHeight = FractionalToMapped(1), std::int_fast32_t anchorOffsetX = FractionalToMapped(0), std::int_fast32_t anchorOffsetY = FractionalToMapped(0), std::int_fast32_t z = 0, bool ignoreScaling = false);
|
||||
};
|
||||
|
||||
class UiElementBuffer {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue