From e4483eca01b48b943cd0461e24a74ae1a3139ed4 Mon Sep 17 00:00:00 2001 From: Nicolas James Date: Wed, 12 Feb 2025 21:57:46 +1100 Subject: Update to most recent version (old initial commit) --- src/client/window/basic_window.cc | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/client/window/basic_window.cc (limited to 'src/client/window/basic_window.cc') diff --git a/src/client/window/basic_window.cc b/src/client/window/basic_window.cc new file mode 100644 index 0000000..c96f94a --- /dev/null +++ b/src/client/window/basic_window.cc @@ -0,0 +1,33 @@ +#include "client/window/basic_window.hh" + +namespace client { +namespace window { + +using bw = basic_window; + +bool bw::is_inside(const glm::vec2& v, const glm::vec2& p, + const glm::vec2& s) noexcept { + if (v.x < p.x || v.x > p.x + s.x) { + return false; + } + if (v.y < p.y || v.y > p.y + s.y) { + return false; + } + return true; +} + +bool bw::is_inside(const glm::vec2& v) const noexcept { + return is_inside(v, this->pos, this->size); +} + +void bw::draw() noexcept { + client::render::draw_rectangle({.pos = {.offset = this->pos + 6.0f}, + .size = {.offset = this->size}, + .colour = {this->tertiary_clr, 0.9f}}); + client::render::draw_rectangle({.pos = {.offset = this->pos}, + .size = {.offset = this->size}, + .colour = {this->primary_clr, 1.0f}}); +} + +} // namespace window +} // namespace client -- cgit v1.2.3