#pragma once namespace window { namespace fl { constexpr char invalid = 1 << 0; constexpr char none = 1 << 1; constexpr char draggable = 1 << 3; constexpr char dragging = 1 << 4; } class c_base { public: void declare(const math::position_t& pos, const math::dimension_t& dim) { m_position = pos; m_dimension = dim; } virtual void paint() { __noop(); }; auto& _position() { return m_position; } auto& _dimension() { return m_dimension; } const auto has_flag(int f) noexcept { return (m_flags & f); } auto set_flag(int f, bool s) noexcept { if (s == true) m_flags |= f; else m_flags &= ~f; } protected: int32_t m_flags; math::position_t m_position; math::dimension_t m_dimension; private: }; class c_manager { public: template [[nodiscard]] bool in_range(const math::position_t cursor_position, const std::pair, math::dimension_t<_t>> target_position) const { const auto x0 = static_cast(target_position.first.x), y0 = static_cast(target_position.first.y); const auto x1 = x0 + static_cast(target_position.second.w), y1 = y0 + static_cast(target_position .second.h); if (cursor_position.x < x0 || cursor_position.x > x1) { return false; } if (cursor_position.y < y0 || cursor_position.y > y1) { return false; } return true; } void paint(); template < typename T > void add(const math::position_t& pos, const math::dimension_t& dim) { T* wnd = new T(); if (wnd == nullptr) { log_info_("failed to allocate/construct a window."); return; } wnd->declare(pos, dim); m_list.insert(wnd); } private: stl::c_linked_list m_list; }; } #include "ui.h" #include "menu.h" #include "info_panel.h" #include "radar.h" #include "spectator_list.h"