diff --git a/src/include/util.h b/src/include/util.h index 406de59..5b552e9 100644 --- a/src/include/util.h +++ b/src/include/util.h @@ -33,6 +33,7 @@ float vec_len2d(vec3_t v); void vec_clamp(vec3_t v); float angle_delta_rad(float a, float b); 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_drawline(int x0, int y0, int x1, int y1, float w, rgb_t col); bool protect_addr(void* ptr, int new_flags); diff --git a/src/util.c b/src/util.c index 91f993b..b4689c1 100644 --- a/src/util.c +++ b/src/util.c @@ -95,6 +95,16 @@ bool world_to_screen(vec3_t vec, vec2_t screen) { 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) { /* Line width */ const int lw = 1;