aboutsummaryrefslogtreecommitdiff
path: root/src/client/window/basic_window.cc
blob: c96f94a46c86ee627a73119fb47af16dc57f270a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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