fp: Tweak debug UI
This commit is contained in:
parent
cd98322072
commit
6febed1d08
2
External/tely
vendored
2
External/tely
vendored
@ -1 +1 @@
|
||||
Subproject commit e1292c1397fad6584b16e79ca63f1596868be9c0
|
||||
Subproject commit 4c979bbf759e6795a4d164ef4f7b7e8676cea3f7
|
@ -2052,7 +2052,7 @@ static void FP_Update(TELY_Platform *platform, FP_Game *game, TELY_PlatformInput
|
||||
}
|
||||
|
||||
// NOTE: Mob spawner =======================================================================
|
||||
if (entity->type == FP_EntityType_MobSpawner && 0) {
|
||||
if (entity->type == FP_EntityType_MobSpawner && !game->play.debug_disable_mobs) {
|
||||
// NOTE: Flush any spawn entities that are dead
|
||||
for (FP_SentinelListLink<FP_GameEntityHandle> *link = nullptr; FP_SentinelList_Iterate<FP_GameEntityHandle>(&entity->spawn_list, &link); ) {
|
||||
FP_GameEntity *spawned_entity = FP_Game_GetEntity(game, link->data);
|
||||
@ -2406,10 +2406,8 @@ static void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *ren
|
||||
|
||||
TELY_Render_ClearColourV3(renderer, TELY_COLOUR_BLACK_MIDNIGHT_V4.rgb);
|
||||
TELY_Render_PushFont(renderer, game->jetbrains_mono_font);
|
||||
|
||||
TELY_RFui_FrameSetup(rfui, &platform->frame_arena);
|
||||
TELY_RFui_PushFont(rfui, game->jetbrains_mono_font);
|
||||
TELY_RFui_PushLabelColourV4(rfui, TELY_COLOUR_BLACK_MIDNIGHT_V4);
|
||||
|
||||
FP_GameCamera shake_camera = game->play.camera;
|
||||
{
|
||||
@ -3990,12 +3988,21 @@ static void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *ren
|
||||
|
||||
// NOTE: Info bar ==========================================================================
|
||||
Dqn_f32 next_y = 10.f;
|
||||
TELY_RFui_PushLabelColourV4(rfui, TELY_COLOUR_BLACK_V4);
|
||||
{
|
||||
TELY_RFui_PushPadding(rfui, Dqn_V2_InitNx1(2));
|
||||
DQN_DEFER { TELY_RFui_PopPadding(rfui); };
|
||||
|
||||
TELY_RFui_PushMargin(rfui, Dqn_V2_InitNx1(1));
|
||||
DQN_DEFER { TELY_RFui_PopMargin(rfui); };
|
||||
|
||||
TELY_RFuiResult info_column = TELY_RFui_ColumnReverse(rfui, DQN_STRING8("Info Column"));
|
||||
TELY_RFui_PushParent(rfui, info_column.widget);
|
||||
DQN_DEFER { TELY_RFui_PopParent(rfui); };
|
||||
|
||||
Dqn_V4 bg_colour = TELY_Colour_V4Alpha(TELY_RFui_ActiveBackgroundColourV4(rfui), .7f);
|
||||
TELY_RFui_PushBackgroundColourV4(rfui, bg_colour);
|
||||
DQN_DEFER { TELY_RFui_PopBackgroundColourV4(rfui); };
|
||||
|
||||
info_column.widget->semantic_position[TELY_RFuiAxis_X].kind = TELY_RFuiPositionKind_Absolute;
|
||||
info_column.widget->semantic_position[TELY_RFuiAxis_X].value = next_y;
|
||||
info_column.widget->semantic_position[TELY_RFuiAxis_Y].kind = TELY_RFuiPositionKind_Absolute;
|
||||
@ -4007,12 +4014,15 @@ static void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *ren
|
||||
DQN_DEFER { TELY_RFui_PopParent(rfui); };
|
||||
|
||||
Dqn_ThreadScratch scratch = Dqn_Thread_GetScratch(nullptr);
|
||||
TELY_RFui_TextF(rfui, "TELY");
|
||||
Dqn_String8Builder builder = {};
|
||||
builder.allocator = scratch.allocator;
|
||||
|
||||
Dqn_String8Builder_AppendF(&builder, "TELY");
|
||||
if (Dqn_String8_IsValid(platform->core.os_name)) {
|
||||
TELY_RFui_TextF(rfui, " | %.*s", DQN_STRING_FMT(platform->core.os_name));
|
||||
Dqn_String8Builder_AppendF(&builder, " | %.*s", DQN_STRING_FMT(platform->core.os_name));
|
||||
}
|
||||
|
||||
TELY_RFui_TextF(rfui,
|
||||
Dqn_String8Builder_AppendF(&builder,
|
||||
" | %dx%d %.1fHz | TSC %.1f GHz",
|
||||
platform->core.window_size.w,
|
||||
platform->core.window_size.h,
|
||||
@ -4020,41 +4030,44 @@ static void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *ren
|
||||
platform->core.tsc_per_second / 1'000'000'000.0);
|
||||
|
||||
if (platform->core.ram_mb)
|
||||
TELY_RFui_TextF(rfui, " | RAM %.1fGB", platform->core.ram_mb / 1024.0);
|
||||
Dqn_String8Builder_AppendF(&builder, " | RAM %.1fGB", platform->core.ram_mb / 1024.0);
|
||||
|
||||
TELY_RFui_TextF(rfui,
|
||||
Dqn_String8Builder_AppendF(&builder,
|
||||
" | Work %04.1fms/f (%04.1f%%) | %05.1f FPS | Frame %'I64u | Timer %.1fs",
|
||||
input->work_ms,
|
||||
input->work_ms * 100.0 / input->delta_ms,
|
||||
1000.0 / input->delta_ms,
|
||||
input->frame_counter,
|
||||
input->timer_s);
|
||||
|
||||
Dqn_String8 text = Dqn_String8Builder_Build(&builder, scratch.allocator);
|
||||
TELY_RFui_TextBackgroundF(rfui, "%.*s", DQN_STRING_FMT(text));
|
||||
}
|
||||
|
||||
TELY_RFui_TextF(rfui, "Mouse: %.1f, %.1f", input->mouse_p.x, input->mouse_p.y);
|
||||
TELY_RFui_TextF(rfui, "Camera: %.1f, %.1f", game->play.camera.world_pos.x, game->play.camera.world_pos.y);
|
||||
TELY_RFui_TextF(rfui, "Debug Info");
|
||||
TELY_RFui_TextBackgroundF(rfui, "Mouse: %.1f, %.1f", input->mouse_p.x, input->mouse_p.y);
|
||||
TELY_RFui_TextBackgroundF(rfui, "Camera: %.1f, %.1f", game->play.camera.world_pos.x, game->play.camera.world_pos.y);
|
||||
TELY_RFui_TextBackgroundF(rfui, "Debug Info");
|
||||
|
||||
if (TELY_RFui_ButtonF(rfui, " F1 Debug info").clicked)
|
||||
if (TELY_RFui_ButtonF(rfui, "F1 Debug info").clicked)
|
||||
game->play.debug_ui = !game->play.debug_ui;
|
||||
|
||||
if (TELY_RFui_ButtonF(rfui, " F2 Add coins x10,000").clicked || TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_F2)) {
|
||||
if (TELY_RFui_ButtonF(rfui, "F2 Add coins x10,000").clicked || TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_F2)) {
|
||||
for (FP_GameEntityHandle player_handle : game->play.players) {
|
||||
FP_GameEntity *player = FP_Game_GetEntity(game, player_handle);
|
||||
player->coins += 10'000;
|
||||
}
|
||||
}
|
||||
|
||||
if (TELY_RFui_ButtonF(rfui, " F3 Win game").clicked || TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_F3))
|
||||
if (TELY_RFui_ButtonF(rfui, "F3 Win game").clicked || TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_F3))
|
||||
game->play.state = FP_GameState_WinGame;
|
||||
|
||||
if (TELY_RFui_ButtonF(rfui, " F4 Lose game").clicked || TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_F4))
|
||||
if (TELY_RFui_ButtonF(rfui, "F4 Lose game").clicked || TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_F4))
|
||||
game->play.state = FP_GameState_LoseGame;
|
||||
|
||||
if (TELY_RFui_ButtonF(rfui, " F5 Reset game").clicked || TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_F5))
|
||||
if (TELY_RFui_ButtonF(rfui, "F5 Reset game").clicked || TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_F5))
|
||||
FP_PlayReset(game, platform);
|
||||
|
||||
if (TELY_RFui_ButtonF(rfui, " F6 Increase health").clicked || TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_F6)) {
|
||||
if (TELY_RFui_ButtonF(rfui, "F6 Increase health").clicked || TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_F6)) {
|
||||
for (FP_GameEntityHandle player_handle : game->play.players) {
|
||||
FP_GameEntity *player = FP_Game_GetEntity(game, player_handle);
|
||||
player->hp_cap += FP_DEFAULT_DAMAGE;
|
||||
@ -4062,7 +4075,7 @@ static void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *ren
|
||||
}
|
||||
}
|
||||
|
||||
if (TELY_RFui_ButtonF(rfui, " F7 Increase stamina").clicked || TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_F7)) {
|
||||
if (TELY_RFui_ButtonF(rfui, "F7 Increase stamina").clicked || TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_F7)) {
|
||||
for (FP_GameEntityHandle player_handle : game->play.players) {
|
||||
FP_GameEntity *player = FP_Game_GetEntity(game, player_handle);
|
||||
player->stamina_cap += DQN_CAST(uint16_t)(FP_TERRY_DASH_STAMINA_COST * .5f);
|
||||
@ -4070,7 +4083,7 @@ static void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *ren
|
||||
}
|
||||
}
|
||||
|
||||
if (TELY_RFui_ButtonF(rfui, " F8 Increase mobile data").clicked || TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_F8)) {
|
||||
if (TELY_RFui_ButtonF(rfui, "F8 Increase mobile data").clicked || TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_F8)) {
|
||||
for (FP_GameEntityHandle player_handle : game->play.players) {
|
||||
FP_GameEntity *player = FP_Game_GetEntity(game, player_handle);
|
||||
player->terry_mobile_data_plan_cap += DQN_KILOBYTES(1);
|
||||
@ -4078,10 +4091,10 @@ static void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *ren
|
||||
}
|
||||
}
|
||||
|
||||
if (TELY_RFui_ButtonF(rfui, " F9 %s god mode", game->play.god_mode ? "Disable" : "Enable").clicked || TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_F9))
|
||||
if (TELY_RFui_ButtonF(rfui, "F9 %s god mode", game->play.god_mode ? "Disable" : "Enable").clicked || TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_F9))
|
||||
game->play.god_mode = !game->play.god_mode;
|
||||
|
||||
if (TELY_RFui_ButtonF(rfui, " F11 Building inventory +1").clicked || TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_F11)) {
|
||||
if (TELY_RFui_ButtonF(rfui, "F11 Building inventory +1").clicked || TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_F11)) {
|
||||
for (FP_GameEntityHandle player_handle : game->play.players) {
|
||||
FP_GameEntity *player = FP_Game_GetEntity(game, player_handle);
|
||||
player->inventory.clubs += 1;
|
||||
@ -4091,11 +4104,14 @@ static void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *ren
|
||||
}
|
||||
}
|
||||
|
||||
if (TELY_RFui_ButtonF(rfui, " 1 %s HUD", game->play.debug_hide_hud ? "Show" : "Hide").clicked || TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_1))
|
||||
if (TELY_RFui_ButtonF(rfui, "1 %s HUD", game->play.debug_hide_hud ? "Show" : "Hide").clicked || TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_1))
|
||||
game->play.debug_hide_hud = !game->play.debug_hide_hud;
|
||||
|
||||
if (TELY_RFui_ButtonF(rfui, "%s bounding rects", game->play.debug_hide_bounding_rectangles ? "Show" : "Hide").clicked)
|
||||
game->play.debug_hide_bounding_rectangles = !game->play.debug_hide_bounding_rectangles;
|
||||
|
||||
if (TELY_RFui_ButtonF(rfui, "%s mob spawning", game->play.debug_disable_mobs ? "Enable" : "Disable").clicked)
|
||||
game->play.debug_disable_mobs = !game->play.debug_disable_mobs;
|
||||
}
|
||||
|
||||
if (0) {
|
||||
|
@ -406,6 +406,7 @@ struct FP_GamePlay
|
||||
bool debug_ui;
|
||||
bool debug_hide_hud;
|
||||
bool debug_hide_bounding_rectangles;
|
||||
bool debug_disable_mobs;
|
||||
bool god_mode;
|
||||
|
||||
Dqn_FArray<FP_GameEntityHandle, 4> mob_spawners;
|
||||
|
BIN
project.rdbg
BIN
project.rdbg
Binary file not shown.
Loading…
Reference in New Issue
Block a user