engine: Format code

Ran uncrustify on each file
This commit is contained in:
Terence Noone
2026-07-23 17:55:14 -04:00
committed by a1batross
parent eb0ff8e631
commit 7fbd461f83
3 changed files with 69 additions and 68 deletions

View File

@@ -31,7 +31,7 @@ void SDLash_InitSensors( void )
if( SDL_InitSubSystem( SDL_INIT_SENSOR ) == 0 ) if( SDL_InitSubSystem( SDL_INIT_SENSOR ) == 0 )
{ {
int num_sensors; int num_sensors;
SDL_SensorID *sensors = SDL_GetSensors(&num_sensors); SDL_SensorID *sensors = SDL_GetSensors( &num_sensors );
for( int i = 0; i < num_sensors; i++ ) for( int i = 0; i < num_sensors; i++ )
{ {
@@ -41,16 +41,16 @@ void SDLash_InitSensors( void )
if( g_system_gyro ) if( g_system_gyro )
{ {
g_system_gyro_id = sensors[i]; g_system_gyro_id = sensors[i];
Con_Printf( "SDL: Opened built-in gyroscope: %s\n", SDL_GetSensorName( g_system_gyro ) ); Con_Printf( "SDL: Opened built-in gyroscope: %s\n", SDL_GetSensorName( g_system_gyro ));
break; break;
} }
} }
} }
SDL_free(sensors); SDL_free( sensors );
} }
else else
{ {
Con_Reportf( S_ERROR "Failed to init SDL Sensor subsystem: %s\n", SDL_GetError() ); Con_Reportf( S_ERROR "Failed to init SDL Sensor subsystem: %s\n", SDL_GetError());
} }
} }
@@ -80,7 +80,7 @@ SDLash_GyroIsAvailable
*/ */
qboolean SDLash_GyroIsAvailable( void ) qboolean SDLash_GyroIsAvailable( void )
{ {
return ( g_system_gyro != NULL ); return( g_system_gyro != NULL );
} }
/* /*
@@ -96,4 +96,3 @@ void SDLash_SensorUpdate( SDL_SensorEvent sensor )
IN_GyroEvent( sensor.data ); IN_GyroEvent( sensor.data );
} }
} }

View File

@@ -38,6 +38,7 @@ void Platform_Sleep( int msec )
{ {
SDL_Delay( msec ); SDL_Delay( msec );
} }
#endif // XASH_TIMER == TIMER_SDL #endif // XASH_TIMER == TIMER_SDL
#if XASH_MESSAGEBOX == MSGBOX_SDL #if XASH_MESSAGEBOX == MSGBOX_SDL
@@ -45,6 +46,7 @@ void Platform_MessageBox( const char *title, const char *message, qboolean paren
{ {
SDL_ShowSimpleMessageBox( SDL_MESSAGEBOX_ERROR, title, message, parentMainWindow ? host.hWnd : NULL ); SDL_ShowSimpleMessageBox( SDL_MESSAGEBOX_ERROR, title, message, parentMainWindow ? host.hWnd : NULL );
} }
#endif #endif
void SDLash_NanoSleep( int nsec ) void SDLash_NanoSleep( int nsec )

View File

@@ -204,7 +204,7 @@ static qboolean VID_CreateWindow( const int input_width, const int input_height,
return true; return true;
} }
void VID_Info_f ( void ) void VID_Info_f( void )
{ {
Uint32 flags = SDL_GetWindowFlags( host.hWnd ); Uint32 flags = SDL_GetWindowFlags( host.hWnd );
int width, height; int width, height;
@@ -212,16 +212,16 @@ void VID_Info_f ( void )
int x, y; int x, y;
SDL_GetWindowSize( host.hWnd, &width, &height ); SDL_GetWindowSize( host.hWnd, &width, &height );
SDL_GetWindowSizeInPixels( host.hWnd, &render_width, &render_height); SDL_GetWindowSizeInPixels( host.hWnd, &render_width, &render_height );
SDL_GetWindowPosition( host.hWnd, &x, &y ); SDL_GetWindowPosition( host.hWnd, &x, &y );
Con_Printf( "Video: " S_GREEN "SDL3" S_DEFAULT "\n" ); Con_Printf( "Video: " S_GREEN "SDL3" S_DEFAULT "\n" );
Con_Printf( "Video driver: " S_GREEN "%s" S_DEFAULT "\n", SDL_GetCurrentVideoDriver( )); Con_Printf( "Video driver: " S_GREEN "%s" S_DEFAULT "\n", SDL_GetCurrentVideoDriver( ));
Con_Printf( "Window size: " S_GREEN "%dx%d" S_DEFAULT " (" S_YELLOW"real %dx%d" S_DEFAULT")\n", width, height, render_width, render_height ); Con_Printf( "Window size: " S_GREEN "%dx%d" S_DEFAULT " (" S_YELLOW "real %dx%d" S_DEFAULT ")\n", width, height, render_width, render_height );
Con_Printf( "Window position: " S_GREEN "%dx%d" S_DEFAULT "\n", x, y ); Con_Printf( "Window position: " S_GREEN "%dx%d" S_DEFAULT "\n", x, y );
Con_Printf( "Window mode: %s" S_DEFAULT "\n", Con_Printf( "Window mode: %s" S_DEFAULT "\n",
FBitSet( flags, SDL_WINDOW_FULLSCREEN ) ? S_YELLOW "fullscreen" : FBitSet( flags, SDL_WINDOW_FULLSCREEN ) ? S_YELLOW "fullscreen"
S_CYAN "windowed" ); : S_CYAN "windowed" );
Con_Printf( "Window bordered: %s" S_DEFAULT "\n", FBitSet( flags, SDL_WINDOW_BORDERLESS ) ? S_RED "false" : S_GREEN "true" ); Con_Printf( "Window bordered: %s" S_DEFAULT "\n", FBitSet( flags, SDL_WINDOW_BORDERLESS ) ? S_RED "false" : S_GREEN "true" );
Con_Printf( "Window resizable: %s" S_DEFAULT "\n", FBitSet( flags, SDL_WINDOW_RESIZABLE ) ? S_GREEN "true" : S_RED "false" ); Con_Printf( "Window resizable: %s" S_DEFAULT "\n", FBitSet( flags, SDL_WINDOW_RESIZABLE ) ? S_GREEN "true" : S_RED "false" );
Con_Printf( "Window maximized: %s" S_DEFAULT "\n", FBitSet( flags, SDL_WINDOW_MAXIMIZED ) ? S_GREEN "true" : S_RED "false" ); Con_Printf( "Window maximized: %s" S_DEFAULT "\n", FBitSet( flags, SDL_WINDOW_MAXIMIZED ) ? S_GREEN "true" : S_RED "false" );
@@ -233,7 +233,7 @@ void VID_Info_f ( void )
Con_Printf( "Window display index: " S_RED "fail: " S_DEFAULT "%s\n", SDL_GetError( )); Con_Printf( "Window display index: " S_RED "fail: " S_DEFAULT "%s\n", SDL_GetError( ));
const SDL_DisplayMode *dm = SDL_GetWindowFullscreenMode( host.hWnd ); const SDL_DisplayMode *dm = SDL_GetWindowFullscreenMode( host.hWnd );
if ( dm ) if( dm )
Con_Printf( "Window display mode: " S_GREEN "%dx%d@%f" S_DEFAULT "\n", dm->w, dm->h, dm->refresh_rate ); Con_Printf( "Window display mode: " S_GREEN "%dx%d@%f" S_DEFAULT "\n", dm->w, dm->h, dm->refresh_rate );
else else
Con_Printf( "Window display mode: " S_RED "fail: " S_DEFAULT "%s\n", SDL_GetError( )); Con_Printf( "Window display mode: " S_RED "fail: " S_DEFAULT "%s\n", SDL_GetError( ));
@@ -295,12 +295,12 @@ void Platform_Minimize_f( void )
platform_orientation_t Platform_GetDisplayOrientation( void ) platform_orientation_t Platform_GetDisplayOrientation( void )
{ {
if (host.hWnd) if( host.hWnd )
{ {
int display_index = SDL_GetDisplayForWindow( host.hWnd ); int display_index = SDL_GetDisplayForWindow( host.hWnd );
if( display_index >= 0 ) if( display_index >= 0 )
{ {
switch( SDL_GetCurrentDisplayOrientation( display_index ) ) switch( SDL_GetCurrentDisplayOrientation( display_index ))
{ {
case SDL_ORIENTATION_LANDSCAPE: case SDL_ORIENTATION_LANDSCAPE:
return ORIENTATION_LANDSCAPE; return ORIENTATION_LANDSCAPE;
@@ -404,7 +404,7 @@ int GL_SetAttribute( int attr, int val )
{ {
switch( attr ) switch( attr )
{ {
#define MAP_REF_API_ATTRIBUTE_TO_SDL( name ) case REF_##name: return SDL_GL_SetAttribute( SDL_##name, val ); #define MAP_REF_API_ATTRIBUTE_TO_SDL( name ) case REF_ ## name: return SDL_GL_SetAttribute( SDL_ ## name, val );
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_RED_SIZE ); MAP_REF_API_ATTRIBUTE_TO_SDL( GL_RED_SIZE );
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_GREEN_SIZE ); MAP_REF_API_ATTRIBUTE_TO_SDL( GL_GREEN_SIZE );
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_BLUE_SIZE ); MAP_REF_API_ATTRIBUTE_TO_SDL( GL_BLUE_SIZE );
@@ -434,7 +434,7 @@ int GL_GetAttribute( int attr, int *val )
{ {
switch( attr ) switch( attr )
{ {
#define MAP_REF_API_ATTRIBUTE_TO_SDL( name ) case REF_##name: return SDL_GL_GetAttribute( SDL_##name, val ); #define MAP_REF_API_ATTRIBUTE_TO_SDL( name ) case REF_ ## name: return SDL_GL_GetAttribute( SDL_ ## name, val );
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_RED_SIZE ); MAP_REF_API_ATTRIBUTE_TO_SDL( GL_RED_SIZE );
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_GREEN_SIZE ); MAP_REF_API_ATTRIBUTE_TO_SDL( GL_GREEN_SIZE );
MAP_REF_API_ATTRIBUTE_TO_SDL( GL_BLUE_SIZE ); MAP_REF_API_ATTRIBUTE_TO_SDL( GL_BLUE_SIZE );
@@ -744,7 +744,7 @@ static rserr_t VID_SetScreenResolution( int width, int height, window_mode_t win
const SDL_DisplayMode *dm; const SDL_DisplayMode *dm;
qboolean center_window = false; qboolean center_window = false;
if( !(dm = SDL_GetDesktopDisplayMode( display_id )) && width >= dm->w && height >= dm->h ) if( !( dm = SDL_GetDesktopDisplayMode( display_id )) && width >= dm->w && height >= dm->h )
{ {
SDL_SetWindowSize( host.hWnd, dm->w, dm->h ); SDL_SetWindowSize( host.hWnd, dm->w, dm->h );
// Con_Printf( "%s: activating fake fullscreen mode\n", __func__ ); // Con_Printf( "%s: activating fake fullscreen mode\n", __func__ );
@@ -777,8 +777,8 @@ static rserr_t VID_SetScreenResolution( int width, int height, window_mode_t win
SDL_GetWindowSize( host.hWnd, &out_width, &out_height ); SDL_GetWindowSize( host.hWnd, &out_width, &out_height );
Con_Printf( "%s: Setting video mode to %dx%d %s\n", __func__, out_width, out_height, Con_Printf( "%s: Setting video mode to %dx%d %s\n", __func__, out_width, out_height,
window_mode == WINDOW_MODE_BORDERLESS ? "borderless" : window_mode == WINDOW_MODE_BORDERLESS ? "borderless"
window_mode == WINDOW_MODE_FULLSCREEN ? "fullscreen" : "windowed" ); : window_mode == WINDOW_MODE_FULLSCREEN ? "fullscreen" : "windowed" );
VID_SaveWindowSize( host.hWnd, out_width, out_height ); VID_SaveWindowSize( host.hWnd, out_width, out_height );
@@ -801,7 +801,7 @@ rserr_t R_ChangeDisplaySettings( int width, int height, window_mode_t window_mod
else else
{ {
err = VID_SetScreenResolution( width, height, window_mode, refState.window_mode ); err = VID_SetScreenResolution( width, height, window_mode, refState.window_mode );
if ( err != rserr_ok ) if( err != rserr_ok )
return err; return err;
} }