display sprite as part of ui box background
This commit is contained in:
parent
f9c69779ea
commit
d7b7f8dfca
@ -2753,7 +2753,7 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
V_Window *window = PushStruct(perm, V_Window);
|
V_Window *window = PushStruct(perm, V_Window);
|
||||||
window->panel = panel;
|
window->panel = panel;
|
||||||
window->key = UI_RandKey(); // TODO: Don't use random keys
|
window->key = UI_RandKey(); // TODO: Don't use random keys
|
||||||
window->is_spawn_window = 1;
|
window->is_ent_window = 1;
|
||||||
DllQueuePushNP(panel->first_window, panel->last_window, window, next_in_panel, prev_in_panel);
|
DllQueuePushNP(panel->first_window, panel->last_window, window, next_in_panel, prev_in_panel);
|
||||||
++panel->windows_count;
|
++panel->windows_count;
|
||||||
++V.windows_count;
|
++V.windows_count;
|
||||||
@ -3077,9 +3077,9 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
{
|
{
|
||||||
tab_name = Lit("Tiles");
|
tab_name = Lit("Tiles");
|
||||||
}
|
}
|
||||||
else if (window->is_spawn_window)
|
else if (window->is_ent_window)
|
||||||
{
|
{
|
||||||
tab_name = Lit("Spawn");
|
tab_name = Lit("Entities");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3311,12 +3311,14 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
UI_SetNext(BorderColor, border_color);
|
UI_SetNext(BorderColor, border_color);
|
||||||
UI_SetNext(BorderSize, 1);
|
UI_SetNext(BorderSize, 1);
|
||||||
UI_SetNext(Width, UI_GROW(1, 0));
|
UI_SetNext(Width, UI_GROW(1, 0));
|
||||||
UI_SetNext(Height, UI_SHRINK(0, 0));
|
UI_SetNext(Height, UI_SHRINK(UI_FNT(0.25, 0).v, 0));
|
||||||
UI_SetNext(Misc, is_selected);
|
UI_SetNext(Misc, is_selected);
|
||||||
UI_SetNext(Flags, UI_BoxFlag_CaptureMouse);
|
UI_SetNext(Flags, UI_BoxFlag_CaptureMouse);
|
||||||
UI_SetNext(ChildAlignment, UI_Region_Left);
|
UI_SetNext(ChildAlignment, UI_Region_Left);
|
||||||
UI_PushCP(UI_BuildRowEx(key));
|
UI_PushCP(UI_BuildRowEx(key));
|
||||||
{
|
{
|
||||||
|
UI_BuildSpacer(UI_FNT(0.25, 0), Axis_X);
|
||||||
|
|
||||||
// Tile sprite
|
// Tile sprite
|
||||||
{
|
{
|
||||||
String sheet_name = StringF(frame->arena, "tile/%F.ase", FmtString(tile_name));
|
String sheet_name = StringF(frame->arena, "tile/%F.ase", FmtString(tile_name));
|
||||||
@ -3324,11 +3326,14 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
SPR_SheetKey sheet = SPR_SheetKeyFromResource(sheet_resource);
|
SPR_SheetKey sheet = SPR_SheetKeyFromResource(sheet_resource);
|
||||||
|
|
||||||
UI_SetNext(ChildAlignment, UI_Region_Center);
|
UI_SetNext(ChildAlignment, UI_Region_Center);
|
||||||
UI_SetNext(Width, UI_SHRINK(4, 0));
|
UI_SetNext(Width, UI_FNT(2.5, 0));
|
||||||
UI_SetNext(Height, UI_SHRINK(4, 0));
|
UI_SetNext(Height, UI_FNT(2.5, 0));
|
||||||
UI_SetNext(SpriteSheet, sheet);
|
UI_SetNext(SpriteSheet, sheet);
|
||||||
UI_BuildRow();
|
UI_BuildRow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UI_BuildSpacer(UI_FNT(0.5, 0), Axis_X);
|
||||||
|
|
||||||
// Tile name
|
// Tile name
|
||||||
{
|
{
|
||||||
UI_SetNext(ChildAlignment, UI_Region_Center);
|
UI_SetNext(ChildAlignment, UI_Region_Center);
|
||||||
@ -3346,7 +3351,7 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- Build spawn window
|
//- Build spawn window
|
||||||
|
|
||||||
if (window->is_spawn_window)
|
if (window->is_ent_window)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4008,9 +4013,14 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
}
|
}
|
||||||
UI_BuildSpacer(UI_PIX(padding, 1), Axis_Y);
|
UI_BuildSpacer(UI_PIX(padding, 1), Axis_Y);
|
||||||
{
|
{
|
||||||
|
UI_BuildLabelF("Screen dims: %F", FmtFloat2(frame->screen_dims));
|
||||||
UI_BuildLabelF("Shade dims: %F", FmtFloat2(frame->shade_dims));
|
UI_BuildLabelF("Shade dims: %F", FmtFloat2(frame->shade_dims));
|
||||||
}
|
}
|
||||||
UI_BuildSpacer(UI_PIX(padding, 1), Axis_Y);
|
UI_BuildSpacer(UI_PIX(padding, 1), Axis_Y);
|
||||||
|
{
|
||||||
|
UI_BuildLabelF("Particle seq: %F", FmtFloat(V.particle_seq));
|
||||||
|
}
|
||||||
|
UI_BuildSpacer(UI_PIX(padding, 1), Axis_Y);
|
||||||
{
|
{
|
||||||
UI_BuildLabelF("RTT: %Fms", FmtFloat(smoothed_rtt * 1000, .p = 3));
|
UI_BuildLabelF("RTT: %Fms", FmtFloat(smoothed_rtt * 1000, .p = 3));
|
||||||
UI_BuildLabelF("Client send: %F MiB", FmtFloat(CeilF64((f64)vis_pipe_stats.total_bytes_sent / 1024) / 1024, .p = 3));
|
UI_BuildLabelF("Client send: %F MiB", FmtFloat(CeilF64((f64)vis_pipe_stats.total_bytes_sent / 1024) / 1024, .p = 3));
|
||||||
|
|||||||
@ -202,7 +202,7 @@ Struct(V_Window)
|
|||||||
UI_Key key;
|
UI_Key key;
|
||||||
|
|
||||||
b32 is_tile_window;
|
b32 is_tile_window;
|
||||||
b32 is_spawn_window;
|
b32 is_ent_window;
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@ -523,7 +523,11 @@ PixelShader(V_CompositePS, V_CompositePSOutput, V_CompositePSInput input)
|
|||||||
//- Tile selection overlay
|
//- Tile selection overlay
|
||||||
|
|
||||||
Vec4 selection_color = 0;
|
Vec4 selection_color = 0;
|
||||||
if (frame.has_mouse_focus && frame.selection_mode == V_SelectionMode_Tile)
|
if (
|
||||||
|
frame.has_mouse_focus &&
|
||||||
|
frame.selection_mode == V_SelectionMode_Tile &&
|
||||||
|
is_in_world
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Vec4 border_color = LinearFromSrgb(Vec4(1, 1, 1, 1));
|
Vec4 border_color = LinearFromSrgb(Vec4(1, 1, 1, 1));
|
||||||
// Vec4 inner_color = LinearFromSrgb(Vec4(0.4, 0.4, 0.4, 0.25));
|
// Vec4 inner_color = LinearFromSrgb(Vec4(0.4, 0.4, 0.4, 0.25));
|
||||||
|
|||||||
@ -1561,57 +1561,16 @@ void UI_EndFrame(UI_Frame *frame, i32 vsync)
|
|||||||
rect->tr_rounding = box->rounding_tr;
|
rect->tr_rounding = box->rounding_tr;
|
||||||
rect->br_rounding = box->rounding_br;
|
rect->br_rounding = box->rounding_br;
|
||||||
rect->bl_rounding = box->rounding_bl;
|
rect->bl_rounding = box->rounding_bl;
|
||||||
rect->tex = box->raw_texture;
|
if (!G_IsRefNil(box->raw_texture))
|
||||||
rect->tex_slice_uv = box->raw_texture_slice_uv;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sprite rect
|
|
||||||
if (!SPR_IsSheetKeyNil(box->desc.sprite_sheet))
|
|
||||||
{
|
|
||||||
UI_GpuRect *rect = PushStruct(frame->rects_arena, UI_GpuRect);
|
|
||||||
rect->debug_lin = debug_lin;
|
|
||||||
rect->tint_lin = tint_lin;
|
|
||||||
rect->tex = box->sprite.tex;
|
|
||||||
rect->tex_slice_uv = DivRng2Vec2(box->sprite.tex_rect, box->sprite.tex_dims);
|
|
||||||
|
|
||||||
Vec2 dims = DimsFromRng2(box->sprite.tex_rect);
|
|
||||||
Vec2 pos = Zi;
|
|
||||||
switch (x_alignment)
|
|
||||||
{
|
{
|
||||||
case UI_AxisRegion_Start:
|
rect->tex = box->raw_texture;
|
||||||
{
|
rect->tex_slice_uv = box->raw_texture_slice_uv;
|
||||||
pos.x = box->screen_rect.p0.x;
|
|
||||||
} break;
|
|
||||||
case UI_AxisRegion_End:
|
|
||||||
{
|
|
||||||
pos.x = box->screen_rect.p1.x;
|
|
||||||
pos.x -= dims.x;
|
|
||||||
} break;
|
|
||||||
case UI_AxisRegion_Center:
|
|
||||||
{
|
|
||||||
pos.x = box->screen_rect.p0.x;
|
|
||||||
pos.x += (box_dims.x - dims.x) / 2;
|
|
||||||
} break;
|
|
||||||
}
|
}
|
||||||
switch (y_alignment)
|
else if (!SPR_IsSheetKeyNil(box->desc.sprite_sheet))
|
||||||
{
|
{
|
||||||
case UI_AxisRegion_Start:
|
rect->tex = box->sprite.tex;
|
||||||
{
|
rect->tex_slice_uv = DivRng2Vec2(box->sprite.tex_rect, box->sprite.tex_dims);
|
||||||
pos.y = box->screen_rect.p0.y;
|
|
||||||
} break;
|
|
||||||
case UI_AxisRegion_End:
|
|
||||||
{
|
|
||||||
pos.y = box->screen_rect.p1.y;
|
|
||||||
pos.y -= dims.y;
|
|
||||||
} break;
|
|
||||||
case UI_AxisRegion_Center:
|
|
||||||
{
|
|
||||||
pos.y = box->screen_rect.p0.y;
|
|
||||||
pos.y += (box_dims.y - dims.y) / 2;
|
|
||||||
} break;
|
|
||||||
}
|
}
|
||||||
rect->bounds.p0 = pos;
|
|
||||||
rect->bounds.p1 = AddVec2(rect->bounds.p0, dims);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Text rects
|
// Text rects
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user