Add engine_draw_text to util

This commit is contained in:
8dcc 2023-07-25 22:50:29 +02:00
parent 56217cc7f3
commit 6e640f483e
2 changed files with 11 additions and 0 deletions

View File

@ -33,6 +33,7 @@ float vec_len2d(vec3_t v);
void vec_clamp(vec3_t v); void vec_clamp(vec3_t v);
float angle_delta_rad(float a, float b); float angle_delta_rad(float a, float b);
bool world_to_screen(vec3_t vec, vec2_t screen); bool world_to_screen(vec3_t vec, vec2_t screen);
void engine_draw_text(int x, int y, char* s, rgb_t c);
void gl_drawbox(int x, int y, int w, int h, rgb_t c); void gl_drawbox(int x, int y, int w, int h, rgb_t c);
void gl_drawline(int x0, int y0, int x1, int y1, float w, rgb_t col); void gl_drawline(int x0, int y0, int x1, int y1, float w, rgb_t col);
bool protect_addr(void* ptr, int new_flags); bool protect_addr(void* ptr, int new_flags);

View File

@ -95,6 +95,16 @@ bool world_to_screen(vec3_t vec, vec2_t screen) {
return false; return false;
} }
void engine_draw_text(int x, int y, char* s, rgb_t c) {
/* Convert to 0..1 range */
float r = c.r / 255.0f;
float g = c.g / 255.0f;
float b = c.b / 255.0f;
i_engine->pfnDrawSetTextColor(r, g, b);
i_engine->pfnDrawConsoleString(x, y, s);
}
void gl_drawbox(int x, int y, int w, int h, rgb_t c) { void gl_drawbox(int x, int y, int w, int h, rgb_t c) {
/* Line width */ /* Line width */
const int lw = 1; const int lw = 1;