From 38c9f960e3b7363b9fac11368799bd932a0a0046 Mon Sep 17 00:00:00 2001 From: jacob Date: Mon, 6 Apr 2026 01:41:54 -0500 Subject: [PATCH] actually good camera shake --- src/config.h | 2 +- src/pp/pp.c | 16 +- src/pp/pp.h | 4 +- src/pp/pp_vis/pp_vis_core.c | 1621 ++++++++++++++++++++++++++++++----- src/pp/pp_vis/pp_vis_core.h | 2 +- src/pp/pp_vis/pp_vis_gpu.g | 5 +- src/ui/ui_core.c | 27 +- 7 files changed, 1418 insertions(+), 259 deletions(-) diff --git a/src/config.h b/src/config.h index bad0410d..97c8e4ef 100644 --- a/src/config.h +++ b/src/config.h @@ -24,7 +24,7 @@ //~ Settings -#define PROFILING_ENABLED 1 +#define PROFILING_ENABLED 0 #define PROFILER_PRIORITY_ASYNC 10 diff --git a/src/pp/pp.c b/src/pp/pp.c index 8bfafbe4..213ba8cb 100644 --- a/src/pp/pp.c +++ b/src/pp/pp.c @@ -3226,7 +3226,7 @@ void P_StepFrame(P_Frame *frame) bullet->is_bomb = is_bomb; bullet->source = weapon->key; - bullet->damage_attribution = firer->source; + bullet->damage_attribution_player = firer->source; bullet->sim = weapon->sim; } } @@ -3260,7 +3260,7 @@ void P_StepFrame(P_Frame *frame) { P_Ent *weapon = P_EntFromKey(frame, bullet->source); P_Ent *firer = P_EntFromKey(frame, weapon->source); - P_Ent *damager = P_EntFromKey(frame, bullet->damage_attribution); + P_Ent *damager = P_EntFromKey(frame, bullet->damage_attribution_player); b32 is_first_bullet_tick = bullet->created_at_tick == frame->tick; @@ -3555,9 +3555,10 @@ void P_StepFrame(P_Frame *frame) { if (damager->is_player) { - victim->damage_attribution = damager->key; + victim->damage_attribution_player = damager->key; + victim->damage_attribution_dir = SubVec2(bullet->xf.t, p0); } - victim->health -= 0.25; + victim->health -= 0.5; } // Prune out of bounds bullet @@ -3600,7 +3601,7 @@ void P_StepFrame(P_Frame *frame) // { // P_Ent *weapon = P_EntFromKey(frame, bullet->source); // P_Ent *firer = P_EntFromKey(frame, weapon->source); - // P_Ent *damager = P_EntFromKey(frame, bullet->damage_attribution); + // P_Ent *damager = P_EntFromKey(frame, bullet->damage_attribution_player); @@ -3736,7 +3737,7 @@ void P_StepFrame(P_Frame *frame) // { // if (damager->is_player) // { - // victim->damage_attribution = damager->key; + // victim->damage_attribution_player = damager->key; // } // victim->health -= 0.25; // } @@ -3768,7 +3769,7 @@ void P_StepFrame(P_Frame *frame) if (old_guy->health > 0) { P_Ent *player = P_EntFromKey(frame, guy->source); - P_Ent *killer = P_EntFromKey(frame, guy->damage_attribution); + P_Ent *killer = P_EntFromKey(frame, guy->damage_attribution_player); // Update kill info { if (player->is_player) @@ -3788,6 +3789,7 @@ void P_StepFrame(P_Frame *frame) P_Ent *death = P_PushTempEnt(scratch.arena, &ents_to_spawn); death->key = P_EntKeyFromU64(MixU64s(guy->key.v, P_DeathBasis + (u64)player->deaths)); death->death_pos = guy->xf.t; + death->death_dir = guy->damage_attribution_dir; death->is_death = 1; death->death_victim = player->key; death->death_killer = killer->key; diff --git a/src/pp/pp.h b/src/pp/pp.h index 932a30bd..45fa09d4 100644 --- a/src/pp/pp.h +++ b/src/pp/pp.h @@ -159,6 +159,7 @@ Struct(P_NetworkedEntState) b32 is_death; Vec2 death_pos; + Vec2 death_dir; P_EntKey death_victim; P_EntKey death_killer; @@ -182,7 +183,8 @@ Struct(P_NetworkedEntState) //- Guy / Bullet - P_EntKey damage_attribution; + P_EntKey damage_attribution_player; + Vec2 damage_attribution_dir; //- Player diff --git a/src/pp/pp_vis/pp_vis_core.c b/src/pp/pp_vis/pp_vis_core.c index 3a28606b..220d31bc 100644 --- a/src/pp/pp_vis/pp_vis_core.c +++ b/src/pp/pp_vis/pp_vis_core.c @@ -613,7 +613,7 @@ V_WidgetTheme V_GetWidgetTheme(void) V_WidgetTheme theme = Zi; theme.ui_font = GC_FontKeyFromResource(ResourceKeyFromStore(&P_Resources, Lit("font/seguisb.ttf"))); - theme.player_name_font = GC_FontKeyFromResource(ResourceKeyFromStore(&P_Resources, Lit("font/fixedsys.ttf"))); + theme.game_font = GC_FontKeyFromResource(ResourceKeyFromStore(&P_Resources, Lit("font/fixedsys.ttf"))); theme.chat_font = GC_FontKeyFromResource(ResourceKeyFromStore(&P_Resources, Lit("font/seguisb.ttf"))); theme.icon_font = UI_BuiltinIconFont(); @@ -1562,30 +1562,22 @@ void V_TickForever(WaveLaneCtx *lane) frame->camera_zoom = LerpF32(prev_frame->camera_zoom, target_camera_zoom, frame->camera_lerp_rate); } - - - - - - // FIXME: Remove this - - // Apply shake + // Apply camera shake { - // FIXME: Remove this - - // shake_amount = 0; f32 shake_strength = TweakFloat("Shake strength", 50, 0, 1); if (frame->held_buttons[Button_R] && !prev_frame->held_buttons[Button_R]) { frame->camera_shake += shake_strength; } - u64 seed = MixU64(frame->tick); + f64 shakes_per_second = 50; + f64 current_time = SecondsFromNs(frame->time_ns); + + u64 shake_basis = (u64)((current_time - TruncF64(current_time)) * shakes_per_second); + u64 seed = MixU64s((u64)current_time, shake_basis); f32 x = Norm16(seed >> 0) * 2 - 1; f32 y = Norm16(seed >> 16) * 2 - 1; - // x -= 1; - // x *= 0.5; - // f32 x = (Norm24(MixU64(frame->tick)) - 2); + x *= frame->camera_shake * frame->dt; y *= frame->camera_shake * frame->dt; frame->camera_pos = AddVec2(frame->camera_pos, VEC2(x, y)); @@ -1683,7 +1675,7 @@ void V_TickForever(WaveLaneCtx *lane) { P_MsgNode tmp_msg_node = Zi; tmp_msg_node.msg.kind = P_MsgKind_Connect; - tmp_msg_node.msg.data = Lit("Brosef"); + tmp_msg_node.msg.data = Lit("Buck"); tmp_msg_node.msg.key = V.player_key; P_MsgList tmp_msglist = Zi; @@ -3165,7 +3157,7 @@ void V_TickForever(WaveLaneCtx *lane) // Bullet fired if (event->is_first_trail) { - // frame->camera_shake += 0.5; + frame->camera_shake = MaxF32(frame->camera_shake, 2); //- Bullet particle { @@ -3556,11 +3548,14 @@ void V_TickForever(WaveLaneCtx *lane) if (event->is_death) { Vec2 death_pos = event->death_pos; + Vec2 death_dir = event->death_dir; u64 killfeed_term_seed = MixU64s(event->key.v, P_KillfeedBasis); String killfeed_term = UpperString(frame->arena, P_KillTerms[killfeed_term_seed % countof(P_KillTerms)]); if (event->is_first_observation) { + frame->camera_shake = MaxF32(frame->camera_shake, 25); + //- Killfeed notification { V_Notif *notif = V_PushNotif(killfeed_term); @@ -3569,7 +3564,10 @@ void V_TickForever(WaveLaneCtx *lane) notif->victim = event->death_victim; } - //- Death particles + + + + //- Narrow blood particles { V_Emitter emitter = Zi; @@ -3577,15 +3575,55 @@ void V_TickForever(WaveLaneCtx *lane) // emitter.kind = V_ParticleKind_BloodDebris; // f32 angle = AngleFromVec2(frame->look); - f32 angle = 0; + f32 angle = AngleFromVec2(death_dir); // f32 angle_spread = Tau * 0.25; - f32 angle_spread = Tau; + f32 angle_spread = Tau * 0.25; + // f32 angle_spread = Tau; // f32 angle_spread = 0; // f32 speed = 5; // f32 speed = 25; - f32 speed = 50; + + // f32 speed_spread_min = 25; + // f32 speed_spread_max = 50; + // f32 speed = 100; + // f32 speed_spread = speed * 2; + + emitter.pos.p0 = emitter.pos.p1 = death_pos; + + emitter.speed.min = -25; + emitter.speed.max = 100; + + emitter.angle.min = angle - angle_spread * 0.5; + emitter.angle.max = angle + angle_spread * 0.5; + + // emitter.count = Kibi(32) * frame->dt; + // emitter.count = Kibi(1); + // emitter.count = Kibi(1); + emitter.count = Kibi(1); + + V_PushParticles(emitter); + } + + + + + + //- Wide blood particles + { + V_Emitter emitter = Zi; + + emitter.kind = V_ParticleKind_BloodTrail; + // emitter.kind = V_ParticleKind_BloodDebris; + + // f32 angle = AngleFromVec2(frame->look); + f32 angle = AngleFromVec2(death_dir); + // f32 angle_spread = Tau * 0.25; + // f32 angle_spread = Tau * 0.5; + f32 angle_spread = Tau; + + f32 speed = 50; f32 speed_spread = speed * 2; emitter.pos.p0 = emitter.pos.p1 = death_pos; @@ -3596,6 +3634,7 @@ void V_TickForever(WaveLaneCtx *lane) // emitter.count = Kibi(32) * frame->dt; // emitter.count = Kibi(1); + // emitter.count = Kibi(1); emitter.count = Kibi(4); V_PushParticles(emitter); @@ -3630,14 +3669,13 @@ void V_TickForever(WaveLaneCtx *lane) UI_PushDF(FontSize, 32) UI_PushDF(Opacity, opacity) UI_PushDF(Flags, UI_BoxFlag_Floating | UI_BoxFlag_DrawText | UI_BoxFlag_DontClampFloatingX | UI_BoxFlag_DontClampFloatingY) - UI_PushDF(Font, theme.player_name_font) + UI_PushDF(Font, theme.game_font) { - String text = killfeed_term; - - // Name box UI_SetNext(FloatingPos, text_screen_pos); UI_PushDF(TextColor, text_color) + UI_PushDF(Width, UI_Shrink(0, 1)) + UI_PushDF(Height, UI_Shrink(0, 1)) UI_PushDF(Parent, UI_BuildBox()) UI_PushDF(Text, text) { @@ -3646,7 +3684,7 @@ void V_TickForever(WaveLaneCtx *lane) UI_SetNext(FloatingPos, VEC2(2, 2)); UI_BuildBox(); - // Name text + // Kill term UI_BuildBox(); } } @@ -5684,142 +5722,6 @@ void V_TickForever(WaveLaneCtx *lane) - - - - - - - - - - - - // ////////////////////////////// - // //- Init panel layout - - // // TODO: Allow for custom layouts stored in config files - // // TODO: Don't use rand keys for panels - - // if (!V.root_panel) - // { - // V.root_panel = PushStruct(perm, V_Panel); - // V_Panel *left_panel = PushStruct(perm, V_Panel); - // V_Panel *right_panel = PushStruct(perm, V_Panel); - - // //- Root panel - // { - // { - // V_Panel *panel = V.root_panel; - // panel->box = UI_KeyF("test root panel"); - // panel->contents_box = vis_panels_box; - // panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v)); - // panel->pct = 1; - // panel->is_organizational = 1; - // panel->axis = Axis_X; - // V.root_panel = panel; - // } - - // //- Left panel - // { - // V_Panel *panel = left_panel; - // panel->parent = V.root_panel; - // panel->axis = Axis_X; - // DllQueuePush(panel->parent->first, panel->parent->last, panel); - // panel->box = UI_RandKey(); - // panel->contents_box = UI_KeyF("panel contents box %F", FmtUint(panel->box.v)); - // panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v)); - // panel->pct = 0.10; - // panel->is_organizational = 1; - // } - - // //- Right panel - // { - // V_Panel *panel = right_panel; - // panel->parent = V.root_panel; - // panel->axis = Axis_Y; - // DllQueuePush(panel->parent->first, panel->parent->last, panel); - // panel->box = UI_RandKey(); - // panel->contents_box = UI_KeyF("panel contents box %F", FmtUint(panel->box.v)); - // panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v)); - // panel->pct = 0.90; - // panel->is_organizational = 1; - // } - // } - - // //- Test spawn panel - // { - // V_Panel *panel = PushStruct(perm, V_Panel); - // panel->parent = left_panel; - // panel->axis = Axis_X; - // DllQueuePush(panel->parent->first, panel->parent->last, panel); - // panel->box = UI_RandKey(); - // panel->contents_box = UI_KeyF("panel contents box %F", FmtUint(panel->box.v)); - // panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v)); - // panel->flags |= V_PanelFlag_Spawn; - // panel->pct = 0.25; - // } - - // // //- Test profiler panel - // // { - // // V_Panel *panel = PushStruct(perm, V_Panel); - // // panel->parent = right_panel; - // // panel->axis = Axis_X; - // // DllQueuePush(panel->parent->first, panel->parent->last, panel); - // // panel->box = UI_RandKey(); - // // panel->contents_box = UI_KeyF("panel contents box %F", FmtUint(panel->box.v)); - // // panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v)); - // // panel->flags |= V_PanelFlag_Profiler; - // // panel->pct = 0.5; - // // } - - // //- Vis screen panel - // { - // V_Panel *panel = PushStruct(perm, V_Panel); - // panel->parent = right_panel; - // panel->axis = Axis_X; - // DllQueuePush(panel->parent->first, panel->parent->last, panel); - // panel->box = UI_RandKey(); - // panel->contents_box = vis_screen_panel_box; - // panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v)); - // panel->flags |= V_PanelFlag_Screen; - // panel->pct = 1; - // } - - // // //- Test console panel - // // { - // // V_Panel *parent = right_panel; - // // V_Panel *panel = PushStruct(perm, V_Panel); - // // panel->axis = Axis_X; - // // DllQueuePush(parent->first, parent->last, panel); - // // panel->box = UI_KeyF("test raah console panel"); - // // panel->contents_box = UI_KeyF("panel contents box %F", FmtUint(panel->box.v)); - // // panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v)); - // // panel->flags |= V_PanelFlag_Console; - // // // panel->flags |= V_PanelFlag_Spawn; - // // panel->pct = 0.25; - // // } - // } - - - - - - - - - - - - - - - - - - - - @@ -5832,21 +5734,7 @@ void V_TickForever(WaveLaneCtx *lane) ////////////////////////////// - //- - //- PROFILER DEMO panel layout - //- - - // FIXME: Remove this - - - - - - - - - - + //- Init panel layout // TODO: Allow for custom layouts stored in config files // TODO: Don't use rand keys for panels @@ -5910,18 +5798,18 @@ void V_TickForever(WaveLaneCtx *lane) panel->pct = 0.25; } - //- Test profiler panel - { - V_Panel *panel = PushStruct(perm, V_Panel); - panel->parent = right_panel; - panel->axis = Axis_X; - DllQueuePush(panel->parent->first, panel->parent->last, panel); - panel->box = UI_RandKey(); - panel->contents_box = UI_KeyF("panel contents box %F", FmtUint(panel->box.v)); - panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v)); - panel->flags |= V_PanelFlag_Profiler; - panel->pct = 0.75; - } + // //- Test profiler panel + // { + // V_Panel *panel = PushStruct(perm, V_Panel); + // panel->parent = right_panel; + // panel->axis = Axis_X; + // DllQueuePush(panel->parent->first, panel->parent->last, panel); + // panel->box = UI_RandKey(); + // panel->contents_box = UI_KeyF("panel contents box %F", FmtUint(panel->box.v)); + // panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v)); + // panel->flags |= V_PanelFlag_Profiler; + // panel->pct = 0.5; + // } //- Vis screen panel { @@ -5933,22 +5821,22 @@ void V_TickForever(WaveLaneCtx *lane) panel->contents_box = vis_screen_panel_box; panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v)); panel->flags |= V_PanelFlag_Screen; - panel->pct = 0.25; + panel->pct = 1; } - //- Test console panel - { - V_Panel *parent = right_panel; - V_Panel *panel = PushStruct(perm, V_Panel); - panel->axis = Axis_X; - DllQueuePush(parent->first, parent->last, panel); - panel->box = UI_KeyF("test raah console panel"); - panel->contents_box = UI_KeyF("panel contents box %F", FmtUint(panel->box.v)); - panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v)); - panel->flags |= V_PanelFlag_Console; - // panel->flags |= V_PanelFlag_Spawn; - panel->pct = 0.25; - } + // //- Test console panel + // { + // V_Panel *parent = right_panel; + // V_Panel *panel = PushStruct(perm, V_Panel); + // panel->axis = Axis_X; + // DllQueuePush(parent->first, parent->last, panel); + // panel->box = UI_KeyF("test raah console panel"); + // panel->contents_box = UI_KeyF("panel contents box %F", FmtUint(panel->box.v)); + // panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v)); + // panel->flags |= V_PanelFlag_Console; + // // panel->flags |= V_PanelFlag_Spawn; + // panel->pct = 0.25; + // } } @@ -5960,6 +5848,156 @@ void V_TickForever(WaveLaneCtx *lane) + + + + + + + + + + + + + + + + + + + + + + ////////////////////////////// + //- + //- PROFILER DEMO panel layout + //- + + // FIXME: Remove this + + + + + + + + + + + + // // TODO: Allow for custom layouts stored in config files + // // TODO: Don't use rand keys for panels + + // if (!V.root_panel) + // { + // V.root_panel = PushStruct(perm, V_Panel); + // V_Panel *left_panel = PushStruct(perm, V_Panel); + // V_Panel *right_panel = PushStruct(perm, V_Panel); + + // //- Root panel + // { + // { + // V_Panel *panel = V.root_panel; + // panel->box = UI_KeyF("test root panel"); + // panel->contents_box = vis_panels_box; + // panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v)); + // panel->pct = 1; + // panel->is_organizational = 1; + // panel->axis = Axis_X; + // V.root_panel = panel; + // } + + // //- Left panel + // { + // V_Panel *panel = left_panel; + // panel->parent = V.root_panel; + // panel->axis = Axis_X; + // DllQueuePush(panel->parent->first, panel->parent->last, panel); + // panel->box = UI_RandKey(); + // panel->contents_box = UI_KeyF("panel contents box %F", FmtUint(panel->box.v)); + // panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v)); + // panel->pct = 0.10; + // panel->is_organizational = 1; + // } + + // //- Right panel + // { + // V_Panel *panel = right_panel; + // panel->parent = V.root_panel; + // panel->axis = Axis_Y; + // DllQueuePush(panel->parent->first, panel->parent->last, panel); + // panel->box = UI_RandKey(); + // panel->contents_box = UI_KeyF("panel contents box %F", FmtUint(panel->box.v)); + // panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v)); + // panel->pct = 0.90; + // panel->is_organizational = 1; + // } + // } + + // //- Test spawn panel + // { + // V_Panel *panel = PushStruct(perm, V_Panel); + // panel->parent = left_panel; + // panel->axis = Axis_X; + // DllQueuePush(panel->parent->first, panel->parent->last, panel); + // panel->box = UI_RandKey(); + // panel->contents_box = UI_KeyF("panel contents box %F", FmtUint(panel->box.v)); + // panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v)); + // panel->flags |= V_PanelFlag_Spawn; + // panel->pct = 0.25; + // } + + // //- Test profiler panel + // { + // V_Panel *panel = PushStruct(perm, V_Panel); + // panel->parent = right_panel; + // panel->axis = Axis_X; + // DllQueuePush(panel->parent->first, panel->parent->last, panel); + // panel->box = UI_RandKey(); + // panel->contents_box = UI_KeyF("panel contents box %F", FmtUint(panel->box.v)); + // panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v)); + // panel->flags |= V_PanelFlag_Profiler; + // panel->pct = 0.75; + // } + + // //- Vis screen panel + // { + // V_Panel *panel = PushStruct(perm, V_Panel); + // panel->parent = right_panel; + // panel->axis = Axis_X; + // DllQueuePush(panel->parent->first, panel->parent->last, panel); + // panel->box = UI_RandKey(); + // panel->contents_box = vis_screen_panel_box; + // panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v)); + // panel->flags |= V_PanelFlag_Screen; + // panel->pct = 0.25; + // } + + // //- Test console panel + // { + // V_Panel *parent = right_panel; + // V_Panel *panel = PushStruct(perm, V_Panel); + // panel->axis = Axis_X; + // DllQueuePush(parent->first, parent->last, panel); + // panel->box = UI_KeyF("test raah console panel"); + // panel->contents_box = UI_KeyF("panel contents box %F", FmtUint(panel->box.v)); + // panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v)); + // panel->flags |= V_PanelFlag_Console; + // // panel->flags |= V_PanelFlag_Spawn; + // panel->pct = 0.25; + // } + // } + + + + + + + + + + ////////////////////////////// @@ -6239,6 +6277,24 @@ void V_TickForever(WaveLaneCtx *lane) + + + + + + + + + + + + + + + + + + @@ -6381,32 +6437,35 @@ void V_TickForever(WaveLaneCtx *lane) UI_PushDF(BackgroundColor, titlebar_color) UI_PushDF(BorderColor, titlebar_border_color) UI_PushDF(Rounding, UI_Rpx(0)) - UI_PushDF(ChildLayoutAxis, Axis_X) UI_PushDF(Width, UI_Grow(1, 0)) UI_PushDF(Height, header_height) UI_PushDF(FontSize, UI_Top(FontSize) * theme.h5) UI_PushDF(TextColor, theme.col.hint) UI_PushDF(ChildAlignment, UI_Region_Center) - UI_PushDF(Parent, UI_BuildBoxEx(titlebar_key)) + UI_PushDF(Parent, UI_BuildColumnEx(titlebar_key)) { - UI_Push(Width, UI_Grow(1, 0)); - UI_Push(BorderColor, 0); + UI_BuildSpacer(window_padding, Axis_Y); + UI_PushDF(Parent, UI_BuildRow()) + { + UI_Push(Width, UI_Grow(0, 0)); + UI_Push(BorderColor, 0); - // Left title box - UI_BuildRow(); + // Left title box + UI_BuildRow(); - UI_SetNext(Width, UI_Shrink(0, 1)); - UI_BuildIcon(theme.icon_font, UI_Icon_Wrench); + UI_SetNext(Width, UI_Shrink(0, 1)); + UI_BuildIcon(theme.icon_font, UI_Icon_Wrench); - // Title box - // UI_SetNext(FontSize, UI_Top(FontSize) * theme.h3); - UI_SetNext(Width, UI_Shrink(0, 1)); - UI_SetNext(Text, Lit(" Developer Palette")); - UI_SetNext(Flags, UI_BoxFlag_DrawText); - UI_BuildBox(); + // Title box + // UI_SetNext(FontSize, UI_Top(FontSize) * theme.h3); + UI_SetNext(Width, UI_Shrink(0, 1)); + UI_SetNext(Text, Lit(" Developer Palette")); + UI_SetNext(Flags, UI_BoxFlag_DrawText); + UI_BuildBox(); - // Right title box - UI_BuildRow(); + // Right title box + UI_BuildRow(); + } } //- Window box @@ -7338,6 +7397,1123 @@ void V_TickForever(WaveLaneCtx *lane) + + + + + + + + + + + + + + + + + + + + + + // ////////////////////////////// + // //- Build command palette + + // V_Palette *palette = &frame->palette; + // UI_PushDF(Parent, UI_RootKey) + // { + // UI_Push(Tag, HashF("developer command palette")); + + // // FIXME: Remove this + // if (frame->tick == 1) + // { + // palette->pos = VEC2(1000, 1000); + // } + + // UI_Size total_width = UI_Fnt(40, 1); + // UI_Size total_height = UI_Fnt(30, 1); + // UI_Size header_height = UI_Fnt(1.3, 1); + // UI_Size window_padding = UI_Fnt(0.5, 1); + // UI_Size icon_col_width = UI_Fnt(1.75, 1); + // UI_Size item_col_width = UI_Fnt(30, 1); + // // UI_Size col2_width = UI_Fnt(10, 1); + // UI_Size scrollbar_width = UI_Fnt(1, 1); + // f32 item_size_px = UI_Fnt(1.5, 1).v; + + // UI_Key scissor_key = UI_KeyF("scissor"); + // UI_Key lister_key = UI_KeyF("lister"); + // UI_Key scrollbar_key = UI_KeyF("scrollbar"); + // UI_Key thumb_key = UI_KeyF("scrollbar thumb"); + // UI_Key scrollbar_up_key = UI_KeyF("scrollbar up"); + // UI_Key scrollbar_down_key = UI_KeyF("scrollbar down"); + // UI_Key track_key = UI_KeyF("scrollbar track"); + + // f32 lister_start = UI_Rect(lister_key).p0.y; + // f32 lister_end = UI_Rect(lister_key).p1.y; + // f32 lister_height = MaxF32(lister_end - lister_start, 1); + + // f32 scissor_start = UI_Rect(scissor_key).p0.y; + // f32 scissor_end = UI_Rect(scissor_key).p1.y; + // f32 scissor_height = MaxF32(scissor_end - scissor_start, 1); + + // f32 track_start = UI_Rect(track_key).p0.y; + // f32 track_end = UI_Rect(track_key).p1.y; + // f32 track_height = MaxF32(track_end - track_start, 1); + + // f32 thumb_start = UI_Rect(thumb_key).p0.y; + // f32 thumb_end = UI_Rect(thumb_key).p1.y; + // f32 thumb_height = MaxF32(thumb_end - thumb_start, 1); + + // f32 wheel_scroll_amount = 3 * item_size_px; + // f32 button_scroll_amount = 20 * item_size_px * frame->dt; + // f32 scroll_height = MaxF32(lister_height - scissor_height, 1); + // { + // f32 wheel_scrolls = UI_Downs(lister_key, Button_WheelDown) - UI_Downs(lister_key, Button_WheelUp); + // f32 button_scrolls = UI_Held(scrollbar_down_key, Button_M1) - UI_Held(scrollbar_up_key, Button_M1); + // if (UI_Downs(thumb_key, Button_M1)) + // { + // palette->drag_lister = UI_Rect(lister_key); + // palette->drag_scissor = UI_Rect(scissor_key); + // palette->drag_track = UI_Rect(track_key); + // palette->drag_thumb = UI_Rect(thumb_key); + // palette->drag_cursor = UI_CursorPos(); + + // palette->drag_scroll = palette->scroll; + // } + // if (UI_Held(thumb_key, Button_M1)) + // { + // f32 drag_track_height = palette->drag_track.p1.y - palette->drag_track.p0.y; + // f32 drag_thumb_height = palette->drag_thumb.p1.y - palette->drag_thumb.p0.y; + // f32 drag_scroll_height = (palette->drag_lister.p1.y - palette->drag_lister.p0.y) - (palette->drag_scissor.p1.y - palette->drag_scissor.p0.y); + // f32 delta_ratio = (UI_CursorPos().y - palette->drag_cursor.y) / (drag_track_height - drag_thumb_height); + // palette->scroll = palette->drag_scroll + delta_ratio * drag_scroll_height; + // palette->target_scroll = palette->scroll; + // } + // palette->target_scroll += wheel_scrolls * wheel_scroll_amount; + // palette->target_scroll += button_scrolls * button_scroll_amount; + // palette->target_scroll = ClampF32(palette->target_scroll, 0, scroll_height); + // palette->scroll = LerpF32(palette->scroll, palette->target_scroll, SaturateF32(20 * frame->dt)); + // palette->scroll = ClampF32(palette->scroll, 0, scroll_height); + // } + + // f32 scroll_ratio = palette->scroll / scroll_height; + // f32 lister_offset = scroll_ratio * scroll_height; + + // f32 new_thumb_height = track_height * (scissor_height / lister_height); + // f32 new_thumb_start = scroll_ratio * track_height - scroll_ratio * thumb_height; + + // b32 scrollbar_visible = new_thumb_height < track_height; + + // { + // f32 ease_rate = TweakFloat("Debug palette ease rate", 20, 1, 100) * frame->dt; + // f32 ease_in_target = TweakFloat("Debug palette ease-in target", 1.3, 0, 2); + // f32 pref_show = palette->should_show ? ease_in_target : 0; + // palette->show = SaturateF32(LerpF32(palette->show, pref_show, ease_rate)); + // } + + // if (palette->should_show || palette->show > 0.001) + // { + // f32 tweak_size_px = UI_Fnt(1.25, 1).v; + + // palette->key = UI_KeyF("command palette"); + // UI_Checkpoint palette_cp = UI_PushCp(UI_NilKey); + // { + // UI_Push(Tag, palette->key.v); + // UI_Key titlebar_key = UI_KeyF("title bar"); + + // Vec4 window_background_color = theme.col.window_bg; + // Vec4 window_border_color = theme.col.window_bd; + // Vec4 titlebar_color = Zi; + // Vec4 titlebar_border_color = Zi; + // Vec4 divider_color = theme.col.divider; + // if (UI_Held(titlebar_key, Button_M1)) + // { + // Vec2 drag_offset = SubVec2(ui_frame->drag_cursor_pos, UI_DragAnchor(palette->key)); + // palette->pos = SubVec2(UI_CursorPos(), drag_offset); + // } + // window_border_color = LerpSrgb(window_border_color, theme.col.button_active, UI_Hot(titlebar_key)); + + // f32 scale = LerpF32(0.85, 1, palette->show); + // UI_Push(Tint, VEC4(1, 1, 1, palette->show)); + // UI_SetNext(Scale, VEC2(scale, scale)); + + // UI_SetNext(BackgroundColor, window_background_color); + // UI_SetNext(BorderColor, window_border_color); + // // UI_SetNext(BorderSize, theme.window_bd_sz); + // UI_SetNext(BorderSize, 1); + // UI_SetNext(Rounding, UI_Rgrow(0.06 * theme.rounding)); + // UI_SetNext(Width, total_width); + // UI_SetNext(Height, total_height); + // UI_SetNext(FloatingPos, palette->pos); + // UI_SetNext(ChildLayoutAxis, Axis_Y); + // UI_SetNext(Anchor, UI_Region_Center); + // UI_SetNext(Flags, UI_BoxFlag_Floating | (UI_BoxFlag_CaptureMouse * !!palette->should_show)); + // UI_PushDF(Parent, UI_BuildBoxEx(palette->key)) + // { + // //- Title bar + // UI_SetNext(Flags, UI_BoxFlag_DrawText | (UI_BoxFlag_CaptureMouse * !!palette->should_show)); + // UI_PushDF(BackgroundColor, titlebar_color) + // UI_PushDF(BorderColor, titlebar_border_color) + // UI_PushDF(Rounding, UI_Rpx(0)) + // UI_PushDF(ChildLayoutAxis, Axis_X) + // UI_PushDF(Width, UI_Grow(1, 0)) + // UI_PushDF(Height, header_height) + // UI_PushDF(FontSize, UI_Top(FontSize) * theme.h5) + // UI_PushDF(TextColor, theme.col.hint) + // UI_PushDF(ChildAlignment, UI_Region_Center) + // UI_PushDF(Parent, UI_BuildBoxEx(titlebar_key)) + // { + // UI_Push(Width, UI_Grow(1, 0)); + // UI_Push(BorderColor, 0); + + // // Left title box + // UI_BuildRow(); + + // UI_SetNext(Width, UI_Shrink(0, 1)); + // UI_BuildIcon(theme.icon_font, UI_Icon_Wrench); + + // // Title box + // // UI_SetNext(FontSize, UI_Top(FontSize) * theme.h3); + // UI_SetNext(Width, UI_Shrink(0, 1)); + // UI_SetNext(Text, Lit(" Developer Palette")); + // UI_SetNext(Flags, UI_BoxFlag_DrawText); + // UI_BuildBox(); + + // // Right title box + // UI_BuildRow(); + // } + + // //- Window box + // UI_SetNext(BackgroundColor, 0); + // UI_SetNext(Rounding, 0); + // UI_SetNext(Width, UI_Grow(1, 0)); + // UI_SetNext(Height, UI_Grow(1, 0)); + // UI_PushDF(Parent, UI_BuildRow()) + // { + // UI_BuildSpacer(window_padding, Axis_X); + + // UI_SetNext(BackgroundColor, 0); + // UI_SetNext(Rounding, 0); + // UI_SetNext(Width, UI_Grow(1, 0)); + // UI_SetNext(Height, UI_Grow(1, 0)); + // UI_PushDF(Parent, UI_BuildColumn()) + // { + // ////////////////////////////// + // //- Build searchbox + + // b32 is_searching = 0; + // String search_pattern = Zi; + // { + // UI_Size search_height = UI_Px(item_size_px * 1.25, 1); + + // UI_SetNext(BackgroundColor, 0); + // UI_SetNext(ChildAlignment, UI_Region_Left); + // UI_SetNext(Width, UI_Grow(1, 0)); + // UI_SetNext(Height, search_height); + // UI_PushCp(UI_BuildRow()); + // { + // //- Search icon + // { + // f32 size_px = UI_Top(FontSize) * 1.25; + + // UI_SetNext(Rounding, UI_Rgrow(0.75 * theme.rounding)); + // UI_SetNext(ChildAlignment, UI_Region_Center); + // UI_SetNext(BackgroundColor, 0); + // // UI_SetNext(BorderColor, reset_bd); + // UI_SetNext(BorderSize, 0); + // UI_SetNext(Rounding, 0); + // UI_SetNext(TextColor, theme.col.hint); + // UI_SetNext(Width, icon_col_width); + // UI_SetNext(Height, UI_Px(size_px * 1.5, 1)); + // // UI_SetNext(Flags, UI_BoxFlag_CaptureMouse); + // UI_SetNext(FontSize, size_px * theme.h6); + // UI_BuildIcon(theme.icon_font, UI_Icon_Search); + // // UI_BuildRow(); + // } + + // //- Search box + // { + // UI_Key search_box = UI_KeyF("search box"); + // UI_Key search_scroll_box = UI_KeyF("search scroll box"); + // V_TextboxState *search_state = &palette->search_state; + + // f32 font_size = UI_Top(FontSize); + // GC_FontKey font = UI_Top(Font); + + // // Vec4 search_color = Color_Black; + // Vec4 search_color = Zi; + + // b32 has_focus = UI_MatchKey(search_box, prev_frame->text_input_focus); + // { + // // FIXME: Remove this + // has_focus = 1; + // if (UI_Downs(search_box, Button_M1)) + // { + // has_focus = 1; + // V.text_input_ns = frame->time_ns; + // } + // if (!palette->should_show) + // { + // has_focus = 0; + // } + // } + + // if (UI_HotAbsolute(search_box)) + // { + // WND_SetCursor(window_frame, WND_CursorKind_Text); + // } + + // V_TextboxDeltaFlag tb_applied_flags = 0; + + // // Apply text input deltas + // { + // frame->text_input_focus = search_box; + // if (text_input_deltas.first) + // { + // V.text_input_ns = frame->time_ns; + // tb_applied_flags |= V_ApplyTextboxDeltas(search_state, text_input_deltas); + // } + // } + + // String search_text = V_StringFromTextbox(frame->arena, search_state); + // search_pattern = LowerString(frame->arena, search_text); + // is_searching = search_text.len != 0; + + // String display_text = search_text; + // Vec4 display_text_color = Color_White; + // if (!is_searching) + // { + // display_text_color = theme.col.hint; + // display_text = Lit(" Search..."); + // } + + // // TODO: Cache run for UI + // String32 codepoints = String32FromString(frame->arena, search_text); + // GC_Run run = GC_RunFromString32(frame->arena, codepoints, font, font_size); + + // b32 started_dragging_text = 0; + // b32 is_dragging_text = 0; + // if (has_focus) + // { + // // Generate & apply mouse text selection delta + // if (UI_Held(search_box, Button_M1)) + // { + // V.text_input_ns = frame->time_ns; + // is_dragging_text = 1; + // f32 mouse_text_px = UI_CursorPos().x - UI_Anchor(search_scroll_box).x; + // i64 rect_idx = 0; + // for (; rect_idx < (i64)run.rects_count; ++rect_idx) + // { + // GC_RunRect rect = run.rects[rect_idx]; + // if (rect.baseline_pos + rect.advance / 2 > mouse_text_px) + // { + // break; + // } + // } + // { + // V_TextboxDelta delta = Zi; + // delta.flags |= V_TextboxDeltaFlag_NavDirectEnd; + // delta.flags |= V_TextboxDeltaFlag_NavSelect; + // delta.direct_end = rect_idx; + // if (UI_Downs(search_box, Button_M1)) + // { + // delta.flags |= V_TextboxDeltaFlag_NavDirectStart; + // delta.direct_start = delta.direct_end; + // started_dragging_text = 1; + // } + // tb_applied_flags |= V_ApplyTextboxDelta(search_state, delta); + // } + // } + // } + + + + + + + + + + // UI_SetNext(Width, UI_Grow(1, 0)); + // UI_SetNext(Height, search_height); + // UI_SetNext(BackgroundColor, search_color); + // UI_SetNext(ChildAlignment, UI_Region_Right); + // // UI_SetNext(BorderColor, item_border_color); + // // UI_SetNext(Rounding, UI_Rpx(5)); + // UI_SetNext(Flags, UI_BoxFlag_CaptureMouse | UI_BoxFlag_Scissor); + // // UI_PushDF(BorderSize, 0) + // UI_PushDF(Parent, UI_BuildRowEx(search_box)) + // { + // //- Compute caret / selection pos + // { + // f32 target_caret_start_px = 0; + // f32 target_caret_end_px = 0; + // if (search_text.len > 0) + // { + // for (i64 rect_idx = 0; rect_idx < (i64)run.rects_count; ++rect_idx) + // { + // GC_RunRect rect = run.rects[rect_idx]; + // if (rect_idx < search_state->start) + // { + // target_caret_start_px = rect.baseline_pos + rect.advance; + // } + // if (rect_idx < search_state->end) + // { + // target_caret_end_px = rect.baseline_pos + rect.advance; + // } + // if (rect_idx >= search_state->start && rect_idx >= search_state->end) + // { + // break; + // } + // } + // } + + // f32 caret_start_lerp_rate = 20 * frame->dt; + // f32 caret_end_lerp_rate = 50 * frame->dt; + // { + // if (started_dragging_text) + // { + // caret_start_lerp_rate = 1; + // caret_end_lerp_rate = 1; + // } + // // if (tb_applied_flags & V_TextboxDeltaFlag_UpdateText) + // // { + // // caret_end_lerp_rate = 1; + // // } + // caret_start_lerp_rate = SaturateF32(caret_start_lerp_rate); + // caret_end_lerp_rate = SaturateF32(caret_end_lerp_rate); + // } + // palette->caret_start_px = LerpF32(palette->caret_start_px, target_caret_start_px, caret_start_lerp_rate); + // palette->caret_end_px = LerpF32(palette->caret_end_px, target_caret_end_px, caret_end_lerp_rate); + // } + + // // Calculate textbox width if we're not scaling up + // if (palette->show > 0.99) + // { + // palette->text_scroll_view_width_px = DimsFromRng2(UI_Rect(search_box)).x; + // } + + // //- Determine text scroll pos + // { + // { + // f32 new_text_scroll_px = palette->caret_end_px - 10; + // palette->text_scroll_px = MinF32(palette->text_scroll_px, new_text_scroll_px); + // } + // { + // f32 new_text_scroll_px = palette->caret_end_px - palette->text_scroll_view_width_px + 10; + // palette->text_scroll_px = MaxF32(palette->text_scroll_px, new_text_scroll_px); + // } + // palette->text_scroll_px = MaxF32(palette->text_scroll_px, 0); + // } + + // UI_Size caret_width = UI_Px(1, 1); + // UI_Size caret_height = UI_Px(search_height.v, 1); + // f32 h = TweakFloat("Text selection hue", 200, 0, 360); + // f32 s = TweakFloat("Text selection saturation", 1, 0, 1); + // f32 v = TweakFloat("Text selection brightness", 0.6, 0, 1); + // Vec4 selection_color = SrgbFromHsv(HSV(h, s, v)); + // // Vec4 selection_color = theme.col.button_active; + // // selection_color.a = 1; + + // Vec4 caret_color = VEC4(1, 1, 1, 0.75); + // caret_color.a *= AbsF32(CosF32(SecondsFromNs(frame->time_ns - V.text_input_ns) * 3)); + + // //- Text region + // UI_SetNext(FloatingPos, VEC2(-palette->text_scroll_px, 0)); + // UI_SetNext(Anchor, UI_Region_Left); + // UI_SetNext(ChildAlignment, UI_Region_Left); + // UI_SetNext(Width, UI_Shrink(0, 1)); + // UI_SetNext( + // Flags, + // UI_BoxFlag_DrawText | + // UI_BoxFlag_Floating | + // UI_BoxFlag_DontClampFloatingX + // ); + // // UI_PushDF(Parent, UI_BuildRowEx(search_scroll_box)) + // UI_PushDF(Parent, UI_BuildRowEx(search_scroll_box)) + // { + // UI_Key caret_box = UI_KeyF("search caret"); + // UI_Key selection_box = UI_KeyF("search selection"); + + // //- Selection + // { + // f32 min = MinF32(palette->caret_end_px, palette->caret_start_px); + // f32 max = MaxF32(palette->caret_end_px, palette->caret_start_px); + // UI_SetNext(Width, UI_Px(max - min, 1)); + // UI_SetNext(Height, caret_height); + // UI_SetNext(FloatingPos, VEC2(min, 0)); + // UI_SetNext(Anchor, UI_Region_Left); + // UI_SetNext(Flags, UI_BoxFlag_Floating | UI_BoxFlag_DontClampFloatingX); + // UI_SetNext(BackgroundColor, selection_color); + // UI_SetNext(FontSize, font_size); + // UI_BuildBoxEx(selection_box); + // } + + // //- Text + // { + // UI_SetNext(ChildAlignment, UI_Region_Left); + // UI_SetNext(Width, UI_Shrink(0, 1)); + // UI_SetNext(TextColor, display_text_color); + // UI_SetNext(Text, display_text); + // UI_SetNext( + // Flags, + // UI_BoxFlag_DrawText | + // UI_BoxFlag_DontTruncateText + // ); + // UI_BuildBox(); + // } + + // //- Caret + // if (has_focus) + // { + // UI_SetNext(Width, caret_width); + // UI_SetNext(Height, caret_height); + // UI_SetNext(FloatingPos, VEC2(palette->caret_end_px, 0)); + // UI_SetNext(Anchor, UI_Region_Left); + // UI_SetNext(Flags, UI_BoxFlag_Floating | UI_BoxFlag_DontClampFloatingX); + // UI_SetNext(BorderSize, 0); + // UI_SetNext(BackgroundColor, caret_color); + // UI_SetNext(FontSize, font_size); + // UI_BuildBoxEx(caret_box); + // } + // } + // } + // } + // } + // UI_PopCp(UI_TopCp()); + // } + + // UI_BuildDivider(UI_Px(1, 1), divider_color, Axis_Y); + + // ////////////////////////////// + // //- Build palette items list + + // // Scissor box + // UI_SetNext(BackgroundColor, 0); + // UI_SetNext(Rounding, 0); + // UI_SetNext(Width, UI_Grow(1, 0)); + // UI_SetNext(Height, UI_Grow(1, 0)); + // UI_SetNext(Flags, UI_BoxFlag_Scissor); + // UI_PushDF(Parent, UI_BuildRowEx(scissor_key)) + // { + // // Items & Scrollbar group + // UI_SetNext(Tint, 0); + // UI_SetNext(Rounding, 0); + // UI_PushDF(Parent, UI_BuildRow()) + // { + // // Items box + // UI_SetNext(BackgroundColor, 0); + // UI_SetNext(Rounding, 0); + // UI_SetNext(Width, UI_Grow(1, 0)); + // UI_SetNext(Height, UI_Shrink(0, 1)); + // UI_SetNext(FloatingPos, VEC2(0, -lister_offset)); + // UI_SetNext(Flags, UI_BoxFlag_Floating | UI_BoxFlag_DontClampFloatingY | UI_BoxFlag_CaptureMouse | UI_BoxFlag_CaptureThroughChildren); + // UI_PushDF(Parent, UI_BuildRowEx(lister_key)) + // { + // UI_SetNext(Tint, 0); + // UI_SetNext(Rounding, 0); + // UI_SetNext(Width, UI_Grow(1, 0)); + // UI_SetNext(Height, UI_Shrink(0, 1)); + // UI_PushDF(Parent, UI_BuildColumn()) + // { + // Enum(PaletteItemFlag) + // { + // PaletteItemFlag_None = 0, + // PaletteItemFlag_IsCmd = (1 << 0), + // PaletteItemFlag_IsTweakVar = (2 << 0), + // }; + + // Struct(PaletteItem) + // { + // PaletteItem *next; + // PaletteItem *prev; + + // UI_Key key; + // PaletteItemFlag flags; + + // V_Hotkey hotkeys[8]; + // String display_name; + + // V_CmdDesc cmd_desc; + // TweakVar tweak_var; + // }; + // PaletteItem *first_item = 0; + // PaletteItem *last_item = 0; + + // ////////////////////////////// + // //- Push command items + + // { + // for (u64 cmd_desc_idx = 0; cmd_desc_idx < countof(V_cmd_descs); ++cmd_desc_idx) + // { + // V_CmdDesc cmd_desc = V_cmd_descs[cmd_desc_idx]; + // if (!(cmd_desc.flags & V_CmdDescFlag_HideFromPalette)) + // { + // PaletteItem *item = PushStruct(frame->arena, PaletteItem); + // { + // item->key = UI_KeyF("cmd palette item %F", FmtString(cmd_desc.name)); + // item->display_name = cmd_desc.display_name; + // item->flags |= PaletteItemFlag_IsCmd; + // item->cmd_desc = cmd_desc; + // // FIXME: Attach active shortcuts instead of default hotkeys + // CopyStructs(item->hotkeys, cmd_desc.default_hotkeys, MinU32(countof(item->hotkeys), countof(cmd_desc.default_hotkeys))); + // } + // DllQueuePush(first_item, last_item, item); + // } + // } + // } + + // ////////////////////////////// + // //- Push tweak variables + + // TweakVarArray tweak_vars = GetAllTweakVars(frame->arena); + + // { + // for (i64 tweak_idx = 0; tweak_idx < tweak_vars.count; ++tweak_idx) + // { + // TweakVar tweak_var = tweak_vars.v[tweak_idx]; + // PaletteItem *item = PushStruct(frame->arena, PaletteItem); + // { + // item->key = UI_KeyF("tweak var palette item %F", FmtString(tweak_var.name)); + // item->display_name = tweak_var.name; + // item->flags |= PaletteItemFlag_IsTweakVar; + // item->tweak_var = tweak_var; + // } + // DllQueuePush(first_item, last_item, item); + // } + // } + + // ////////////////////////////// + // //- Prune non-matching items + + // if (is_searching) + // { + // for (PaletteItem *item = first_item; item;) + // { + // PaletteItem *next = item->next; + // { + // b32 prune = !StringContains(LowerString(frame->arena, item->display_name), search_pattern); + // if (prune) + // { + // DllQueueRemove(first_item, last_item, item); + // } + // } + // item = next; + // } + // } + + // ////////////////////////////// + // //- Build items + + // for (PaletteItem *item = first_item; item; item = item->next) + // { + // // Divider + // if (item != first_item) + // { + // UI_BuildDivider(UI_Px(1, 1), divider_color, Axis_Y); + // } + + // if (UI_Presses(item->key, Button_M1)) + // { + // if (item->flags & PaletteItemFlag_IsCmd) + // { + // String cmd_name = item->cmd_desc.name; + // V_PushVisCmd(cmd_name); + // } + // } + + // // Vec4 item_color = theme.col.window_bg; + // Vec4 item_color = Zi; + // // Vec4 item_color = theme.col.hint; + // Vec4 item_border_color = Zi; + // if (item->flags & PaletteItemFlag_IsCmd) + // { + // item_color = LerpSrgb(item_color, theme.col.button_hot, UI_Hot(item->key)); + // item_color = LerpSrgb(item_color, theme.col.button_active, UI_Active(item->key)); + // item_border_color = LerpSrgb(item_border_color, theme.col.button_active, UI_Hot(item->key)); + // } + // else + // { + // item_border_color = LerpSrgb(item_border_color, theme.col.button_active, UI_Hot(item->key)); + // } + + // UI_SetNext(Tint, 0); + // // UI_SetNext(Width, UI_Px(total_width.v - window_padding.v * 2, 1)); + // UI_SetNext(Width, UI_Grow(1, 0)); + // UI_SetNext(Height, UI_Fnt(1.5, 1)); + // UI_PushDF(Parent, UI_BuildRow()) + // { + // UI_SetNext(BackgroundColor, item_color); + // UI_SetNext(BorderColor, item_border_color); + // UI_SetNext(BorderSize, 1); + // UI_SetNext(Rounding, UI_Rpx(5)); + // // UI_SetNext(Width, item_col_width); + // UI_SetNext(Width, UI_Grow(1, 0)); + // // UI_SetNext(Height, UI_Px(item_size_px, 1)); + // // UI_SetNext(Height, UI_Fnt(1, 0)); + // UI_SetNext(ChildAlignment, UI_Region_Left); + // UI_SetNext(Flags, UI_BoxFlag_DrawText | UI_BoxFlag_CaptureMouse); + // UI_PushDF(Parent, UI_BuildRowEx(item->key)) + // { + // UI_Push(Tag, item->key.v); + + // UI_BuildSpacer(icon_col_width, Axis_X); + + // // Command label + // UI_SetNext(ChildAlignment, UI_Region_Left); + // UI_BuildLabel(item->display_name); + + // // Middle spacer + // UI_BuildSpacer(UI_Grow(1, 0), Axis_X); + + // // Tweak + // if (item->flags & PaletteItemFlag_IsTweakVar) + // { + // TweakVar tweak_var = item->tweak_var; + // String old_tweak_str = tweak_var.value; + // String new_tweak_str = tweak_var.value; + // b32 is_default = MatchString(new_tweak_str, tweak_var.initial); + + // // Reset button + // if (!is_default) + // { + // // UI_BuildSpacer(UI_Px(spacing * 0.5, 1), Axis_X); + // UI_Key reset_key = UI_KeyF("reset"); + + // if (UI_Downs(reset_key, Button_M1)) + // { + // new_tweak_str = tweak_var.initial; + // } + // if (UI_HotAbsolute(reset_key)) + // { + // WND_SetCursor(window_frame, WND_CursorKind_Hand); + // } + + // Vec4 reset_bg = Zi; + // // reset_bg = LerpSrgb(reset_bg, theme.col.button_hot, UI_Hot(reset_key)); + // // reset_bg = LerpSrgb(reset_bg, theme.col.button_active, UI_Active(reset_key)); + + // Vec4 reset_bd = Zi; + // // reset_bd = LerpSrgb(reset_bd, theme.col.button_active, UI_Hot(reset_key)); + // // reset_bd = LerpSrgb(reset_bd, theme.col.text, UI_Hot(reset_key)); + + // Vec4 reset_text_col = theme.col.hint; + // reset_text_col = LerpSrgb(reset_text_col, theme.col.text, UI_Hot(reset_key)); + + // UI_SetNext(Rounding, UI_Rgrow(0.75 * theme.rounding)); + // UI_SetNext(ChildAlignment, UI_Region_Bottom); + // UI_SetNext(BackgroundColor, reset_bg); + // UI_SetNext(BorderColor, reset_bd); + // UI_SetNext(BorderSize, 0); + // UI_SetNext(TextColor, reset_text_col); + // UI_SetNext(Width, UI_Shrink(0, 1)); + // UI_SetNext(Height, UI_Shrink(0, 1)); + // UI_SetNext(Flags, UI_BoxFlag_CaptureMouse); + // UI_SetNext(FontSize, UI_Top(FontSize) * theme.h6); + // UI_BuildIconEx(reset_key, theme.icon_font, UI_Icon_Loop2); + // } + + // // Tweak label + // { + // UI_BuildSpacer(icon_col_width, Axis_X); + // if (is_default) + // { + // UI_SetNext(TextColor, theme.col.hint); + // } + // else + // { + // UI_SetNext(TextColor, Color_White); + // } + // UI_SetNext(FontSize, UI_Top(FontSize) * theme.h5); + // UI_SetNext(ChildAlignment, UI_Region_Left); + // UI_SetNext(Width, UI_Shrink(0, 1)); + // UI_SetNext(Height, UI_Shrink(0, 1)); + // UI_SetNext(Text, new_tweak_str); + // UI_SetNext(Flags, UI_BoxFlag_DrawText | UI_BoxFlag_DontTruncateText); + // UI_SetNext(BackgroundColor, 0); + // UI_SetNext(BorderColor, 0); + // UI_BuildBox(); + // } + + // UI_BuildSpacer(icon_col_width, Axis_X); + + // switch (tweak_var.kind) + // { + // // Boolean tweak + // case TweakKind_Bool: + // { + // UI_Key cb_key = UI_KeyF("tweak checkbox"); + + // b32 tweak_bool = CR_BoolFromString(new_tweak_str); + // if (UI_Downs(cb_key, Button_M1)) + // { + // tweak_bool = !tweak_bool; + // new_tweak_str = StringFromBool(frame->arena, tweak_bool); + // } + + // // Tweak checkbox + // Vec4 cb_bg_color = Zi; + // Vec4 cb_border_color = theme.col.window_bd; + // cb_bg_color = LerpSrgb(cb_bg_color, theme.col.positive, tweak_bool); + // cb_border_color = LerpSrgb(cb_border_color, theme.col.button_active, UI_Hot(cb_key)); + + // UI_SetNext(BackgroundColor, cb_bg_color); + // UI_SetNext(BorderColor, cb_border_color); + // UI_SetNext(Rounding, UI_Rgrow(theme.rounding)); + // UI_SetNext(BorderSize, 1); + // UI_SetNext(Width, UI_Fnt(1.25, 1)); + // UI_SetNext(Height, UI_Fnt(1.25, 1)); + // UI_SetNext(Flags, UI_BoxFlag_CaptureMouse); + // UI_BuildRowEx(cb_key); + // } break; + + // // Float tweak + // case TweakKind_Float: + // { + // UI_Key slider_key = UI_KeyF("tweak slider"); + // UI_Key marker_key = UI_KeyF("tweak slider marker"); + + // b32 is_hot = UI_HotAbsolute(slider_key) || UI_HotAbsolute(marker_key); + // b32 is_active = UI_Held(slider_key, Button_M1) || UI_Held(marker_key, Button_M1); + // f32 hot = MaxF32(UI_Hot(slider_key), UI_Hot(marker_key)); + + // Vec2 slider_pos = UI_Rect(slider_key).p0; + // Vec2 slider_dims = DimsFromRng2(UI_Rect(slider_key)); + // Vec2 marker_dims = DimsFromRng2(UI_Rect(marker_key)); + // Vec2 half_marker_dims = MulVec2(marker_dims, 0.5); + + // f64 range_min = tweak_var.range.min; + // f64 range_max = tweak_var.range.max; + // if (range_max <= range_min) + // { + // range_max = range_min + 1; + // } + + // f64 tweak_float = CR_FloatFromString(new_tweak_str); + // { + // if (is_active) + // { + // f64 initial_slider_pos = UI_DragRect(slider_key).p0.x; + // f64 initial_marker_width = DimsFromRng2(UI_DragRect(marker_key)).x; + // f64 initial_slider_width = DimsFromRng2(UI_DragRect(slider_key)).x - initial_marker_width; + // f64 initial_cursor = ui_frame->drag_cursor_pos.x; + // f64 initial_ratio = UI_DragMisc(slider_key); + + // f64 virtual_slider_start = initial_cursor - (initial_slider_width * initial_ratio); + // f64 virtual_slider_end = virtual_slider_start + initial_slider_width; + // f64 virtual_cursor_ratio = (frame->ui_cursor.x - virtual_slider_start) / (virtual_slider_end - virtual_slider_start); + + // tweak_float = LerpF64(range_min, range_max, virtual_cursor_ratio); + // tweak_float = ClampF64(tweak_float, range_min, range_max); + // if (frame->ui_cursor.x != prev_frame->ui_cursor.x) + // { + // new_tweak_str = StringFromFloat(frame->arena, tweak_float, tweak_var.precision); + // } + // } + // if (is_hot) + // { + // WND_SetCursor(window_frame, WND_CursorKind_HorizontalResize); + // } + // } + // f32 ratio = 0; + // ratio = (tweak_float - range_min) / (range_max - range_min); + // ratio = ClampF32(ratio, 0, 1); + + // Vec4 slider_bg_color = theme.col.window_bg; + // Vec4 slider_border_color = theme.col.window_bd; + // Vec4 slider_progress_color = theme.col.positive; + // Vec4 marker_bg_color = slider_progress_color; + // slider_border_color = LerpSrgb(slider_border_color, theme.col.button_active, hot); + // marker_bg_color = LerpSrgb(marker_bg_color, theme.col.text, hot); + + // UI_SetNext(BackgroundColor, slider_bg_color); + // UI_SetNext(BorderColor, slider_border_color); + // UI_SetNext(Rounding, UI_Rgrow(theme.rounding)); + // UI_SetNext(BorderSize, 1); + // UI_SetNext(Width, UI_Fnt(10, 1)); + // UI_SetNext(Height, UI_Px(tweak_size_px * 0.75, 1)); + // UI_SetNext(Flags, UI_BoxFlag_CaptureMouse); + // UI_SetNext(Misc, ratio); + // UI_PushDF(Parent, UI_BuildRowEx(slider_key)) + // { + // f32 marker_pos = ratio * (slider_dims.x - marker_dims.x); + + // // Slider progress + // { + // UI_SetNext(BackgroundColor, slider_progress_color); + // // UI_SetNext(Rounding, UI_Rgrow(theme.rounding)); + // UI_SetNext(Rounding, 0); + // UI_SetNext(BorderColor, 0); + // UI_SetNext(BorderSize, 1); + // UI_SetNext(Width, UI_Px(marker_pos + half_marker_dims.x, 0)); + // UI_SetNext(Height, UI_Px(tweak_size_px * 0.75, 1)); + // UI_BuildBox(); + // } + + // // Slider marker + // { + // UI_SetNext(BackgroundColor, marker_bg_color); + // UI_SetNext(BorderColor, slider_border_color); + // UI_SetNext(Rounding, UI_Rgrow(theme.rounding)); + // UI_SetNext(BorderSize, 1); + // UI_SetNext(Width, UI_Px(tweak_size_px, 1)); + // UI_SetNext(Height, UI_Px(tweak_size_px, 1)); + // // UI_SetNext(Anchor, UI_Region_Center); + // // UI_SetNext(FloatingPos, VEC2(marker_pos, (marker_size_px * 0.5))); + // UI_SetNext(FloatingPos, VEC2(marker_pos, -marker_dims.y * 0.125)); + // UI_SetNext(Flags, UI_BoxFlag_Floating | UI_BoxFlag_DontClampFloatingX | UI_BoxFlag_DontClampFloatingY | UI_BoxFlag_CaptureMouse); + // UI_BuildBoxEx(marker_key); + // } + // } + // } break; + // } + + // if (!MatchString(old_tweak_str, new_tweak_str)) + // { + // TweakVar new_tweak_var = tweak_var; + // new_tweak_var.value = new_tweak_str; + // TweakEx(frame->arena, new_tweak_var, 1); + // } + // } + + // // Command hotkey buttons + // for (u64 i = 0; i < countof(item->hotkeys); ++i) + // { + // UI_Key hotkey_box = UI_KeyF("hotkey%F", FmtUint(i)); + + // Vec4 hotkey_color = Zi; + // Vec4 hotkey_border_color = Zi; + // { + // Vec4 hovered_color = Rgb32(0x103c4c); + // Vec4 pressed_color = hovered_color; + // pressed_color.w = 0.2; + // f32 hotkey_hot = UI_Hot(hotkey_box); + // f32 hotkey_active = UI_Active(hotkey_box); + // f32 hotkey_hovered = UI_HotAbsolute(hotkey_box); + // hotkey_color = LerpSrgb(hotkey_color, hovered_color, hotkey_hot); + // hotkey_color = LerpSrgb(hotkey_color, pressed_color, hotkey_active * hotkey_hovered); + // hotkey_border_color = LerpSrgb(hotkey_border_color, Rgb32(0x0078a6), hotkey_hot); + // } + + // V_Hotkey hotkey = item->hotkeys[i]; + // if (hotkey.button == Button_None) + // { + // break; + // } + // else + // { + // UI_BuildSpacer(UI_Px(10, 1), Axis_X); + + // String hotkey_name = V_StringFromHotkey(UI_FrameArena(), hotkey); + // UI_SetNext(BackgroundColor, hotkey_color); + // UI_SetNext(BorderColor, hotkey_border_color); + // UI_SetNext(Text, hotkey_name); + // UI_SetNext(Width, UI_Shrink(theme.text_padding_x, 1)); + // UI_SetNext(Height, UI_Grow(1, 0)); + // UI_SetNext(Rounding, UI_Rpx(5)); + // UI_SetNext(BorderSize, 1); + // UI_SetNext(ChildAlignment, UI_Region_Center); + // UI_SetNext(Flags, UI_BoxFlag_DrawText | UI_BoxFlag_CaptureMouse); + // UI_BuildRowEx(hotkey_box); + // } + // } + + // // UI_BuildSpacer(icon_col_width, Axis_X); + // } + // } + // } + // } + // } + // } + + + + + + + + + + // //- Scrollbar + // if (scrollbar_visible) + // { + // UI_BuildSpacer(window_padding, Axis_X); + + // UI_SetNext(Width, scrollbar_width); + // UI_PushDF(Parent, UI_BuildBoxEx(scrollbar_key)) + // { + // //- Scrollbar up button + // { + // Vec4 col = theme.col.hint; + // Vec4 bd_col = Zi; + // col = LerpSrgb(col, theme.col.button_active, UI_Active(scrollbar_up_key)); + // bd_col = LerpSrgb(bd_col, theme.col.button_hot, UI_Hot(scrollbar_up_key)); + // bd_col = LerpSrgb(bd_col, theme.col.button_active, UI_Active(scrollbar_up_key)); + // UI_SetNext(ChildAlignment, UI_Region_Center); + // UI_SetNext(BorderColor, bd_col); + // UI_SetNext(BorderSize, 1); + // UI_SetNext(Rounding, UI_Rgrow(theme.rounding * 0.5)); + // UI_SetNext(TextColor, col); + // UI_SetNext(Width, UI_Grow(1, 1)); + // UI_SetNext(Height, UI_Fnt(1.5, 1)); + // UI_SetNext(Flags, UI_BoxFlag_CaptureMouse); + // UI_SetNext(FontSize, UI_Top(FontSize) * theme.h6); + // UI_BuildIconEx(scrollbar_up_key, theme.icon_font, UI_Icon_ArrowUp2); + // } + + // //- Scrollbar thumb + // { + // UI_SetNext(Height, UI_Grow(1, 0)); + // UI_PushCp(UI_BuildBoxEx(track_key)); + // { + // Vec4 bg = theme.col.button_hot; + // Vec4 bd = bg; + // bg = LerpSrgb(bg, theme.col.button_active, UI_Active(thumb_key)); + // bd = LerpSrgb(bg, theme.col.button_active, UI_Hot(thumb_key)); + + // UI_SetNext(BackgroundColor, bg); + // UI_SetNext(Width, UI_Grow(1, 0)); + // UI_SetNext(Height, UI_Px(new_thumb_height, 1)); + // UI_SetNext(BorderSize, 1); + // UI_SetNext(BorderColor, bd); + // UI_SetNext(Rounding, UI_Rgrow(0.75 * theme.rounding)); + // UI_SetNext(FloatingPos, VEC2(0, new_thumb_start)); + // UI_SetNext(Anchor, UI_Region_Center); + // UI_SetNext(Anchor, UI_Region_Top); + // // UI_SetNext(Flags, UI_BoxFlag_CaptureMouse | UI_BoxFlag_Floating); + // UI_SetNext(Flags, UI_BoxFlag_CaptureMouse | UI_BoxFlag_Floating | UI_BoxFlag_DontClampFloatingY); + // UI_SetNext(Anchor, UI_Region_Top); + // UI_BuildBoxEx(thumb_key); + // } + // UI_PopCp(UI_TopCp()); + // } + + // //- Scrollbar down button + // { + // Vec4 col = theme.col.hint; + // Vec4 bd_col = Zi; + // col = LerpSrgb(col, theme.col.button_active, UI_Active(scrollbar_down_key)); + // bd_col = LerpSrgb(bd_col, theme.col.button_hot, UI_Hot(scrollbar_down_key)); + // bd_col = LerpSrgb(bd_col, theme.col.button_active, UI_Active(scrollbar_down_key)); + // UI_SetNext(ChildAlignment, UI_Region_Center); + // UI_SetNext(BorderColor, bd_col); + // UI_SetNext(BorderSize, 1); + // UI_SetNext(Rounding, UI_Rgrow(theme.rounding * 0.5)); + // UI_SetNext(TextColor, col); + // UI_SetNext(Width, UI_Grow(1, 1)); + // UI_SetNext(Height, UI_Fnt(1.5, 1)); + // UI_SetNext(Flags, UI_BoxFlag_CaptureMouse); + // UI_SetNext(FontSize, UI_Top(FontSize) * theme.h6); + // UI_BuildIconEx(scrollbar_down_key, theme.icon_font, UI_Icon_ArrowDown2); + // } + // } + // } + // } + // UI_BuildDivider(UI_Px(1, 1), divider_color, Axis_Y); + // } + + // UI_BuildSpacer(window_padding, Axis_X); + // // UI_BuildSpacer(UI_Fnt(100, 1), Axis_Y); + + + + // // FIXME: Remove this + // // if (scrollbar_visible) + // // { + + // // Vec2 scrollbar_pos = scrollbar_reps.UI_Rect().p0; + // // Vec2 scrollbar_dims = DimsFromRng2(scrollbar_reps.UI_Rect()); + // // Vec2 thumb_dims = DimsFromRng2(UI_Rect(thumb_key)); + // // // Vec2 half_thumb_dims = MulVec2(thumb_dims, 0.5); + + + // // // f32 range_min = tweak_var.range.min; + // // // f32 range_max = tweak_var.range.max; + // // // if (range_max <= range_min) + // // // { + // // // range_max = range_min + 1; + // // // } + + + + + + + // // // f32 ratio = 0; + // // // ratio = (tweak_float - range_min) / (range_max - range_min); + // // // ratio = ClampF32(ratio, 0, 1); + + // // if (thumb_reps.draw.buttons[Button_M1].downs) + // // { + // // palette->scroll_begin = palette->scroll; + // // } + // // if (thumb_reps.draw.buttons[Button_M1].held) + // // { + // // palette->scroll = palette->scroll_begin + (frame->screen_cursor.y - ui_frame->drag_cursor_pos.y); + // // } + // // palette->scroll = MaxF32(palette->scroll, 0); + + // // // f32 thumb_offset = 50; + // // f32 thumb_offset = palette->scroll; + + + + + + + // // UI_SetNext(Width, scrollbar_width); + // // UI_PushCp(UI_BuildBoxEx(scrollbar_key)); + // // { + // // UI_Size thumb_height = UI_Fnt(10, 1); + + // // Vec4 thumb_color = VEC4(0, 0.5, 1, 1); + // // thumb_color.a = thumb_reps.UI_Hot() * 0.5 + 0.5; + + // // UI_SetNext(BackgroundColor, thumb_color); + // // UI_SetNext(Width, UI_Grow(1, 0)); + // // UI_SetNext(Height, thumb_height); + // // UI_SetNext(Rounding, UI_Rgrow(1 * theme.rounding)); + // // UI_SetNext(FloatingPos, VEC2(0, thumb_offset)); + // // // UI_SetNext(Anchor, UI_Region_Center); + // // UI_SetNext(Anchor, UI_Region_Top); + // // UI_SetNext(Flags, UI_BoxFlag_CaptureMouse | UI_BoxFlag_Floating); + // // UI_SetNext(Anchor, UI_Region_Top); + // // UI_BuildBoxEx(thumb_key); + // // } + // // UI_PopCp(UI_TopCp()); + // // } + // } + // // UI_BuildSpacer(window_padding, Axis_Y); + + // // UI_BuildDivider(UI_Px(1, 1), divider_color, Axis_Y); + + // UI_BuildSpacer(header_height, Axis_Y); + // } + // } + // // UI_PopCp(UI_TopCp()); + // UI_PopCp(palette_cp); + // } + + // UI_Pop(Tag); + // } + + + + + + + + + + + + + + + + @@ -7448,7 +8624,7 @@ void V_TickForever(WaveLaneCtx *lane) { String msg = StringF(frame->arena, " %F ", FmtString(notif->msg)); UI_SetNext(Text, msg); - UI_SetNext(Font, theme.player_name_font); + UI_SetNext(Font, theme.game_font); UI_SetNext(FontSize, 16); UI_SetNext(Flags, UI_BoxFlag_DrawText); UI_BuildRow(); @@ -7989,7 +9165,7 @@ void V_TickForever(WaveLaneCtx *lane) //- Build player names UI { - UI_PushDF(Font, theme.player_name_font) + UI_PushDF(Font, theme.game_font) UI_PushDF(FontSize, 12) UI_PushDF(Width, UI_Shrink(4, 1)) UI_PushDF(Height, UI_Shrink(1, 1)) @@ -8702,7 +9878,6 @@ void V_TickForever(WaveLaneCtx *lane) i32 vsync = !!TweakBool("Vsync", 1); - vsync = 1; UI_EndFrame(ui_frame, vsync); if (frame->tick == 1) diff --git a/src/pp/pp_vis/pp_vis_core.h b/src/pp/pp_vis/pp_vis_core.h index a4d2a592..13440a0f 100644 --- a/src/pp/pp_vis/pp_vis_core.h +++ b/src/pp/pp_vis/pp_vis_core.h @@ -35,7 +35,7 @@ Struct(V_WidgetTheme) GC_FontKey ui_font; GC_FontKey chat_font; GC_FontKey icon_font; - GC_FontKey player_name_font; + GC_FontKey game_font; f32 ui_font_size; f32 chat_font_size; diff --git a/src/pp/pp_vis/pp_vis_gpu.g b/src/pp/pp_vis/pp_vis_gpu.g index 1d78184d..4e0ffc24 100644 --- a/src/pp/pp_vis/pp_vis_gpu.g +++ b/src/pp/pp_vis/pp_vis_gpu.g @@ -1233,13 +1233,14 @@ ComputeShader(V_CompositeCS) // World bounds if (draw_grid || frame.is_editing) { - const Vec4 bounds_color = LinearFromSrgb(Vec4(0.75, 0.75, 0, 1)); + // const Vec4 bounds_color = LinearFromSrgb(Vec4(0.75, 0.75, 0, 1)); + const Vec4 bounds_color = LinearFromSrgb(Vec4(1.35, 1.35, 0, 1)); f32 bounds_dist = 100000; bounds_dist = min(bounds_dist, abs(screen_pos.x - world_bounds_screen_p0.x)); bounds_dist = min(bounds_dist, abs(screen_pos.x - world_bounds_screen_p1.x)); bounds_dist = min(bounds_dist, abs(screen_pos.y - world_bounds_screen_p0.y)); bounds_dist = min(bounds_dist, abs(screen_pos.y - world_bounds_screen_p1.y)); - if (bounds_dist <= half_thickness) + if (bounds_dist <= half_thickness * 2) { grid_color = bounds_color; } diff --git a/src/ui/ui_core.c b/src/ui/ui_core.c index e654d868..67f50351 100644 --- a/src/ui/ui_core.c +++ b/src/ui/ui_core.c @@ -1463,14 +1463,7 @@ void UI_EndFrame(UI_Frame *frame, i32 vsync) UI_Size size = box->desc.pref_semantic_dims[axis]; if (size.kind == UI_SizeKind_Pixel) { - if (TweakBool("RAAAAAAAAAAAAAH", 1)) - { - box->solved_dims.v[axis] = size.v; - } - else - { - box->solved_dims.v[axis] = CeilF32(size.v); - } + box->solved_dims.v[axis] = size.v; } else if (size.kind == UI_SizeKind_Shrink) { @@ -1485,25 +1478,11 @@ void UI_EndFrame(UI_Frame *frame, i32 vsync) { text_size = box->glyph_run.font_ascent + box->glyph_run.font_descent; } - if (TweakBool("RAAAAAAAAAAAAAH", 1)) - { - box->solved_dims.v[axis] = text_size + (size.v * 2); - } - else - { - box->solved_dims.v[axis] = CeilF32(text_size + (size.v * 2)); - } + box->solved_dims.v[axis] = text_size + (size.v * 2); } else if (!SPR_IsSheetKeyNil(box->desc.sprite_sheet)) { - if (TweakBool("RAAAAAAAAAAAAAH", 1)) - { - box->solved_dims.v[axis] = box->sprite.tex_rect.p1.v[axis] - box->sprite.tex_rect.p0.v[axis] + (size.v * 2); - } - else - { - box->solved_dims.v[axis] = CeilF32(box->sprite.tex_rect.p1.v[axis] - box->sprite.tex_rect.p0.v[axis] + (size.v * 2)); - } + box->solved_dims.v[axis] = box->sprite.tex_rect.p1.v[axis] - box->sprite.tex_rect.p0.v[axis] + (size.v * 2); } } }