#ifndef CLIENT_DRAW_HH_ #define CLIENT_DRAW_HH_ #include #include #include "client/movement.hh" #include "client/player.hh" #include "client/render/camera.hh" #include "client/render/render.hh" #include "client/render/program.hh" #include "client/shared.hh" #include "client/window.hh" #include "client/world.hh" namespace client { namespace draw { // Scale takes the range [0, 1] and represents an amount of the screen. // Offset is any value that is added after scale. struct relative_arg { glm::vec2 extent; glm::vec2 offset; glm::vec2 to_vec2() const noexcept { const glm::vec2& window = render::get_window_size(); const float x = this->extent.x * window.x + this->offset.x; const float y = this->extent.y * window.y + this->offset.y; return {x, y}; } }; struct rectangle_args { relative_arg pos; relative_arg size; glm::vec4 colour; }; struct text_args { relative_arg pos; float extent_height; // we don't get width here, float offset_height; glm::vec4 colour; bool has_backing; bool is_centered; bool is_vcentered; }; void draw_rectangle(const rectangle_args& args) noexcept; void draw_colour(const glm::vec4& colour) noexcept; void draw_text(const std::string_view text, const text_args& args) noexcept; void draw(client::players& players, client::world::chunk::map& chunks) noexcept; } // namespace draw } // namespace client #endif