fp: Render debug hover text on new lines manually

This commit is contained in:
doyle 2023-10-01 12:10:27 +11:00
parent 47cf075c3b
commit e5282f7706
2 changed files with 9 additions and 14 deletions

2
External/tely vendored

@ -1 +1 @@
Subproject commit 72fcc90d2e8f5737568d334f3ce97d6353e91f9c
Subproject commit cc7ef01f28ee6a09f7811c58480e9a94a1667d42

View File

@ -1628,19 +1628,14 @@ void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *renderer)
if (game->hot_entity == entity->handle) {
if (entity->name.size) {
Dqn_V2I player_tile = Dqn_V2I_InitNx2(world_pos.x / game->tile_size, world_pos.y / game->tile_size);
Dqn_V2 entity_world_pos = Dqn_Rect_Center(world_hit_box);
Dqn_ThreadScratch scratch = Dqn_Thread_GetScratch(nullptr);
Dqn_String8 label = Dqn_String8_InitF(scratch.allocator,
"%.*s|Pos: (%.1f, %.1f)|Size: %.1fx%.1f|Tile: (%I32d, %I32d)",
DQN_STRING_FMT(entity->name),
entity_world_pos.x,
entity_world_pos.y,
world_hit_box.size.w,
world_hit_box.size.h,
player_tile.x,
player_tile.y);
TELY_Render_Text(renderer, world_mouse_p, Dqn_V2_InitNx2(0.f, 1), label);
Dqn_V2I player_tile = Dqn_V2I_InitNx2(world_pos.x / game->tile_size, world_pos.y / game->tile_size);
Dqn_V2 entity_world_pos = Dqn_Rect_Center(world_hit_box);
Dqn_f32 line_height = TELY_Render_FontHeight(renderer, &platform->assets);
Dqn_V2 draw_p = world_mouse_p;
TELY_Render_TextF(renderer, draw_p, Dqn_V2_InitNx2(0.f, 1), "%.*s", DQN_STRING_FMT(entity->name)); draw_p.y += line_height;
TELY_Render_TextF(renderer, draw_p, Dqn_V2_InitNx2(0.f, 1), "World Pos: (%.1f, %.1f)", entity_world_pos.x, entity_world_pos.y); draw_p.y += line_height;
TELY_Render_TextF(renderer, draw_p, Dqn_V2_InitNx2(0.f, 1), "Hit Box Size: %.1fx%.1f", world_hit_box.size.x, world_hit_box.size.y); draw_p.y += line_height;
TELY_Render_TextF(renderer, draw_p, Dqn_V2_InitNx2(0.f, 1), "Tile: %I32dx%I32d", player_tile.x, player_tile.y); draw_p.y += line_height;
}
}
}