diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2025-04-09 17:20:23 -0400 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2025-04-09 17:20:23 -0400 |
| commit | 496637b40ec3b241a0b09ed909dd3d26f68520ab (patch) | |
| tree | 368f0a9f09e6af9df0556667b2aa168f1338bb7e /src/game.cpp | |
| parent | 3aa4bf34cf1f8a710764bfd35849c2474589bf2e (diff) | |
pke: first-pass ui box with text
Diffstat (limited to 'src/game.cpp')
| -rw-r--r-- | src/game.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/game.cpp b/src/game.cpp index 03ea495..b5bb0a0 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -169,6 +169,8 @@ void Game_Main(PKEWindowProperties windowProps, const char *executablePath) { pk_cstr test_text2 = cstring_to_pk_cstr("+0123456\n789\tThe quick brown fox jumped over the lazy dog."); FontTypeIndex font_type_count; FontRenderSettings fr_set; + FontRenderHandle fr_1; + FontRenderHandle fr_2; fr_set.char_scale = 9 * 7.0; fr_set.line_height_scale = 1.0; fr_set.char_spacing_scale = 1.0; @@ -178,12 +180,12 @@ void Game_Main(PKEWindowProperties windowProps, const char *executablePath) { fr_set.surface_area_pos.y = 1080 / 3.0; fr_set.surface_area_type_flags = FONT_RENDER_SURFACE_AREA_TYPE_FLAGS_NONE; if ((FontType_GetFonts(font_type_count)); font_type_count != FontTypeIndex{0}) { - FontType_AddStringRender(FontTypeIndex{0}, pk_cstr_to_pk_str(&test_text), &fr_set); + fr_1 = FontType_AddStringRender(FontTypeIndex{0}, pk_cstr_to_pk_str(&test_text), &fr_set); } if ((FontType_GetFonts(font_type_count)); font_type_count > FontTypeIndex{1}) { fr_set.surface_area_pos.y *= 2; fr_set.surface_area_size.y = 1080 - fr_set.surface_area_pos.y; - FontType_AddStringRender(FontTypeIndex{1}, pk_cstr_to_pk_str(&test_text2), &fr_set); + fr_2 = FontType_AddStringRender(FontTypeIndex{1}, pk_cstr_to_pk_str(&test_text2), &fr_set); } // TODO remove me: temp stuff for testing @@ -195,12 +197,15 @@ void Game_Main(PKEWindowProperties windowProps, const char *executablePath) { ui_box->max_height = 0.8; // TODO remove me: temp stuff for testing - pke_ui_box *c_ui_box = pke_ui_box_new_child(ui_box); + pke_ui_box *c_ui_box = pke_ui_box_new_child(ui_box, PKE_UI_BOX_TYPE_TEXT); c_ui_box->flags = PKE_UI_BOX_FLAG_POSITION_TYPE_STATIC; c_ui_box->pos_top_left_x = 20; c_ui_box->pos_top_left_y = 20; c_ui_box->max_width = 3000; c_ui_box->max_height = 3000; + pke_ui_box_type_data_text *box_text = reinterpret_cast<pke_ui_box_type_data_text*>(c_ui_box->type_data); + box_text->font_render_handle = fr_1; + box_text->font_render_settings = fr_set; GameTimePoint lastTimePoint = pkeSettings.steadyClock.now(); double deltaTillNextRender = pkeSettings.deltaPerFrame; |
