summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
author2lag <96544487+2lag@users.noreply.github.com>2026-08-10 19:35:23 +0200
committer2lag <96544487+2lag@users.noreply.github.com>2026-08-10 19:35:23 +0200
commit02f118d025a75f60b33cfee6bd8cd8d45ece2c07 (patch)
tree56fc04bf0c926c62eeb18574186f6e3aef6bbf11 /src/gui
parent2973df584978d9aae6f164ce0204179c8a28b3ae (diff)
fix the gay
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/base.h2
-rw-r--r--src/gui/console.cpp106
-rw-r--r--src/gui/contextmenu.cpp26
-rw-r--r--src/gui/textbox.cpp72
4 files changed, 103 insertions, 103 deletions
diff --git a/src/gui/base.h b/src/gui/base.h
index 3fedfcf..c2c09d1 100644
--- a/src/gui/base.h
+++ b/src/gui/base.h
@@ -99,7 +99,7 @@ extern struct GUI_CONTEXTMENU* gui_show_contextmenu(
I32 max_visible_rows = 0,
struct GUI_CONTEXTMENU** owner_ref = 0
);
-extern void gui_hide_contextmenu( GUI_CONTEXTMENU* menu );
+extern void gui_contextmenu_hide( GUI_CONTEXTMENU* menu );
extern U8 gui_contextmenu_open( GUI_CONTEXTMENU* menu );
extern I32 gui_contextmenu_height(
I32 rows,
diff --git a/src/gui/console.cpp b/src/gui/console.cpp
index 4f74649..dbb46a5 100644
--- a/src/gui/console.cpp
+++ b/src/gui/console.cpp
@@ -70,27 +70,27 @@ inline VEC2 get_console_output_sz( GUI_CONSOLEWINDOW* wnd ) {
I32 width = wnd->w - ( GUI_CONSOLE_BORDER_WIDTH + GUI_CONSOLE_PADDING ) * 2;
I32 top = gui_rely( wnd ) + GUI_TITLE_HEIGHT + GUI_CONSOLE_PADDING;
return {
- (F32)max<I32>( 0, width ),
- (F32)max<I32>( 0, bottom - top )
+ (F32)max( 0, width ),
+ (F32)max( 0, bottom - top )
};
}
inline U8 constrain_console( GUI_CONSOLEWINDOW* wnd, I32 max_x, I32 max_y ) {
- max_x = max<I32>( 1.0f, max_x );
- max_y = max<I32>( 1.0f, max_y );
+ max_x = max( 1.0f, max_x );
+ max_y = max( 1.0f, max_y );
I32 oldx = wnd->x;
I32 oldy = wnd->y;
I32 oldw = wnd->w;
I32 oldh = wnd->h;
- I32 minh = min<I32>( GUI_CONSOLE_MINIMUM_HEIGHT, max_y );
- I32 minw = min<I32>( GUI_CONSOLE_MINIMUM_WIDTH, max_x );
+ I32 minh = min( GUI_CONSOLE_MINIMUM_HEIGHT, max_y );
+ I32 minw = min( GUI_CONSOLE_MINIMUM_WIDTH, max_x );
- wnd->w = m_clamp<I32>( wnd->w, minw, max_x );
- wnd->h = m_clamp<I32>( wnd->h, minh, max_y );
- wnd->x = m_clamp<I32>( wnd->x, 0, max_x - wnd->w );
- wnd->y = m_clamp<I32>( wnd->y, 0, max_y - wnd->h );
+ wnd->w = m_clamp( wnd->w, minw, max_x );
+ wnd->h = m_clamp( wnd->h, minh, max_y );
+ wnd->x = m_clamp( wnd->x, 0, max_x - wnd->w );
+ wnd->y = m_clamp( wnd->y, 0, max_y - wnd->h );
return oldx != wnd->x
|| oldy != wnd->y
@@ -109,8 +109,8 @@ inline void layout_console_window( GUI_CONSOLEWINDOW* wnd ) {
if( !view )
return;
- view->w = max<I32>( 1, wnd->w - GUI_CONSOLE_BORDER_WIDTH * 2 );
- view->h = max<I32>( 1, wnd->h - GUI_CONSOLE_BORDER_WIDTH * 2 );
+ view->w = max( 1, wnd->w - GUI_CONSOLE_BORDER_WIDTH * 2 );
+ view->h = max( 1, wnd->h - GUI_CONSOLE_BORDER_WIDTH * 2 );
if( wnd->input ) {
wnd->input->y = get_input_y( wnd->h );
@@ -241,19 +241,19 @@ inline void resize_console_window( GUI_CONSOLEWINDOW* wnd, I32 max_x, I32 max_y
F32 dm_x = input.mouse.pos.x - wnd->drag_start_mouse.x;
F32 dm_y = input.mouse.pos.y - wnd->drag_start_mouse.y;
- F32 min_h = (F32)min<I32>( GUI_CONSOLE_MINIMUM_HEIGHT, max_y );
- F32 min_w = (F32)min<I32>( GUI_CONSOLE_MINIMUM_WIDTH, max_x );
+ F32 min_h = (F32)min( GUI_CONSOLE_MINIMUM_HEIGHT, max_y );
+ F32 min_w = (F32)min( GUI_CONSOLE_MINIMUM_WIDTH, max_x );
U8 hit_constraint = 0;
if( wnd->active_edges & RESIZE_LEFT ) {
F32 req = wnd->drag_start_pos.x + dm_x;
- F32 applied = m_clamp<F32>( req, 0.0f, wnd->drag_start_sz.x - min_w );
+ F32 applied = m_clamp( req, 0.0f, wnd->drag_start_sz.x - min_w );
left = applied;
hit_constraint |= req != applied;
} else if( wnd->active_edges & RESIZE_RIGHT ) {
F32 req = wnd->drag_start_sz.x + dm_x;
- F32 applied = m_clamp<F32>( req,
+ F32 applied = m_clamp( req,
wnd->drag_start_pos.x + min_w,
(F32)max_x
);
@@ -263,7 +263,7 @@ inline void resize_console_window( GUI_CONSOLEWINDOW* wnd, I32 max_x, I32 max_y
if( wnd->active_edges & RESIZE_BOTTOM ) {
F32 req = wnd->drag_start_sz.y + dm_y;
- F32 applied = m_clamp<F32>( req,
+ F32 applied = m_clamp( req,
wnd->drag_start_pos.y + min_h,
(F32)max_y
);
@@ -273,8 +273,8 @@ inline void resize_console_window( GUI_CONSOLEWINDOW* wnd, I32 max_x, I32 max_y
wnd->y = (I32)top;
wnd->x = (I32)left;
- wnd->w = max<I32>( 1, (I32)( right - left ) );
- wnd->h = max<I32>( 1, (I32)( bottom - top ) );
+ wnd->w = max( 1, (I32)( right - left ) );
+ wnd->h = max( 1, (I32)( bottom - top ) );
layout_console_window( wnd );
if( hit_constraint )
store_console_drag_origin( wnd );
@@ -339,12 +339,12 @@ inline U8 console_validate_output_selection(
return 0;
}
- U64 selection_start = min<U64>(
+ U64 selection_start = min(
wnd->output_selection_anchor,
wnd->output_selection_cursor
);
- U64 selection_end = max<U64>(
+ U64 selection_end = max(
wnd->output_selection_anchor,
wnd->output_selection_cursor
);
@@ -355,11 +355,11 @@ inline U8 console_validate_output_selection(
return 0;
}
- wnd->output_selection_anchor = max<U64>( first,
- min<U64>( wnd->output_selection_anchor, last )
+ wnd->output_selection_anchor = max( first,
+ min( wnd->output_selection_anchor, last )
);
- wnd->output_selection_cursor = max<U64>( first,
- min<U64>( wnd->output_selection_cursor, last )
+ wnd->output_selection_cursor = max( first,
+ min( wnd->output_selection_cursor, last )
);
return 1;
}
@@ -371,11 +371,11 @@ inline U8 console_output_line_selected(
if( !wnd || !wnd->output_selection_active )
return 0;
- U64 start = min<U64>(
+ U64 start = min(
wnd->output_selection_anchor,
wnd->output_selection_cursor
);
- U64 end = max<U64>(
+ U64 end = max(
wnd->output_selection_anchor,
wnd->output_selection_cursor
);
@@ -533,7 +533,7 @@ void console_rebuild_wrapped_lines(
if( lines_removed )
wnd->scroll_offset = 0;
else if( old_offset > 0 && !width_changed ) {
- wnd->scroll_offset = max<I32>( 0,
+ wnd->scroll_offset = max( 0,
old_offset + new_count - old_count
);
}
@@ -557,8 +557,8 @@ void draw_console_output( GUI_CONSOLEWINDOW* wnd ) {
wnd->visible_rows = (I32)sz.y / line_height;
I32 row_count = (I32)wnd->wrapped_lines.size;
- I32 max_scroll = max<I32>( 0, row_count - wnd->visible_rows );
- wnd->scroll_offset = m_clamp<I32>( wnd->scroll_offset, 0, max_scroll );
+ I32 max_scroll = max( 0, row_count - wnd->visible_rows );
+ wnd->scroll_offset = m_clamp( wnd->scroll_offset, 0, max_scroll );
gui_draw_push_clip(
(I32)pos.x, (I32)pos.y,
(I32)sz.x, (I32)sz.y
@@ -608,7 +608,7 @@ inline void console_close_input_menu( GUI_CONSOLEWINDOW* wnd ) {
return;
if( wnd->menus.input.menu ) {
- gui_hide_contextmenu( wnd->menus.input.menu );
+ gui_contextmenu_hide( wnd->menus.input.menu );
wnd->menus.input.menu = 0;
}
@@ -628,7 +628,7 @@ inline void console_close_input_menu( GUI_CONSOLEWINDOW* wnd ) {
inline void console_close_output_menu( GUI_CONSOLEWINDOW* wnd ) {
if( wnd && wnd->menus.output.menu )
- gui_hide_contextmenu( wnd->menus.output.menu );
+ gui_contextmenu_hide( wnd->menus.output.menu );
}
inline U8 console_mouse_over_menu(
@@ -652,11 +652,11 @@ void console_copy_output_selection( void* data ) {
if( !console_validate_output_selection( wnd, state ) )
return;
- U64 selection_start = min<U64>(
+ U64 selection_start = min(
wnd->output_selection_anchor,
wnd->output_selection_cursor
);
- U64 selection_end = max<U64>(
+ U64 selection_end = max(
wnd->output_selection_anchor,
wnd->output_selection_cursor
);
@@ -715,15 +715,15 @@ inline void console_open_output_menu(
I32 canvas_w = game->gl->canvas_size[0];
I32 canvas_h = game->gl->canvas_size[1];
- I32 screen_x = m_clamp<I32>( mouse_x,
+ I32 screen_x = m_clamp( mouse_x,
0,
- max<I32>( 0,
+ max( 0,
canvas_w - wnd->menus.output.menu->w
)
);
- I32 screen_y = m_clamp<I32>( mouse_y,
+ I32 screen_y = m_clamp( mouse_y,
0,
- max<I32>( 0,
+ max( 0,
canvas_h - wnd->menus.output.menu->h
)
);
@@ -736,7 +736,7 @@ inline I32 console_input_menu_visible_rows(
I32 item_count,
I32 available_h
) {
- I32 rows = min<I32>(
+ I32 rows = min(
menu->max_visible_rows,
item_count
);
@@ -759,7 +759,7 @@ inline void console_reset_input_menu_view(
return;
}
menu->first_visible = wnd->menus.input.mode == CONSOLE_MENU_INPUT_HIST
- ? max<I32>( 0, item_count - menu->visible_rows )
+ ? max( 0, item_count - menu->visible_rows )
: 0;
}
@@ -771,8 +771,8 @@ inline void console_position_input_menu( GUI_CONSOLEWINDOW* wnd ) {
if( !menu->items || !menu->items->size )
return;
- I32 canvas_w = max<I32>( 1, game->gl->canvas_size[0] );
- I32 canvas_h = max<I32>( 1, game->gl->canvas_size[1] );
+ I32 canvas_w = max( 1, game->gl->canvas_size[0] );
+ I32 canvas_h = max( 1, game->gl->canvas_size[1] );
I32 input_x = gui_relx( wnd->input );
I32 input_bottom = gui_rely( wnd->input )
@@ -783,7 +783,7 @@ inline void console_position_input_menu( GUI_CONSOLEWINDOW* wnd ) {
menu->visible_rows = console_input_menu_visible_rows(
menu,
item_count,
- max<I32>( 0, canvas_h - input_bottom )
+ max( 0, canvas_h - input_bottom )
);
menu->enabled = menu->visible_rows > 0;
if( !menu->enabled )
@@ -796,9 +796,9 @@ inline void console_position_input_menu( GUI_CONSOLEWINDOW* wnd ) {
item_count
);
- menu->w = min<I32>(
- max<I32>( 1, wnd->input->w ),
- max<I32>( 1, canvas_w - input_x )
+ menu->w = min(
+ max( 1, wnd->input->w ),
+ max( 1, canvas_w - input_x )
);
menu->y = input_bottom - gui_rely( wnd );
menu->x = input_x - gui_relx( wnd );
@@ -810,7 +810,7 @@ inline U8 console_show_input_menu( GUI_CONSOLEWINDOW* wnd ) {
if( !wnd || !wnd->input || !wnd->menus.input.items.size )
return 0;
- I32 max_rows = min<I32>(
+ I32 max_rows = min(
GUI_CONSOLE_HISTORY_MENU_ROWS,
(I32)wnd->menus.input.items.size
);
@@ -911,7 +911,7 @@ inline U8 console_apply_input_completion(
if( !textbox || !completion )
return 0;
- U32 capacity = min<U32>(
+ U32 capacity = min(
textbox->maxlen,
GUI_TEXTBOX_MAX
);
@@ -1016,7 +1016,7 @@ inline void console_open_cvar_menu(
? varl->vars.size
: 0;
- I32 copy_length = (I32)min<U32>(
+ I32 copy_length = (I32)min(
query_length,
GUI_TEXTBOX_MAX - 1
);
@@ -1315,8 +1315,8 @@ inline I32 console_max_scroll( GUI_CONSOLEWINDOW* wnd ) {
if( !wnd )
return 0;
I32 row_count = (I32)wnd->wrapped_lines.size;
- I32 visible = max<I32>( 1, wnd->visible_rows );
- return max<I32>( 0, row_count - visible );
+ I32 visible = max( 1, wnd->visible_rows );
+ return max( 0, row_count - visible );
}
inline U8 console_mouse_over_output(
@@ -1360,7 +1360,7 @@ inline I32 console_output_hit_test(
if( wnd->visible_rows <= 0 )
return -1;
- wnd->scroll_offset = m_clamp<I32>(
+ wnd->scroll_offset = m_clamp(
wnd->scroll_offset,
0,
console_max_scroll( wnd )
@@ -1539,7 +1539,7 @@ void console_handle_scroll( GUI_CONSOLEWINDOW* wnd ) {
else
return;
- wnd->scroll_offset = m_clamp<I32>(
+ wnd->scroll_offset = m_clamp(
wnd->scroll_offset + delta,
0,
console_max_scroll( wnd )
diff --git a/src/gui/contextmenu.cpp b/src/gui/contextmenu.cpp
index 73cbafd..0775651 100644
--- a/src/gui/contextmenu.cpp
+++ b/src/gui/contextmenu.cpp
@@ -119,11 +119,11 @@ static void gui_contextmenu_draw_rows(
U8 left_down
) {
I32 item_count = (I32)menu->items->size;
- I32 first = m_clamp<I32>(
+ I32 first = m_clamp(
menu->first_visible,
0, item_count
);
- I32 rows = min<I32>(
+ I32 rows = min(
menu->visible_rows,
item_count - first
);
@@ -133,8 +133,8 @@ static void gui_contextmenu_draw_rows(
gui_draw_push_clip(
x + 1, y,
- max<I32>( 0, menu->w - 2 ),
- max<I32>( 0, rows * gui_contextmenu_row_h() )
+ max( 0, menu->w - 2 ),
+ max( 0, rows * gui_contextmenu_row_h() )
);
for( I32 row = 0; row < rows; ++row ) {
@@ -154,7 +154,7 @@ static void gui_contextmenu_draw_rows(
gui_draw_frect(
x + 1, row_y,
- max<I32>( 1, menu->w - 2 ),
+ max( 1, menu->w - 2 ),
gui_contextmenu_row_h(),
fill
);
@@ -225,7 +225,7 @@ void gui_contextmenu_input_fn( void* ptr ) {
return;
if( hit == -1 ) {
- gui_hide_contextmenu( menu );
+ gui_contextmenu_hide( menu );
return;
}
@@ -239,7 +239,7 @@ void gui_contextmenu_input_fn( void* ptr ) {
if( parent
&& parent->children.idx_of( (GUI_BASE*)menu ) != -1
- ) gui_hide_contextmenu( menu );
+ ) gui_contextmenu_hide( menu );
return;
}
}
@@ -248,7 +248,7 @@ void gui_contextmenu_input_fn( void* ptr ) {
menu->held_idx = -1;
}
-void gui_hide_contextmenu( GUI_CONTEXTMENU* menu ) {
+void gui_contextmenu_hide( GUI_CONTEXTMENU* menu ) {
if( !menu )
return;
@@ -349,11 +349,11 @@ void gui_contextmenu_reveal_selection(
else if( selected >= menu->first_visible + menu->visible_rows )
menu->first_visible = selected - menu->visible_rows + 1;
- I32 max_first = max<I32>( 0,
+ I32 max_first = max( 0,
(I32)menu->items->size - menu->visible_rows
);
- menu->first_visible = m_clamp<I32>(
+ menu->first_visible = m_clamp(
menu->first_visible,
0, max_first
);
@@ -396,7 +396,7 @@ GUI_CONTEXTMENU* gui_show_contextmenu(
return 0;
if( owner_ref && *owner_ref )
- gui_hide_contextmenu( *owner_ref );
+ gui_contextmenu_hide( *owner_ref );
GUI_CONTEXTMENU* menu = new GUI_CONTEXTMENU;
menu->items = items;
@@ -411,10 +411,10 @@ GUI_CONTEXTMENU* gui_show_contextmenu(
menu->owner_ref = owner_ref;
I32 item_count = (I32)items->size;
menu->max_visible_rows = max_visible_rows > 0
- ? min<I32>( max_visible_rows, item_count )
+ ? min( max_visible_rows, item_count )
: item_count;
menu->visible_rows = menu->max_visible_rows;
- menu->first_visible = max<I32>( 0,
+ menu->first_visible = max( 0,
item_count - menu->visible_rows
);
diff --git a/src/gui/textbox.cpp b/src/gui/textbox.cpp
index 0a9745f..edf2a30 100644
--- a/src/gui/textbox.cpp
+++ b/src/gui/textbox.cpp
@@ -14,7 +14,7 @@ struct GUI_TEXTBOX_KEY_RESULT {
static I32 gui_textbox_line_height() {
GL_FONT* font = _gui.fonts.jpn12.glfnt;
return font
- ? max<I32>( 1, (I32)font->char_height )
+ ? max( 1, (I32)font->char_height )
: 1;
}
@@ -35,11 +35,11 @@ static U8 gui_textbox_has_selection( const GUI_TEXTBOX* tb ) {
}
static U32 gui_textbox_selection_start( const GUI_TEXTBOX* tb ) {
- return min<U32>( tb->cursorin, tb->cursorout );
+ return min( tb->cursorin, tb->cursorout );
}
static U32 gui_textbox_selection_end( const GUI_TEXTBOX* tb ) {
- return max<U32>( tb->cursorin, tb->cursorout );
+ return max( tb->cursorin, tb->cursorout );
}
static U8 gui_textbox_shift_down( const GUI_TEXTBOX* tb ) {
@@ -120,8 +120,8 @@ static U32 gui_textbox_nearest_cursor_x(
static void gui_textbox_update_cursor_metrics( GUI_TEXTBOX* tb ) {
U32 length = (U32)strlen( tb->value );
- tb->cursorin = min<U32>( tb->cursorin, length );
- tb->cursorout = min<U32>( tb->cursorout, length );
+ tb->cursorin = min( tb->cursorin, length );
+ tb->cursorout = min( tb->cursorout, length );
U32 line_start_in = gui_textbox_line_start( tb->value, tb->cursorin );
U32 line_start_out = gui_textbox_line_start( tb->value, tb->cursorout );
@@ -150,7 +150,7 @@ static void gui_textbox_set_cursor(
U8 preserve_vertical_goal = 0
) {
U32 length = (U32)strlen( tb->value );
- tb->cursorout = min<U32>( cursor, length );
+ tb->cursorout = min( cursor, length );
if( !extend_selection )
tb->cursorin = tb->cursorout;
@@ -169,7 +169,7 @@ static U32 gui_textbox_cursor_from_point(
I32 line_height = gui_textbox_line_height();
I32 line_count = gui_textbox_line_count( tb->value, length );
I32 row = local_y / line_height;
- row = m_clamp<I32>( row, 0, line_count - 1 );
+ row = m_clamp( row, 0, line_count - 1 );
U32 line_start = gui_textbox_line_start_from_row(
tb->value, length, row
);
@@ -180,7 +180,7 @@ static U32 gui_textbox_cursor_from_point(
tb->value,
line_start,
line_end,
- max<I32>( 0, local_x )
+ max( 0, local_x )
);
}
@@ -239,11 +239,11 @@ static U8 gui_textbox_delete_selection( GUI_TEXTBOX* tb ) {
return 0;
U32 length = (U32)strlen( tb->value );
- U32 start = min<U32>(
+ U32 start = min(
gui_textbox_selection_start( tb ),
length
);
- U32 end = min<U32>(
+ U32 end = min(
gui_textbox_selection_end( tb ),
length
);
@@ -275,13 +275,13 @@ static U32 gui_textbox_insert_bytes(
return 0;
U32 length = (U32)strlen( tb->value );
- U32 limit = min<U32>( tb->maxlen, GUI_TEXTBOX_MAX );
+ U32 limit = min( tb->maxlen, GUI_TEXTBOX_MAX );
- U32 start = min<U32>(
+ U32 start = min(
gui_textbox_selection_start( tb ),
length
);
- U32 end = min<U32>(
+ U32 end = min(
gui_textbox_selection_end( tb ),
length
);
@@ -293,7 +293,7 @@ static U32 gui_textbox_insert_bytes(
return 0;
U32 available = limit - 1 - remaining;
- count = min<U32>( count, available );
+ count = min( count, available );
if( !count )
return 0;
@@ -321,7 +321,7 @@ static U8 gui_textbox_backspace( GUI_TEXTBOX* tb ) {
return 1;
U32 length = (U32)strlen( tb->value );
- U32 cursor = min<U32>( tb->cursorout, length );
+ U32 cursor = min( tb->cursorout, length );
if( !cursor )
return 0;
@@ -343,7 +343,7 @@ static U8 gui_textbox_delete_forward( GUI_TEXTBOX* tb ) {
return 1;
U32 length = (U32)strlen( tb->value );
- U32 cursor = min<U32>( tb->cursorout, length );
+ U32 cursor = min( tb->cursorout, length );
if( cursor >= length )
return 0;
@@ -369,7 +369,7 @@ void gui_textbox_draw_blinker( GUI_TEXTBOX* tb, I32 x, I32 y, CLR clr ) {
}
if( tb->blink ) {
- I32 caret_h = max<I32>( 1,
+ I32 caret_h = max( 1,
gui_textbox_line_height() - 2
);
gui_draw_frect(
@@ -386,7 +386,7 @@ static I32 gui_textbox_newline_width() {
if( !font )
return 1;
- return max<I32>( 1,
+ return max( 1,
(I32)( font->glyphs[(U8)' '].advance_x + 0.5f )
);
}
@@ -401,10 +401,10 @@ static void gui_textbox_draw_selection(
return;
U32 length = (U32)strlen( tb->value );
- U32 selection_start = min<U32>(
+ U32 selection_start = min(
gui_textbox_selection_start( tb ), length
);
- U32 selection_end = min<U32>(
+ U32 selection_end = min(
gui_textbox_selection_end( tb ), length
);
@@ -421,10 +421,10 @@ static void gui_textbox_draw_selection(
tb->value, length, line_start
);
- U32 range_start = max<U32>(
+ U32 range_start = max(
selection_start, line_start
);
- U32 range_end = min<U32>(
+ U32 range_end = min(
selection_end, line_end
);
@@ -466,8 +466,8 @@ static void gui_textbox_draw_frame(
gui_draw_frect( x, y, tb->w, tb->h, border );
gui_draw_frect(
x + 1, y + 1,
- max<I32>( 0, tb->w - 2 ),
- max<I32>( 0, tb->h - 2 ),
+ max( 0, tb->w - 2 ),
+ max( 0, tb->h - 2 ),
ui_clr.bg_sec
);
}
@@ -486,7 +486,7 @@ static void gui_textbox_update_scroll(
"%s", tb->value
);
- text_h = max<I32>( text_h,
+ text_h = max( text_h,
tb->cursorpy + line_height
);
@@ -495,11 +495,11 @@ static void gui_textbox_update_scroll(
else if( tb->cursorpxout + 1 > tb->scrollpx + content_w )
tb->scrollpx = tb->cursorpxout + 1 - content_w;
- I32 max_scroll_x = max<I32>( 0,
- max<I32>( text_w, tb->cursorpxout + 1 ) - content_w
+ I32 max_scroll_x = max( 0,
+ max( text_w, tb->cursorpxout + 1 ) - content_w
);
- tb->scrollpx = m_clamp<I32>(
+ tb->scrollpx = m_clamp(
tb->scrollpx, 0, max_scroll_x
);
@@ -514,10 +514,10 @@ static void gui_textbox_update_scroll(
else if( tb->cursorpy + line_height > tb->scrollpy + content_h )
tb->scrollpy = tb->cursorpy + line_height - content_h;
- tb->scrollpy = m_clamp<I32>(
+ tb->scrollpy = m_clamp(
tb->scrollpy,
0,
- max<I32>( 0, text_h - content_h )
+ max( 0, text_h - content_h )
);
}
@@ -532,8 +532,8 @@ static void gui_textbox_draw_content(
gui_draw_push_clip(
x + 1, y + 1,
- max<I32>( 0, tb->w - 2 ),
- max<I32>( 0, tb->h - 2 )
+ max( 0, tb->w - 2 ),
+ max( 0, tb->h - 2 )
);
gui_textbox_draw_selection( tb,
@@ -573,8 +573,8 @@ void gui_textbox_draw_fn( void* ptr ) {
gui_textbox_draw_frame( tb, x, y );
gui_textbox_update_cursor_metrics( tb );
gui_textbox_update_scroll( tb,
- max<I32>( 1, tb->w - 4 ),
- max<I32>( 1, tb->h - 4 ),
+ max( 1, tb->w - 4 ),
+ max( 1, tb->h - 4 ),
line_height
);
@@ -822,8 +822,8 @@ static U8 gui_textbox_key_repeatable(
void gui_textbox_loop_keys( GUI_TEXTBOX* tb ) {
U32 length = strlen( tb->value );
- tb->cursorin = min<U32>( tb->cursorin, length );
- tb->cursorout = min<U32>( tb->cursorout, length );
+ tb->cursorin = min( tb->cursorin, length );
+ tb->cursorout = min( tb->cursorout, length );
U8 extend_selection = gui_textbox_shift_down( tb );
for( U32 idx = 0; idx < 0x100; ++idx ) {