Allow constants

This commit is contained in:
Rebekah 2022-04-22 23:27:23 -04:00
parent b32117e552
commit 221db8e972
Signed by: oneechanhax
GPG Key ID: 183EB7902964DAE5
4 changed files with 8 additions and 8 deletions

View File

@ -22,8 +22,8 @@ void rect_textured(float x, float y, float w, float h, rgba color,
float angle);
void circle(float x, float y, float radius, rgba color, float thickness, int steps);
void string(float x, float y, const std::string& string, font& font, rgba color,
void string(float x, float y, const std::string& string, const font& font, rgba color,
float* width, float* height);
void outlined_string(float x, float y, const std::string& string, font& font,
void outlined_string(float x, float y, const std::string& string, const font& font,
rgba color, rgba outline, float* width, float* height);
} // namespace glez::draw

View File

@ -22,8 +22,8 @@ public:
glez::font& operator=(glez::font&&);
// void stringSize(std::string_view string, float* width, float* height);
void stringSize(const std::string& string, float* width, float* height);
inline bool isLoaded() { return this->m_font != nullptr && this->atlas != nullptr; };
void stringSize(const std::string& string, float* width, float* height) const;
inline bool isLoaded() const { return this->m_font != nullptr && this->atlas != nullptr; };
public:
texture_font_t* m_font = nullptr;

View File

@ -21,7 +21,7 @@ static GLuint triangle[3] = { 0, 1, 2 };
} // namespace indices
void internal_draw_string(float x, float y, const std::string& string,
glez::font& font, glez::rgba color, float* width, float* height) {
const glez::font& font, glez::rgba color, float* width, float* height) {
assert(font.isLoaded());
auto* fnt = font.m_font;
float pen_x = x;
@ -202,14 +202,14 @@ void circle(float x, float y, float radius, rgba color, float thickness,
}
}
void string(float x, float y, const std::string& string, font& font, rgba color, float* width, float* height) {
void string(float x, float y, const std::string& string, const font& font, rgba color, float* width, float* height) {
auto fnt = font.m_font;
fnt->rendermode = RENDER_NORMAL;
fnt->outline_thickness = 0.0f;
internal_draw_string(x, y, string, font, color, width, height);
}
void outlined_string(float x, float y, const std::string& string, font& font, rgba color, rgba outline, float* width, float* height) {
void outlined_string(float x, float y, const std::string& string, const font& font, rgba color, rgba outline, float* width, float* height) {
auto fnt = font.m_font;
fnt->rendermode = RENDER_OUTLINE_POSITIVE;
fnt->outline_thickness = 1.0f;

View File

@ -36,7 +36,7 @@ glez::font& font::operator=(glez::font&& var) {
var.atlas = nullptr;
return *this;
}
void font::stringSize(const std::string& string, float* width, float* height) {
void font::stringSize(const std::string& string, float* width, float* height) const {
assert(this->isLoaded());
float penX = 0;