tile panel testing
This commit is contained in:
parent
de0e166de7
commit
a4ebc3cb49
@ -417,7 +417,6 @@ void S_TickForever(WaveLaneCtx *lane)
|
|||||||
LockTicketMutex(&S.output_back_tm);
|
LockTicketMutex(&S.output_back_tm);
|
||||||
{
|
{
|
||||||
S_OutputState *output = &S.output_states[S.output_back_idx];
|
S_OutputState *output = &S.output_states[S.output_back_idx];
|
||||||
ResetArena(output->arena);
|
|
||||||
S_SnapshotNode *snapshot_node = PushStruct(output->arena, S_SnapshotNode);
|
S_SnapshotNode *snapshot_node = PushStruct(output->arena, S_SnapshotNode);
|
||||||
S_Snapshot *snapshot = &snapshot_node->snapshot;
|
S_Snapshot *snapshot = &snapshot_node->snapshot;
|
||||||
SllQueuePush(output->first_snapshot_node, output->last_snapshot_node, snapshot_node);
|
SllQueuePush(output->first_snapshot_node, output->last_snapshot_node, snapshot_node);
|
||||||
|
|||||||
@ -460,9 +460,11 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
frame->ui_debug = last_frame->ui_debug;
|
frame->ui_debug = last_frame->ui_debug;
|
||||||
frame->show_command_palette = last_frame->show_command_palette;
|
frame->show_command_palette = last_frame->show_command_palette;
|
||||||
frame->show_console = last_frame->show_console;
|
frame->show_console = last_frame->show_console;
|
||||||
|
frame->look = last_frame->look;
|
||||||
|
frame->edit_mode = last_frame->edit_mode;
|
||||||
|
frame->equipped_tile = last_frame->equipped_tile;
|
||||||
frame->edit_camera_pos = last_frame->edit_camera_pos;
|
frame->edit_camera_pos = last_frame->edit_camera_pos;
|
||||||
frame->edit_camera_zoom = last_frame->edit_camera_zoom;
|
frame->edit_camera_zoom = last_frame->edit_camera_zoom;
|
||||||
frame->look = last_frame->look;
|
|
||||||
|
|
||||||
frame->tick = V.current_frame_tick;
|
frame->tick = V.current_frame_tick;
|
||||||
frame->time_ns = TimeNs();
|
frame->time_ns = TimeNs();
|
||||||
@ -519,6 +521,7 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
UI_Push(ChildLayoutAxis, Axis_Y);
|
UI_Push(ChildLayoutAxis, Axis_Y);
|
||||||
UI_Push(Width, UI_GROW(1, 0));
|
UI_Push(Width, UI_GROW(1, 0));
|
||||||
UI_Push(Height, UI_GROW(1, 0));
|
UI_Push(Height, UI_GROW(1, 0));
|
||||||
|
UI_SetNext(Flags, UI_BoxFlag_Interactable);
|
||||||
UI_Key vis_box = UI_KeyF("vis box");
|
UI_Key vis_box = UI_KeyF("vis box");
|
||||||
UI_Push(Parent, UI_BuildColumnEx(vis_box));
|
UI_Push(Parent, UI_BuildColumnEx(vis_box));
|
||||||
|
|
||||||
@ -587,7 +590,7 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
V_CmdNode *first_cmd_node = 0;
|
V_CmdNode *first_cmd_node = 0;
|
||||||
V_CmdNode *last_cmd_node = 0;
|
V_CmdNode *last_cmd_node = 0;
|
||||||
|
|
||||||
b32 has_focus = window_frame.has_focus && UI_MatchKey(ui_frame->hovered_box, UI_NilKey);
|
b32 has_focus = window_frame.has_focus && (UI_MatchKey(ui_frame->hovered_box, vis_box) || UI_MatchKey(ui_frame->active_box, vis_box));
|
||||||
if (!has_focus)
|
if (!has_focus)
|
||||||
{
|
{
|
||||||
ZeroStructs(frame->held_buttons, countof(frame->held_buttons));
|
ZeroStructs(frame->held_buttons, countof(frame->held_buttons));
|
||||||
@ -743,12 +746,12 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
if (m1_held)
|
if (m1_held)
|
||||||
{
|
{
|
||||||
frame->is_selecting = 1;
|
frame->is_selecting = 1;
|
||||||
frame->equipped_tile = S_TileKind_Floor;
|
// frame->equipped_tile = S_TileKind_Floor;
|
||||||
}
|
}
|
||||||
else if (m2_held)
|
else if (m2_held)
|
||||||
{
|
{
|
||||||
frame->is_selecting = 1;
|
frame->is_selecting = 1;
|
||||||
frame->equipped_tile = S_TileKind_Empty;
|
// frame->equipped_tile = S_TileKind_Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frame->is_selecting && last_frame->is_selecting)
|
if (frame->is_selecting && last_frame->is_selecting)
|
||||||
@ -962,7 +965,7 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
V_Window *active_window = 0;
|
V_Window *active_window = 0;
|
||||||
{
|
{
|
||||||
i64 window_idx = 0;
|
i64 window_idx = 0;
|
||||||
UI_SetNext(Width, UI_SHRINK(0, 1));
|
UI_SetNext(Width, UI_GROW(1, 0));
|
||||||
UI_SetNext(Height, UI_SHRINK(0, 1));
|
UI_SetNext(Height, UI_SHRINK(0, 1));
|
||||||
UI_PushCP(UI_BuildRow());
|
UI_PushCP(UI_BuildRow());
|
||||||
for (V_Window *window = panel->first_window; window; window = window->next_in_panel)
|
for (V_Window *window = panel->first_window; window; window = window->next_in_panel)
|
||||||
@ -977,7 +980,11 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
|
|
||||||
Vec4 border_color = VEC4(0.5, 0.5, 0.5, 1);
|
Vec4 border_color = VEC4(0.5, 0.5, 0.5, 1);
|
||||||
|
|
||||||
UI_BuildSpacer(UI_PIX(tab_spacing, 0), Axis_X);
|
if (window == panel->first_window)
|
||||||
|
{
|
||||||
|
UI_BuildSpacer(UI_PIX(tab_spacing, 0), Axis_X);
|
||||||
|
}
|
||||||
|
|
||||||
if (window_idx == active_window_idx)
|
if (window_idx == active_window_idx)
|
||||||
{
|
{
|
||||||
active_window = window;
|
active_window = window;
|
||||||
@ -993,33 +1000,37 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
bg_color = BlendSrgb(bg_color, hovered_color, rep.hot);
|
bg_color = BlendSrgb(bg_color, hovered_color, rep.hot);
|
||||||
bg_color = BlendSrgb(bg_color, pressed_color, rep.active * rep.hovered);
|
bg_color = BlendSrgb(bg_color, pressed_color, rep.active * rep.hovered);
|
||||||
|
|
||||||
|
String tab_name = Zi;
|
||||||
|
if (window->is_tile_window)
|
||||||
|
{
|
||||||
|
tab_name = Lit("Tiles");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tab_name = Lit("Unknown");
|
||||||
|
}
|
||||||
|
|
||||||
UI_SetNext(BackgroundColor, bg_color);
|
UI_SetNext(BackgroundColor, bg_color);
|
||||||
UI_SetNext(BorderColor, border_color);
|
UI_SetNext(BorderColor, border_color);
|
||||||
UI_SetNext(Border, 1);
|
UI_SetNext(Border, 1);
|
||||||
UI_SetNext(Width, UI_SHRINK(theme.text_padding_x, 1));
|
UI_SetNext(Width, UI_SHRINK(theme.text_padding_x, 0));
|
||||||
UI_SetNext(Height, UI_SHRINK(theme.text_padding_y, 1));
|
UI_SetNext(Height, UI_SHRINK(theme.text_padding_y, 0));
|
||||||
UI_SetNext(ChildAlignment, UI_Alignment_Center);
|
UI_SetNext(ChildAlignment, UI_Alignment_Center);
|
||||||
UI_SetNext(Flags, UI_BoxFlag_Interactable);
|
UI_SetNext(Flags, UI_BoxFlag_DrawText | UI_BoxFlag_Interactable);
|
||||||
|
UI_SetNext(Text, tab_name);
|
||||||
UI_PushCP(UI_BuildRowEx(window->key));
|
UI_PushCP(UI_BuildRowEx(window->key));
|
||||||
{
|
{
|
||||||
if (window->is_tile_window)
|
|
||||||
{
|
|
||||||
UI_BuildLabelF("Tiles");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UI_BuildLabelF("Unknown");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
UI_PopCP(UI_TopCP());
|
UI_PopCP(UI_TopCP());
|
||||||
|
|
||||||
|
UI_BuildSpacer(UI_PIX(tab_spacing, 0), Axis_X);
|
||||||
}
|
}
|
||||||
window_idx += 1;
|
window_idx += 1;
|
||||||
}
|
}
|
||||||
UI_PopCP(UI_TopCP());
|
UI_PopCP(UI_TopCP());
|
||||||
}
|
}
|
||||||
//- Build active window
|
//- Build active window
|
||||||
if (active_window && !active_window->is_viewport_window)
|
if (active_window)
|
||||||
{
|
{
|
||||||
V_Window *window = active_window;
|
V_Window *window = active_window;
|
||||||
UI_SetNext(BackgroundColor, VEC4(0, 0, 0, 0.5));
|
UI_SetNext(BackgroundColor, VEC4(0, 0, 0, 0.5));
|
||||||
@ -1033,12 +1044,43 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
// UI_SetNext(Height, UI_SHRINK(0, 1));
|
// UI_SetNext(Height, UI_SHRINK(0, 1));
|
||||||
UI_PushCP(UI_BuildColumn());
|
UI_PushCP(UI_BuildColumn());
|
||||||
{
|
{
|
||||||
|
UI_Push(Tag, window->key.hash);
|
||||||
if (window->is_tile_window)
|
if (window->is_tile_window)
|
||||||
{
|
{
|
||||||
for (S_TileKind tile_kind = 0; tile_kind < S_TileKind_Count; ++tile_kind)
|
for (S_TileKind tile_kind = 0; tile_kind < S_TileKind_Count; ++tile_kind)
|
||||||
{
|
{
|
||||||
String name = S_NameFromTileKind(tile_kind);
|
String name = S_NameFromTileKind(tile_kind);
|
||||||
UI_BuildLabel(name);
|
UI_Key key = UI_KeyF("Tile %F", FmtString(name));
|
||||||
|
UI_Report rep = UI_ReportFromKey(key);
|
||||||
|
|
||||||
|
if (rep.m1_downs)
|
||||||
|
{
|
||||||
|
frame->equipped_tile = tile_kind;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vec4 hovered_color = VEC4(0.5, 0.7, 0, 0.25);
|
||||||
|
Vec4 bg_color = hovered_color;
|
||||||
|
bg_color.w *= MaxF32(rep.hot, rep.active);
|
||||||
|
|
||||||
|
Vec4 border_color = VEC4(1, 1, 0, 0.5);
|
||||||
|
border_color.w *= tile_kind == frame->equipped_tile;
|
||||||
|
|
||||||
|
UI_SetNext(BackgroundColor, bg_color);
|
||||||
|
UI_SetNext(BorderColor, border_color);
|
||||||
|
UI_SetNext(Border, 1);
|
||||||
|
UI_SetNext(Width, UI_GROW(1, 0));
|
||||||
|
UI_SetNext(Height, UI_SHRINK(0, 0));
|
||||||
|
UI_SetNext(Flags, UI_BoxFlag_Interactable);
|
||||||
|
UI_PushCP(UI_BuildRowEx(key));
|
||||||
|
{
|
||||||
|
UI_SetNext(ChildAlignment, UI_Alignment_Center);
|
||||||
|
UI_SetNext(Text, name);
|
||||||
|
UI_SetNext(Flags, UI_BoxFlag_DrawText);
|
||||||
|
UI_SetNext(Width, UI_SHRINK(4, 0));
|
||||||
|
UI_SetNext(Height, UI_SHRINK(2, 0));
|
||||||
|
UI_BuildRow();
|
||||||
|
}
|
||||||
|
UI_PopCP(UI_TopCP());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1071,10 +1113,10 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
bg_color = BlendSrgb(bg_color, pressed_color, rep.active * rep.hovered);
|
bg_color = BlendSrgb(bg_color, pressed_color, rep.active * rep.hovered);
|
||||||
|
|
||||||
UI_SetNext(Flags, UI_BoxFlag_Interactable);
|
UI_SetNext(Flags, UI_BoxFlag_Interactable);
|
||||||
UI_SetNext(BackgroundColor, bg_color);
|
// UI_SetNext(BackgroundColor, bg_color);
|
||||||
// UI_SetNext(Border, 2);
|
// UI_SetNext(Border, 2);
|
||||||
UI_SetNext(AxisSize, UI_GROW(1, 1), .axis = panel->axis);
|
UI_SetNext(AxisSize, UI_GROW(1, 1), .axis = panel->axis);
|
||||||
UI_SetNext(AxisSize, UI_PIX(3, 1), .axis = !panel->axis);
|
UI_SetNext(AxisSize, UI_PIX(10, 1), .axis = !panel->axis);
|
||||||
UI_BuildBoxEx(divider_key);
|
UI_BuildBoxEx(divider_key);
|
||||||
|
|
||||||
if (rep.is_hovered || rep.is_m1_held)
|
if (rep.is_hovered || rep.is_m1_held)
|
||||||
@ -1679,6 +1721,13 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- End frame
|
//- End frame
|
||||||
|
|
||||||
|
{
|
||||||
|
Arena *old_arena = sim_output->arena;
|
||||||
|
ZeroStruct(sim_output);
|
||||||
|
sim_output->arena = old_arena;
|
||||||
|
ResetArena(sim_output->arena);
|
||||||
|
}
|
||||||
|
|
||||||
G_CommitCommandList(frame->cl);
|
G_CommitCommandList(frame->cl);
|
||||||
|
|
||||||
UI_EndFrame(ui_frame);
|
UI_EndFrame(ui_frame);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user