font testing

This commit is contained in:
jacob 2025-11-02 17:26:22 -06:00
parent 1500fb7dc3
commit 597d069c58
9 changed files with 32 additions and 23 deletions

View File

@ -225,7 +225,7 @@ void Startup(void)
P_LogInfoF("Settings file found"); P_LogInfoF("Settings file found");
P_File settings_file = P_OpenFileRead(settings_path); P_File settings_file = P_OpenFileRead(settings_path);
String file_data = P_ReadFile(temp.arena, settings_file); String file_data = P_ReadFile(temp.arena, settings_file);
P_CloseFIle(settings_file); P_CloseFile(settings_file);
P_LogInfoF("Deserializing settings file data: %F", FmtString(file_data)); P_LogInfoF("Deserializing settings file data: %F", FmtString(file_data));
String error = ZI; String error = ZI;
P_WindowSettings *deser = SETTINGS_WindowSettingsFromString(temp.arena, file_data, &error); P_WindowSettings *deser = SETTINGS_WindowSettingsFromString(temp.arena, file_data, &error);
@ -292,7 +292,7 @@ void Startup(void)
P_LogInfoF("Writing settings file to path \"%F\"", FmtString(window_settings_path)); P_LogInfoF("Writing settings file to path \"%F\"", FmtString(window_settings_path));
P_File settings_file = P_OpenFileWrite(window_settings_path); P_File settings_file = P_OpenFileWrite(window_settings_path);
P_WriteFile(settings_file, str); P_WriteFile(settings_file, str);
P_CloseFIle(settings_file); P_CloseFile(settings_file);
P_LogInfoF("Finished writing settings file"); P_LogInfoF("Finished writing settings file");
EndTempArena(temp); EndTempArena(temp);

View File

@ -299,7 +299,7 @@ P_File P_OpenFileRead(String path);
P_File P_OpenFileReadWait(String path); /* Waits until file is not being used by another program */ P_File P_OpenFileReadWait(String path); /* Waits until file is not being used by another program */
P_File P_OpenFileWrite(String path); P_File P_OpenFileWrite(String path);
P_File P_OpenFileAppend(String path); P_File P_OpenFileAppend(String path);
void P_CloseFIle(P_File file); void P_CloseFile(P_File file);
//- File data manipulation //- File data manipulation
String P_ReadFile(Arena *arena, P_File file); String P_ReadFile(Arena *arena, P_File file);

View File

@ -13,7 +13,7 @@ void P_StartupLog(void)
if (logfile_path.len > 0) if (logfile_path.len > 0)
{ {
/* Create / wipe log file */ /* Create / wipe log file */
P_CloseFIle(P_OpenFileWrite(logfile_path)); P_CloseFile(P_OpenFileWrite(logfile_path));
/* Keep log file open for appending */ /* Keep log file open for appending */
if (P_IsFile(logfile_path)) if (P_IsFile(logfile_path))
{ {

View File

@ -232,7 +232,7 @@ P_DateTime P_LocalTime(void)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
//~ @hookdef File system hooks //~ @hookdef File system hooks
//- FIle system helpers //- File system helpers
String P_GetWritePath(Arena *arena) String P_GetWritePath(Arena *arena)
{ {
u16 *p = 0; u16 *p = 0;
@ -415,7 +415,7 @@ P_File P_OpenFileAppend(String path)
return file; return file;
} }
void P_CloseFIle(P_File file) void P_CloseFile(P_File file)
{ {
__prof; __prof;
if (file.handle) if (file.handle)

View File

@ -104,6 +104,9 @@ void PP_PushGameUiStyle(void)
{ {
// UI_Push(FontSize, 48); // UI_Push(FontSize, 48);
// UI_Push(FontSize, 24); // UI_Push(FontSize, 24);
// UI_Push(Font, ResourceKeyFromStore(&PP_Resources, Lit("font/roboto-med.ttf")));
// UI_Push(Font, ResourceKeyFromStore(&PP_Resources, Lit("font/fixedsys.ttf")));
UI_Push(FontSize, 12); UI_Push(FontSize, 12);
UI_Push(Rounding, 0); UI_Push(Rounding, 0);
@ -2132,34 +2135,34 @@ void PP_UpdateUser(void)
UI_Push(BorderColor, 0); UI_Push(BorderColor, 0);
UI_Push(TextPadding, 2); UI_Push(TextPadding, 2);
UI_BuildLabelF("blended world entities: %F/%F", FmtUint(g->ss_blended->num_ents_allocated), FmtUint(g->ss_blended->num_ents_reserved)); UI_BuildLabelF("Blended world entities: %F/%F", FmtUint(g->ss_blended->num_ents_allocated), FmtUint(g->ss_blended->num_ents_reserved));
UI_BuildLabelF("blended world tick: %F", FmtUint(g->ss_blended->tick)); UI_BuildLabelF("Blended world tick: %F", FmtUint(g->ss_blended->tick));
UI_BuildLabelF("blended world time: %F", FmtFloat(SecondsFromNs(g->ss_blended->sim_time_ns))); UI_BuildLabelF("Blended world time: %F", FmtFloat(SecondsFromNs(g->ss_blended->sim_time_ns)));
UI_BuildSpacer(UI_EM(1.5, 0)); UI_BuildSpacer(UI_EM(1.5, 0));
UI_BuildLabelF("average local sim publish dt: %F", FmtFloat(SecondsFromNs(g->average_local_to_user_snapshot_publish_dt_ns))); UI_BuildLabelF("Average local sim publish dt: %F", FmtFloat(SecondsFromNs(g->average_local_to_user_snapshot_publish_dt_ns)));
UI_BuildLabelF("local sim last known tick: %F", FmtUint(g->local_sim_last_known_tick)); UI_BuildLabelF("Local sim last known tick: %F", FmtUint(g->local_sim_last_known_tick));
UI_BuildLabelF("local sim last known time: %F", FmtFloat(SecondsFromNs(g->local_sim_last_known_time_ns))); UI_BuildLabelF("Local sim last known time: %F", FmtFloat(SecondsFromNs(g->local_sim_last_known_time_ns)));
UI_BuildLabelF("local sim predicted time: %F", FmtFloat(SecondsFromNs(g->local_sim_predicted_time_ns))); UI_BuildLabelF("Local sim predicted time: %F", FmtFloat(SecondsFromNs(g->local_sim_predicted_time_ns)));
UI_BuildLabelF("render time target: %F", FmtFloat(SecondsFromNs(g->render_time_target_ns))); UI_BuildLabelF("Render time target: %F", FmtFloat(SecondsFromNs(g->render_time_target_ns)));
UI_BuildLabelF("render time: %F", FmtFloat(SecondsFromNs(g->render_time_ns))); UI_BuildLabelF("Render time: %F", FmtFloat(SecondsFromNs(g->render_time_ns)));
UI_BuildLabelF("local player: [%F]", FmtUid(local_player->key.uid)); UI_BuildLabelF("Local player: [%F]", FmtUid(local_player->key.uid));
UI_BuildSpacer(UI_EM(1.5, 0)); UI_BuildSpacer(UI_EM(1.5, 0));
Vec2 world_cursor = g->world_cursor; Vec2 world_cursor = g->world_cursor;
UI_BuildLabelF("cursor world: %F, %F", FmtFloat(world_cursor.x), FmtFloat(world_cursor.y)); UI_BuildLabelF("Cursor world: %F, %F", FmtFloat(world_cursor.x), FmtFloat(world_cursor.y));
Vec2I32 world_tile_cursor = PP_WorldTileIndexFromPos(world_cursor); Vec2I32 world_tile_cursor = PP_WorldTileIndexFromPos(world_cursor);
UI_BuildLabelF("cursor world tile: %F, %F", FmtSint(world_tile_cursor.x), FmtSint(world_tile_cursor.y)); UI_BuildLabelF("Cursor world tile: %F, %F", FmtSint(world_tile_cursor.x), FmtSint(world_tile_cursor.y));
Vec2I32 local_tile_cursor = PP_LocalTileIndexFromWorldTileIndex(world_tile_cursor); Vec2I32 local_tile_cursor = PP_LocalTileIndexFromWorldTileIndex(world_tile_cursor);
UI_BuildLabelF("cursor local tile: %F, %F", FmtSint(local_tile_cursor.x), FmtSint(local_tile_cursor.y)); UI_BuildLabelF("Cursor local tile: %F, %F", FmtSint(local_tile_cursor.x), FmtSint(local_tile_cursor.y));
Vec2I32 tile_chunk_cursor = PP_TileChunkIndexFromWorldTileIndex(world_tile_cursor); Vec2I32 tile_chunk_cursor = PP_TileChunkIndexFromWorldTileIndex(world_tile_cursor);
UI_BuildLabelF("cursor tile chunk: %F, %F", FmtSint(tile_chunk_cursor.x), FmtSint(tile_chunk_cursor.y)); UI_BuildLabelF("Cursor tile chunk: %F, %F", FmtSint(tile_chunk_cursor.x), FmtSint(tile_chunk_cursor.y));
UI_BuildSpacer(UI_EM(1.5, 0)); UI_BuildSpacer(UI_EM(1.5, 0));
UI_BuildLabelF("Network read: %F mbit/s", FmtFloat((f64)g->net_bytes_read.last_second * 8 / 1000 / 1000)); UI_BuildLabelF("Network read: %F mbit/s", FmtFloat((f64)g->net_bytes_read.last_second * 8 / 1000 / 1000));

BIN
src/pp/pp_res/font/roboto-med.ttf (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -7,7 +7,7 @@ void UI_Startup(void)
{ {
/* Prefetch default font */ /* Prefetch default font */
ResourceKey default_font = UI_GetDefaultFontResource(); ResourceKey default_font = UI_GetDefaultFontResource();
F_LoadFontAsync(default_font, 12); F_LoadFontAsync(default_font, 16);
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -15,7 +15,7 @@ void UI_Startup(void)
ResourceKey UI_GetDefaultFontResource(void) ResourceKey UI_GetDefaultFontResource(void)
{ {
return ResourceKeyFromStore(&UI_Resources, Lit("font/default.ttf")); return ResourceKeyFromStore(&UI_Resources, Lit("font/proggy.ttf"));
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -304,7 +304,7 @@ void UI_BeginBuild(void)
g->style_tops[UI_StyleKind_Width]->style.Width = UI_FILL(1, 0); g->style_tops[UI_StyleKind_Width]->style.Width = UI_FILL(1, 0);
g->style_tops[UI_StyleKind_Height]->style.Height = UI_FILL(1, 0); g->style_tops[UI_StyleKind_Height]->style.Height = UI_FILL(1, 0);
g->style_tops[UI_StyleKind_Font]->style.Font = UI_GetDefaultFontResource(); g->style_tops[UI_StyleKind_Font]->style.Font = UI_GetDefaultFontResource();
g->style_tops[UI_StyleKind_FontSize]->style.FontSize = 12.0f; g->style_tops[UI_StyleKind_FontSize]->style.FontSize = 16.0f;
g->style_tops[UI_StyleKind_Tint]->style.Tint = 0xFFFFFFFF; g->style_tops[UI_StyleKind_Tint]->style.Tint = 0xFFFFFFFF;
} }

BIN
src/ui/ui_res/font/proggy.ttf (Stored with Git LFS) Normal file

Binary file not shown.