summaryrefslogtreecommitdiff
path: root/src/gui/console.cpp
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/console.cpp
parent2973df584978d9aae6f164ce0204179c8a28b3ae (diff)
fix the gay
Diffstat (limited to 'src/gui/console.cpp')
-rw-r--r--src/gui/console.cpp106
1 files changed, 53 insertions, 53 deletions
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 )