render game ui in viewport panel. ui defer-for helpers.
This commit is contained in:
parent
ee3ffdb02a
commit
99a0da468a
File diff suppressed because it is too large
Load Diff
@ -258,7 +258,8 @@ Struct(V_Panel)
|
||||
Axis axis;
|
||||
|
||||
b32 is_organizing_panel;
|
||||
b32 is_viewport_panel;
|
||||
b32 is_vis_ui_panel;
|
||||
b32 is_editor_panel;
|
||||
|
||||
i64 active_window_idx;
|
||||
i64 windows_count;
|
||||
|
||||
@ -271,7 +271,7 @@ String UI_StringF_(String fmt, ...)
|
||||
////////////////////////////////////////////////////////////
|
||||
//~ Checkpoint helpers
|
||||
|
||||
UI_Checkpoint UI_PushCP(UI_Key parent)
|
||||
UI_Checkpoint UI_PushCp(UI_Key parent)
|
||||
{
|
||||
UI_Frame *frame = UI_CurrentFrame();
|
||||
UI_Stack *stack = frame->top_stack;
|
||||
@ -283,7 +283,7 @@ UI_Checkpoint UI_PushCP(UI_Key parent)
|
||||
return stack->top_checkpoint;
|
||||
}
|
||||
|
||||
void UI_PopCP(UI_Checkpoint cp)
|
||||
void UI_PopCp(UI_Checkpoint cp)
|
||||
{
|
||||
UI_Frame *frame = UI_CurrentFrame();
|
||||
UI_Stack *stack = frame->top_stack;
|
||||
@ -302,7 +302,7 @@ void UI_PopCP(UI_Checkpoint cp)
|
||||
stack->top_checkpoint.v = cp.v - 1;
|
||||
}
|
||||
|
||||
UI_Checkpoint UI_TopCP(void)
|
||||
UI_Checkpoint UI_TopCp(void)
|
||||
{
|
||||
UI_Frame *frame = UI_CurrentFrame();
|
||||
UI_Stack *stack = frame->top_stack;
|
||||
|
||||
@ -158,7 +158,7 @@ Enum(UI_DebugBreakFlag)
|
||||
|
||||
Enum(UI_StyleKind)
|
||||
{
|
||||
#define X(name, type) UI_StyleKind_##name,
|
||||
#define X(name, type) CAT(UI_StyleKind_,name),
|
||||
UI_StyleKind_None,
|
||||
UI_StyleKindsXList(X)
|
||||
UI_StyleKind_COUNT,
|
||||
@ -479,14 +479,6 @@ UI_BoxIterResult UI_NextBox(Arena *arena, UI_BoxIter *iter);
|
||||
String UI_StringF_(String fmt, ...);
|
||||
#define UI_StringF(fmt_cstr, ...) UI_StringF_(StringFromCstrNoLimit(fmt_cstr), __VA_ARGS__, FmtEnd)
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//~ Checkpoint helpers
|
||||
|
||||
UI_Checkpoint UI_PushCP(UI_Key parent);
|
||||
void UI_PopCP(UI_Checkpoint pop_to);
|
||||
|
||||
UI_Checkpoint UI_TopCP(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//~ Style stack helpers
|
||||
|
||||
@ -495,7 +487,7 @@ void UI_PushDefaults(void);
|
||||
void UI_PushStyle(UI_StyleDesc desc);
|
||||
UI_Style UI_PopStyle(UI_StyleDesc desc);
|
||||
|
||||
#define UI_STYLEDESC(name, ...) (UI_StyleDesc) { .style.kind = UI_StyleKind_##name, __VA_ARGS__ }
|
||||
#define UI_STYLEDESC(name, ...) (UI_StyleDesc) { .style.kind = CAT(UI_StyleKind_,name), __VA_ARGS__ }
|
||||
|
||||
#define UI_SetNext(name, ...) UI_PushStyle(UI_STYLEDESC(name, .pop_when_used = 1, .style.name = __VA_ARGS__))
|
||||
#define UI_Push(name, ...) UI_PushStyle(UI_STYLEDESC(name, .style.name = __VA_ARGS__))
|
||||
@ -505,13 +497,23 @@ UI_Style UI_PopStyle(UI_StyleDesc desc);
|
||||
#define UI_PeekTop(name, ...) UI_PopStyle(UI_STYLEDESC(name, __VA_ARGS__)).name
|
||||
#define UI_Top(name, ...) UI_PopStyle(UI_STYLEDESC(name, .use = 1, __VA_ARGS__)).name
|
||||
|
||||
#define UI_PushDF(name, ...) DeferFor(UI_Push(name, __VA_ARGS__), UI_Pop(name))
|
||||
|
||||
#define UI_PushCopy(name, src, ...) do { \
|
||||
UI_StyleDesc _new = src; \
|
||||
_new.style.kind = UI_StyleKind_##name; \
|
||||
_new.style.kind = CAT(UI_StyleKind_,name); \
|
||||
_new.style.name = __VA_ARGS__; \
|
||||
UI_PushStyle(_new); \
|
||||
} while (0)
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//~ Checkpoint helpers
|
||||
|
||||
UI_Checkpoint UI_PushCp(UI_Key parent);
|
||||
void UI_PopCp(UI_Checkpoint pop_to);
|
||||
|
||||
UI_Checkpoint UI_TopCp(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//~ Size helpers
|
||||
|
||||
@ -535,6 +537,7 @@ UI_Style UI_PopStyle(UI_StyleDesc desc);
|
||||
|
||||
UI_Key UI_BuildBoxEx(UI_Key semantic_key);
|
||||
#define UI_BuildBox() UI_BuildBoxEx(UI_NilKey)
|
||||
#define UI_BuildBoxF(...) UI_BuildBoxEx(UI_KeyF(__VA_ARGS__))
|
||||
|
||||
void UI_SetRawTexture(UI_Key key, G_TextureRef tex, Rng2 uv);
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ UI_Key UI_BuildLabel(String text)
|
||||
UI_Region alignment = UI_Top(ChildAlignment);
|
||||
|
||||
UI_Key key = Zi;
|
||||
UI_PushCP(UI_NilKey);
|
||||
UI_PushCp(UI_NilKey);
|
||||
{
|
||||
UI_PushDefaults();
|
||||
UI_Push(Parent, parent);
|
||||
@ -41,7 +41,7 @@ UI_Key UI_BuildLabel(String text)
|
||||
UI_Push(Flags, UI_BoxFlag_DrawText);
|
||||
key = UI_BuildBox();
|
||||
}
|
||||
UI_PopCP(UI_TopCP());
|
||||
UI_PopCp(UI_TopCp());
|
||||
return key;
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ UI_Key UI_BuildSpacer(UI_Size size, Axis axis)
|
||||
UI_Key parent = UI_Top(Parent);
|
||||
UI_Key key = Zi;
|
||||
Vec2 scale = UI_Top(Scale);
|
||||
UI_PushCP(UI_NilKey);
|
||||
UI_PushCp(UI_NilKey);
|
||||
{
|
||||
UI_PushDefaults();
|
||||
UI_Push(Parent, parent);
|
||||
@ -90,7 +90,7 @@ UI_Key UI_BuildSpacer(UI_Size size, Axis axis)
|
||||
UI_Push(AxisSize, size, .axis = axis);
|
||||
key = UI_BuildBox();
|
||||
}
|
||||
UI_PopCP(UI_TopCP());
|
||||
UI_PopCp(UI_TopCp());
|
||||
return key;
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ UI_Key UI_BuildDivider(UI_Size size, Vec4 color, Axis axis)
|
||||
UI_Key parent = UI_Top(Parent);
|
||||
Vec2 scale = UI_Top(Scale);
|
||||
Vec4 tint = UI_Top(Tint);
|
||||
UI_PushCP(UI_NilKey);
|
||||
UI_PushCp(UI_NilKey);
|
||||
{
|
||||
UI_PushDefaults();
|
||||
UI_Push(Parent, parent);
|
||||
@ -111,7 +111,7 @@ UI_Key UI_BuildDivider(UI_Size size, Vec4 color, Axis axis)
|
||||
UI_Push(AxisSize, size, .axis = axis);
|
||||
key = UI_BuildBox();
|
||||
}
|
||||
UI_PopCP(UI_TopCP());
|
||||
UI_PopCp(UI_TopCp());
|
||||
return key;
|
||||
}
|
||||
|
||||
|
||||
@ -31,3 +31,6 @@ UI_Key UI_BuildColumnEx(UI_Key key);
|
||||
|
||||
#define UI_BuildRow() UI_BuildRowEx(UI_NilKey)
|
||||
#define UI_BuildColumn() UI_BuildColumnEx(UI_NilKey)
|
||||
|
||||
#define UI_BuildRowF(...) UI_BuildRowEx(UI_KeyF(__VA_ARGS__))
|
||||
#define UI_BuildColumnF(...) UI_BuildColumnEx(UI_KeyF(__VA_ARGS__))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user