Initial commit

This commit is contained in:
drof
2026-11-05 02:19:09 +01:00
commit 13f8503697
125 changed files with 17029 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
#pragma once
namespace window
{
class c_info_panel : public c_base
{
public:
void paint() override;
private:
};
}
+53
View File
@@ -0,0 +1,53 @@
#pragma once
#define SECTION_START() __noop();
#define SECTION_END() __nop();
#define SECTION_INIT(NAME) float section_push = 0.0f; \
const float section_start_x = position.x + 5.0f, section_start_y = position.y + 55.0f + yaw_push; \
static float section_height = 0.0f; \
ui::section({ section_start_x, section_start_y }, { (dimension.w / 2.f) - 10.f, section_height + 10.0f }, { 65, 65, 65 }, _XS(NAME)); \
const float section_rstart_x = section_start_x + 5.0f, \
section_rstart_y = section_start_y + 10.0f; \
#define SECTION_INIT_EX(NAME, WIDTH) float section_push = 0.0f; \
const float section_start_x = start_x, section_start_y = start_y + yaw_push; \
static float section_height = 0.0f; \
ui::section({ section_start_x, section_start_y }, { WIDTH, section_height + 10.0f }, { 65, 65, 65 }, _XS(NAME)); \
const float section_rstart_x = section_start_x + 5.0f, \
section_rstart_y = section_start_y + 10.0f; \
#define MENU_TAB_ARGS const math::position_t<int>& position, const math::dimension_t<int>& dimension, const float& start_x, const float& start_y, float& yaw_push
namespace window
{
namespace menu::tabs
{
extern void other_left(MENU_TAB_ARGS);
extern void other_right(MENU_TAB_ARGS);
extern void config_left(MENU_TAB_ARGS);
extern void config_right(MENU_TAB_ARGS);
extern void aim_left(MENU_TAB_ARGS);
extern void aim_right(MENU_TAB_ARGS);
extern void visual_left(MENU_TAB_ARGS);
extern void visual_right(MENU_TAB_ARGS);
}
class c_menu : public c_base
{
public:
void paint() override;
void draw_base();
void draw_tab_selection();
void draw_tab_right();
void render();
private:
int m_tab;
bool m_visible;
};
}
+16
View File
@@ -0,0 +1,16 @@
#pragma once
namespace window
{
class c_radar : public c_base
{
public:
void draw_base();
void draw_objects();
void paint() override;
private:
float m_radius;
float m_range;
};
}
+11
View File
@@ -0,0 +1,11 @@
#pragma once
namespace window
{
class c_spectator_list : public c_base
{
public:
void paint() override;
private:
};
}
+15
View File
@@ -0,0 +1,15 @@
#pragma once
namespace ui
{
extern bool in_range(const math::position_t<float>& _position, const math::dimension_t<float>& _dimension);
extern void section(const math::position_t<float>& _position, const math::dimension_t<float>& _dimension, respawn::color_t color, const char* name);
extern void checkbox(const math::position_t<float> _position, const char* text, bool* variable);
extern void checkbox_triple(const math::position_t<float> _position, const char* text, int* variable);
extern void slider(math::position_t<float> _position, math::dimension_t<float> _dimension, const char* text, int* variable, int min, int max);
extern void slider_float(math::position_t<float> _position, math::dimension_t<float> _dimension, const char* text, float* variable, float min, float max);
extern bool button(
const math::position_t<float>& _position, const math::dimension_t<float>& _dimension,
respawn::color_t background_color, respawn::color_t text_color, const char* text
);
}
+95
View File
@@ -0,0 +1,95 @@
#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<int>& pos, const math::dimension_t<int>& 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<int> m_position;
math::dimension_t<int> m_dimension;
private:
};
class c_manager
{
public:
template <typename _t>
[[nodiscard]] bool in_range(const math::position_t<int> cursor_position,
const std::pair<math::position_t<_t>, math::dimension_t<_t>> target_position) const
{
const auto x0 = static_cast<int>(target_position.first.x), y0 = static_cast<int>(target_position.first.y);
const auto x1 = x0 + static_cast<int>(target_position.second.w), y1 = y0 + static_cast<int>(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<int>& pos, const math::dimension_t<int>& 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<c_base*> m_list;
};
}
#include "ui.h"
#include "menu.h"
#include "info_panel.h"
#include "radar.h"
#include "spectator_list.h"