ui
This commit is contained in:
@@ -147,6 +147,17 @@ void rn_draw_rect(r2f32_t rect, v4f32_t color) {
|
||||
rn_push_quad(rect, rn_state.main_font.white_texture_bounding_box, color);
|
||||
}
|
||||
|
||||
void rn_draw_rect_border(r2f32_t rect, v4f32_t color) {
|
||||
r2f32_t left = r2f32_cut_left(&rect, 1);
|
||||
r2f32_t right = r2f32_cut_right(&rect, 1);
|
||||
r2f32_t top = r2f32_cut_top(&rect, 1);
|
||||
r2f32_t bottom = r2f32_cut_bottom(&rect, 1);
|
||||
rn_push_quad(left, rn_state.main_font.white_texture_bounding_box, color);
|
||||
rn_push_quad(right, rn_state.main_font.white_texture_bounding_box, color);
|
||||
rn_push_quad(top, rn_state.main_font.white_texture_bounding_box, color);
|
||||
rn_push_quad(bottom, rn_state.main_font.white_texture_bounding_box, color);
|
||||
}
|
||||
|
||||
i64 rn_get_char_spacing(rn_font_t *font, u32 codepoint) {
|
||||
rn_glyph_t *g = rn_get_glyph(font, codepoint);
|
||||
if (g->xadvance) return (i64)g->xadvance;
|
||||
@@ -190,7 +201,7 @@ v2f32_t rn_measure_string(rn_font_t *font, s8_t string) {
|
||||
return rn_base_draw_string(font, string, v2f32(0,0), v4f32(0,0,0,0), false);
|
||||
}
|
||||
|
||||
void rn_init(ma_arena_t *perm) {
|
||||
void rn_init(ma_arena_t *perm, f32 _font_size) {
|
||||
rn_state.cap = 1024*256;
|
||||
rn_state.vertices = ma_push_array(perm, rn_vertex_t, rn_state.cap);
|
||||
|
||||
@@ -199,7 +210,7 @@ void rn_init(ma_arena_t *perm) {
|
||||
s8_t font_data = rn_get_default_font(tcx.temp);
|
||||
rn_atlas_t *atlas = rn_create_atlas(scratch.arena, (v2i32_t){2048, 2048});
|
||||
|
||||
u32 font_size = 50;
|
||||
u32 font_size = (u32)_font_size;
|
||||
rn_state.main_font = rn_create_font(perm, font_data, atlas, font_size);
|
||||
|
||||
GLint filter = GL_NEAREST;
|
||||
|
||||
Reference in New Issue
Block a user