2025-07-06 20:43:53 +03:00
|
|
|
#pragma once
|
2026-03-27 09:51:53 +03:00
|
|
|
#include "GUIStuffHelpers.hpp"
|
2025-07-06 20:43:53 +03:00
|
|
|
|
|
|
|
|
namespace GUIStuff {
|
2026-03-27 09:51:53 +03:00
|
|
|
class GUIManager;
|
2025-07-06 20:43:53 +03:00
|
|
|
|
2026-03-27 09:51:53 +03:00
|
|
|
class Element {
|
|
|
|
|
public:
|
|
|
|
|
Element(GUIManager& initGUI);
|
2026-03-05 23:34:30 +03:00
|
|
|
|
2026-03-27 09:51:53 +03:00
|
|
|
virtual void clay_draw(SkCanvas* canvas, UpdateInputData& io, Clay_RenderCommand* command, bool skiaAA);
|
|
|
|
|
virtual bool collides_with_point(const Vector2f& p) const;
|
2025-11-11 19:52:45 +03:00
|
|
|
|
2026-03-27 09:51:53 +03:00
|
|
|
void update_bounding_box(Clay_RenderCommand* command);
|
|
|
|
|
void clear_bounding_box();
|
|
|
|
|
const std::optional<SCollision::AABB<float>>& get_bb() const;
|
|
|
|
|
virtual ~Element() = default;
|
2025-07-06 20:43:53 +03:00
|
|
|
|
2026-03-27 09:51:53 +03:00
|
|
|
int16_t zIndex;
|
2025-07-06 20:43:53 +03:00
|
|
|
|
2026-03-27 09:51:53 +03:00
|
|
|
virtual void tick_update();
|
2025-07-06 20:43:53 +03:00
|
|
|
|
2026-03-27 09:51:53 +03:00
|
|
|
// Return true when mouse obstructs what's behind it
|
|
|
|
|
virtual bool input_mouse_button_callback(const InputManager::MouseButtonCallbackArgs& button, bool mouseHovering);
|
|
|
|
|
virtual bool input_mouse_motion_callback(const InputManager::MouseMotionCallbackArgs& motion, bool mouseHovering);
|
|
|
|
|
virtual bool input_mouse_wheel_callback(const InputManager::MouseWheelCallbackArgs& wheel, bool mouseHovering);
|
|
|
|
|
virtual void input_key_callback(const InputManager::KeyCallbackArgs& key);
|
|
|
|
|
protected:
|
|
|
|
|
static SCollision::AABB<float> get_bb_from_command(Clay_RenderCommand* command);
|
|
|
|
|
std::optional<SCollision::AABB<float>> boundingBox;
|
2025-07-06 20:43:53 +03:00
|
|
|
|
2026-03-27 09:51:53 +03:00
|
|
|
GUIManager& gui;
|
|
|
|
|
};
|
2025-07-06 20:43:53 +03:00
|
|
|
}
|