round glyph advances
This commit is contained in:
parent
4982d60647
commit
ad56fafeff
@ -65,6 +65,22 @@ S_Key S_RandKey(void)
|
||||
////////////////////////////////////////////////////////////
|
||||
//~ Tile helpers
|
||||
|
||||
String S_NameFromTileKind(S_TileKind kind)
|
||||
{
|
||||
/* Tile names array */
|
||||
#define X(name, ...) [S_TileKind_##name] = CompLit(#name),
|
||||
PERSIST Readonly String tile_names[] = {
|
||||
S_TilesXMacro(X)
|
||||
};
|
||||
#undef X
|
||||
String result = Lit("Unknown");
|
||||
if (kind >= 0 && kind < countof(tile_names))
|
||||
{
|
||||
result = tile_names[kind];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Rng2I32 S_UpdateTilesInPlaceFromPlacement(u8 *tiles, S_TilePlacement placement)
|
||||
{
|
||||
Rng2I32 dirty_rect = Zi;
|
||||
|
||||
@ -238,6 +238,7 @@ S_Key S_RandKey(void);
|
||||
////////////////////////////////////////////////////////////
|
||||
//~ Tile helpers
|
||||
|
||||
String S_NameFromTileKind(S_TileKind kind);
|
||||
Rng2I32 S_UpdateTilesInPlaceFromPlacement(u8 *tiles, S_TilePlacement placement);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
@ -3,12 +3,20 @@
|
||||
|
||||
#define S_WorldSize 128
|
||||
|
||||
#define S_TilesXMacro(X) \
|
||||
X(Empty) \
|
||||
X(Floor) \
|
||||
X(Wall) \
|
||||
/* -------------------- */
|
||||
|
||||
/* Tiles enum */
|
||||
#define X(name, ...) S_TileKind_##name,
|
||||
Enum(S_TileKind)
|
||||
{
|
||||
S_TileKind_None,
|
||||
S_TileKind_Floor,
|
||||
S_TileKind_Wall,
|
||||
S_TilesXMacro(X)
|
||||
S_TileKind_Count
|
||||
};
|
||||
#undef X
|
||||
|
||||
Enum(S_TilePlacementKind)
|
||||
{
|
||||
|
||||
@ -63,21 +63,8 @@ V_WidgetTheme V_GetWidgetTheme(void)
|
||||
// theme.font = GC_FontKeyFromResource(ResourceKeyFromStore(&V_Resources, Lit("font/fixedsys.ttf")));
|
||||
// theme.font_size = 16;
|
||||
|
||||
// theme.font = GC_FontKeyFromResource(ResourceKeyFromStore(&V_Resources, Lit("font/fixedsys.ttf")));
|
||||
// theme.font_size = 64;
|
||||
|
||||
// theme.font = GC_FontKeyFromResource(ResourceKeyFromStore(&V_Resources, Lit("font/OpenSans-Regular.ttf")));
|
||||
// theme.font_size = 18;
|
||||
|
||||
// theme.font = GC_FontKeyFromResource(ResourceKeyFromStore(&V_Resources, Lit("font/roboto-med.ttf")));
|
||||
// theme.font_size = 18;
|
||||
|
||||
// theme.font = GC_FontKeyFromResource(ResourceKeyFromStore(&V_Resources, Lit("font/SegoeUI.ttf")));
|
||||
// theme.font_size = 18;
|
||||
|
||||
|
||||
theme.font = GC_FontKeyFromResource(ResourceKeyFromStore(&V_Resources, Lit("font/roboto-med.ttf")));
|
||||
theme.font_size = 100;
|
||||
theme.font = GC_FontKeyFromResource(ResourceKeyFromStore(&V_Resources, Lit("font/seguisb.ttf")));
|
||||
theme.font_size = 16;
|
||||
|
||||
theme.window_background_color = Rgb32(0xff1a1d1e);
|
||||
theme.window_border_color = Rgb32(0xff343a3b);
|
||||
@ -87,8 +74,8 @@ V_WidgetTheme V_GetWidgetTheme(void)
|
||||
theme.divider_color = theme.window_border_color;
|
||||
|
||||
theme.window_title_font_size = 16;
|
||||
theme.text_padding_x = 3;
|
||||
theme.text_padding_y = 3;
|
||||
theme.text_padding_x = 5;
|
||||
theme.text_padding_y = 5;
|
||||
|
||||
return theme;
|
||||
}
|
||||
@ -756,7 +743,7 @@ void V_TickForever(WaveLaneCtx *lane)
|
||||
else if (m2_held)
|
||||
{
|
||||
frame->is_selecting = 1;
|
||||
frame->equipped_tile = S_TileKind_None;
|
||||
frame->equipped_tile = S_TileKind_Empty;
|
||||
}
|
||||
|
||||
if (frame->is_selecting && last_frame->is_selecting)
|
||||
@ -809,6 +796,9 @@ void V_TickForever(WaveLaneCtx *lane)
|
||||
space->axis = Axis_X;
|
||||
V.root_space = space;
|
||||
|
||||
space->pref_size[Axis_X] = UI_GROW(1, 0);
|
||||
space->pref_size[Axis_Y] = UI_GROW(1, 0);
|
||||
|
||||
{
|
||||
V_Panel *panel = PushStruct(perm, V_Panel);
|
||||
panel->space = space;
|
||||
@ -847,20 +837,20 @@ void V_TickForever(WaveLaneCtx *lane)
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
V_Panel *panel = PushStruct(perm, V_Panel);
|
||||
panel->space = space;
|
||||
DllQueuePushNP(space->first_panel, space->last_panel, panel, next_in_space, prev_in_space);
|
||||
++space->panels_count;
|
||||
// {
|
||||
// V_Panel *panel = PushStruct(perm, V_Panel);
|
||||
// panel->space = space;
|
||||
// DllQueuePushNP(space->first_panel, space->last_panel, panel, next_in_space, prev_in_space);
|
||||
// ++space->panels_count;
|
||||
|
||||
{
|
||||
V_Window *window = PushStruct(perm, V_Window);
|
||||
window->panel = panel;
|
||||
// window->is_tile_window = 1;
|
||||
DllQueuePushNP(panel->first_window, panel->last_window, window, next_in_panel, prev_in_panel);
|
||||
++panel->windows_count;
|
||||
}
|
||||
}
|
||||
// {
|
||||
// V_Window *window = PushStruct(perm, V_Window);
|
||||
// window->panel = panel;
|
||||
// // window->is_tile_window = 1;
|
||||
// DllQueuePushNP(panel->first_window, panel->last_window, window, next_in_panel, prev_in_panel);
|
||||
// ++panel->windows_count;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
if (frame->is_editing)
|
||||
@ -885,6 +875,8 @@ void V_TickForever(WaveLaneCtx *lane)
|
||||
}
|
||||
|
||||
UI_Key space_key = UI_TransKey();
|
||||
UI_SetNext(Width, space->pref_size[Axis_X]);
|
||||
UI_SetNext(Width, space->pref_size[Axis_Y]);
|
||||
if (space->axis == Axis_X)
|
||||
{
|
||||
UI_BuildRowEx(space_key);
|
||||
@ -899,20 +891,24 @@ void V_TickForever(WaveLaneCtx *lane)
|
||||
for (V_Panel *panel = space->first_panel; panel; panel = panel->next_in_space)
|
||||
{
|
||||
// UI_SetNext(Width, UI_SHRINK(0, 1));
|
||||
UI_SetNext(Width, UI_GROW(1, 0));
|
||||
UI_SetNext(Height, UI_GROW(1, 0));
|
||||
UI_PushCP(UI_BuildColumn());
|
||||
{
|
||||
i64 active_window_idx = ClampI64(panel->active_window_idx, 0, MaxI64(panel->windows_count - 1, 0));
|
||||
//- Build panel window tabs
|
||||
f32 tab_spacing = 10;
|
||||
V_Window *active_window = 0;
|
||||
{
|
||||
UI_SetNext(Width, UI_SHRINK(0, 1));
|
||||
UI_SetNext(Height, UI_SHRINK(0, 1));
|
||||
UI_SetNext(Width, UI_SHRINK(0, 0));
|
||||
UI_SetNext(Height, UI_SHRINK(0, 0));
|
||||
UI_PushCP(UI_BuildRow());
|
||||
i64 window_idx = 0;
|
||||
for (V_Window *window = panel->first_window; window; window = window->next_in_panel)
|
||||
{
|
||||
if (!window->is_viewport_window)
|
||||
{
|
||||
UI_BuildSpacer(UI_PIX(tab_spacing, 0), Axis_X);
|
||||
if (window_idx == active_window_idx)
|
||||
{
|
||||
active_window = window;
|
||||
@ -924,8 +920,9 @@ void V_TickForever(WaveLaneCtx *lane)
|
||||
}
|
||||
UI_SetNext(BackgroundColor, VEC4(0.2, 0.2, 0.2, 1));
|
||||
UI_SetNext(Border, 1);
|
||||
UI_SetNext(Width, UI_SHRINK(0, 1));
|
||||
UI_SetNext(Height, UI_SHRINK(0, 1));
|
||||
UI_SetNext(Width, UI_SHRINK(theme.text_padding_x, 0));
|
||||
UI_SetNext(Height, UI_SHRINK(theme.text_padding_y, 0));
|
||||
UI_SetNext(ChildAlignment, UI_Alignment_Center);
|
||||
UI_PushCP(UI_BuildRow());
|
||||
{
|
||||
if (window->is_tile_window)
|
||||
@ -960,7 +957,11 @@ void V_TickForever(WaveLaneCtx *lane)
|
||||
{
|
||||
if (window->is_tile_window)
|
||||
{
|
||||
UI_BuildLabelF("Raaah");
|
||||
for (S_TileKind tile_kind = 0; tile_kind < S_TileKind_Count; ++tile_kind)
|
||||
{
|
||||
String name = S_NameFromTileKind(tile_kind);
|
||||
UI_BuildLabel(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
UI_PopCP(UI_TopCP());
|
||||
|
||||
@ -161,6 +161,8 @@ Struct(V_Space)
|
||||
struct V_Panel *first_panel;
|
||||
struct V_Panel *last_panel;
|
||||
|
||||
UI_Size pref_size[Axis_CountXY];
|
||||
|
||||
Axis axis;
|
||||
};
|
||||
|
||||
|
||||
BIN
src/pp/pp_vis/pp_vis_res/font/OpenSans-Regular.ttf
(Stored with Git LFS)
BIN
src/pp/pp_vis/pp_vis_res/font/OpenSans-Regular.ttf
(Stored with Git LFS)
Binary file not shown.
BIN
src/pp/pp_vis/pp_vis_res/font/roboto-med.ttf
(Stored with Git LFS)
BIN
src/pp/pp_vis/pp_vis_res/font/roboto-med.ttf
(Stored with Git LFS)
Binary file not shown.
BIN
src/pp/pp_vis/pp_vis_res/font/seguisb.ttf
(Stored with Git LFS)
Normal file
BIN
src/pp/pp_vis/pp_vis_res/font/seguisb.ttf
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -243,6 +243,7 @@ TTF_GlyphResult TTF_RasterizeGlyphFromCodepoint(Arena *arena, u32 codepoint, Res
|
||||
hr = IDWriteFontFace_GetDesignGlyphMetrics(font->face, &glyph_idx, 1, &m, 0);
|
||||
}
|
||||
f32 advance = (f32)m.advanceWidth * pixels_per_design_unit;
|
||||
advance = RoundF32(advance);
|
||||
|
||||
/* Best-guess a position in the middle of the render target based on metrics */
|
||||
Vec2I32 rt_baseline = Zi;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user