more ui rounding fixes
This commit is contained in:
parent
0ab934c4bb
commit
bbbb0f63d3
@ -1984,7 +1984,7 @@ void PP_UpdateUser(void)
|
||||
UI_Push(ChildLayoutAxis, Axis_Y);
|
||||
UI_Push(FloatingPos, g->lister_pos);
|
||||
UI_SetNext(Flags, UI_BoxFlag_Floating);
|
||||
g->lister_key = UI_PushCP(UI_BuildBox(HashF("lister")))->key;
|
||||
UI_PushCP(UI_BuildBox(HashF("lister")));
|
||||
{
|
||||
/* Title bar */
|
||||
UI_PushCP(0);
|
||||
@ -1995,7 +1995,8 @@ void PP_UpdateUser(void)
|
||||
UI_Push(ChildLayoutAxis, Axis_X);
|
||||
UI_Push(Width, UI_FILL(1, 0));
|
||||
UI_Push(Height, UI_FNT(2, 0));
|
||||
UI_PushCP(UI_BuildBox(0));
|
||||
UI_SetNext(Flags, UI_BoxFlag_DrawText | UI_BoxFlag_DrawHotEffects | UI_BoxFlag_DrawActiveEffects);
|
||||
g->lister_key = UI_PushCP(UI_BuildBox(HashF("title bar")))->key;
|
||||
{
|
||||
UI_Push(Width, UI_FILL(1, 0));
|
||||
|
||||
|
||||
@ -550,20 +550,19 @@ UI_Frame UI_BeginFrame(UI_FrameFlag frame_flags)
|
||||
{
|
||||
active_box = box;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Update state from controller events */
|
||||
/* Update cursor pos */
|
||||
for (u64 cev_index = 0; cev_index < controller_events.count; ++cev_index)
|
||||
{
|
||||
ControllerEvent cev = controller_events.events[cev_index];
|
||||
switch (cev.kind)
|
||||
{
|
||||
default: break;
|
||||
|
||||
case ControllerEventKind_CursorMove:
|
||||
if (cev.kind == ControllerEventKind_CursorMove)
|
||||
{
|
||||
g->cursor_pos = Vec2FromFields(cev.cursor_pos);
|
||||
}
|
||||
}
|
||||
|
||||
/* Update hovered box */
|
||||
if (hovered_box)
|
||||
{
|
||||
hovered_box->report.flags &= ~UI_ReportFlag_Hovered;
|
||||
@ -582,7 +581,14 @@ UI_Frame UI_BeginFrame(UI_FrameFlag frame_flags)
|
||||
}
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
||||
/* Update state from controller events */
|
||||
for (u64 cev_index = 0; cev_index < controller_events.count; ++cev_index)
|
||||
{
|
||||
ControllerEvent cev = controller_events.events[cev_index];
|
||||
switch (cev.kind)
|
||||
{
|
||||
default: break;
|
||||
|
||||
case ControllerEventKind_ButtonDown:
|
||||
{
|
||||
@ -1046,8 +1052,10 @@ i64 UI_EndFrame(UI_Frame frame)
|
||||
}
|
||||
|
||||
/* Submit position */
|
||||
box->p0 = RoundVec2(final_pos);
|
||||
box->p1 = RoundVec2(AddVec2(final_pos, CeilVec2(dims_vec)));
|
||||
Vec2 floored_final_pos = FloorVec2(final_pos);
|
||||
Vec2 ceiled_dims = CeilVec2(dims_vec);
|
||||
box->p0 = FloorVec2(floored_final_pos);
|
||||
box->p1 = AddVec2(floored_final_pos, ceiled_dims);
|
||||
box->report.screen_p0 = box->p0;
|
||||
box->report.screen_p1 = box->p1;
|
||||
}
|
||||
@ -1252,7 +1260,7 @@ i64 UI_EndFrame(UI_Frame frame)
|
||||
baseline.y += baseline_height / 4;
|
||||
} break;
|
||||
}
|
||||
baseline = RoundVec2(baseline);
|
||||
baseline = CeilVec2(baseline);
|
||||
|
||||
|
||||
/* Push text rects */
|
||||
|
||||
@ -82,9 +82,11 @@ Enum(UI_BoxFlag)
|
||||
{
|
||||
UI_BoxFlag_None = 0,
|
||||
UI_BoxFlag_DrawText = (1 << 0),
|
||||
UI_BoxFlag_NoTextTruncation = (1 << 1),
|
||||
UI_BoxFlag_Floating = (1 << 2),
|
||||
UI_BoxFlag_NoFloatingClamp = (1 << 3),
|
||||
UI_BoxFlag_DrawHotEffects = (1 << 1),
|
||||
UI_BoxFlag_DrawActiveEffects = (1 << 2),
|
||||
UI_BoxFlag_NoTextTruncation = (1 << 3),
|
||||
UI_BoxFlag_Floating = (1 << 4),
|
||||
UI_BoxFlag_NoFloatingClamp = (1 << 5),
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -190,6 +192,9 @@ Struct(UI_Report)
|
||||
UI_ReportFlag flags;
|
||||
Vec2 activation_offset;
|
||||
|
||||
f32 hot_ratio;
|
||||
f32 active_ratio;
|
||||
|
||||
Vec2 screen_p0;
|
||||
Vec2 screen_p1;
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user