mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-17 18:40:02 +00:00
platform: move MSGBOX implementation to platform backends
This commit is contained in:
parent
e3e2f3afe5
commit
1a700fd06b
@ -25,33 +25,14 @@ extern "C" {
|
|||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#ifdef XASH_SDL
|
|
||||||
#include <SDL_messagebox.h>
|
|
||||||
|
|
||||||
#define MSGBOX( x ) SDL_ShowSimpleMessageBox( SDL_MESSAGEBOX_ERROR, "Xash Error", x, NULL )
|
|
||||||
#define MSGBOX2( x ) SDL_ShowSimpleMessageBox( SDL_MESSAGEBOX_ERROR, "Host Error", x, host.hWnd )
|
|
||||||
#define MSGBOX3( x ) SDL_ShowSimpleMessageBox( SDL_MESSAGEBOX_ERROR, "Host Recursive Error", x, host.hWnd )
|
|
||||||
#elif defined(__ANDROID__) && !defined(XASH_DEDICATED)
|
|
||||||
#define MSGBOX( x ) Android_MessageBox( "Xash Error", x )
|
|
||||||
#define MSGBOX2( x ) Android_MessageBox( "Host Error", x )
|
|
||||||
#define MSGBOX3( x ) Android_MessageBox( "Host Recursive Error", x )
|
|
||||||
#elif defined _WIN32
|
|
||||||
#define MSGBOX( x ) MessageBox( NULL, x, "Xash Error", MB_OK|MB_SETFOREGROUND|MB_ICONSTOP )
|
|
||||||
#define MSGBOX2( x ) MessageBox( host.hWnd, x, "Host Error", MB_OK|MB_SETFOREGROUND|MB_ICONSTOP )
|
|
||||||
#define MSGBOX3( x ) MessageBox( host.hWnd, x, "Host Recursive Error", MB_OK|MB_SETFOREGROUND|MB_ICONSTOP )
|
|
||||||
#else
|
|
||||||
#define BORDER1 "======================================\n"
|
|
||||||
#define MSGBOX( x ) fprintf( stderr, BORDER1 "Xash Error: %s\n" BORDER1, x )
|
|
||||||
#define MSGBOX2( x ) fprintf( stderr, BORDER1 "Host Error: %s\n" BORDER1, x )
|
|
||||||
#define MSGBOX3( x ) fprintf( stderr, BORDER1 "Host Recursive Error: %s\n" BORDER1, x )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "xash3d_types.h"
|
#include "xash3d_types.h"
|
||||||
|
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include "crtlib.h"
|
#include "crtlib.h"
|
||||||
|
#include "platform/platform.h"
|
||||||
|
|
||||||
|
#define MSGBOX( x ) Platform_MessageBox( "Xash Error", (x), false );
|
||||||
|
#define MSGBOX2( x ) Platform_MessageBox( "Host Error", (x), true );
|
||||||
|
#define MSGBOX3( x ) Platform_MessageBox( "Host Recursive Error", (x), true );
|
||||||
#define ASSERT( exp ) if(!( exp )) Sys_Error( "assert failed at %s:%i\n", __FILE__, __LINE__ )
|
#define ASSERT( exp ) if(!( exp )) Sys_Error( "assert failed at %s:%i\n", __FILE__, __LINE__ )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -31,6 +31,7 @@ GNU General Public License for more details.
|
|||||||
double Platform_DoubleTime( void );
|
double Platform_DoubleTime( void );
|
||||||
void Platform_Sleep( int msec );
|
void Platform_Sleep( int msec );
|
||||||
void Platform_ShellExecute( const char *path, const char *parms );
|
void Platform_ShellExecute( const char *path, const char *parms );
|
||||||
|
void Platform_MessageBox( const char *title, const char *message, qboolean parentMainWindow );
|
||||||
// commented out, as this is an optional feature or maybe implemented in system API directly
|
// commented out, as this is an optional feature or maybe implemented in system API directly
|
||||||
// see system.c
|
// see system.c
|
||||||
// qboolean Sys_DebuggerPresent( void );
|
// qboolean Sys_DebuggerPresent( void );
|
||||||
|
@ -88,3 +88,13 @@ void Platform_ShellExecute( const char *path, const char *parms )
|
|||||||
Con_Reportf( S_WARN "Could not find "OPEN_COMMAND" utility\n" );
|
Con_Reportf( S_WARN "Could not find "OPEN_COMMAND" utility\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef XASH_DEDICATED
|
||||||
|
void Platform_MessageBox( const char *title, const char *message, qboolean parentMainWindow )
|
||||||
|
{
|
||||||
|
fprintf( stderr,
|
||||||
|
"======================================\n"
|
||||||
|
"%s: %s\n"
|
||||||
|
"======================================\n, title, message );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@ -37,3 +37,8 @@ void Platform_Sleep( int msec )
|
|||||||
SDL_Delay( msec );
|
SDL_Delay( msec );
|
||||||
}
|
}
|
||||||
#endif // XASH_TIMER == TIMER_SDL
|
#endif // XASH_TIMER == TIMER_SDL
|
||||||
|
|
||||||
|
void Platform_MessageBox( const char *title, const char *message, qboolean parentMainWindow )
|
||||||
|
{
|
||||||
|
SDL_ShowSimpleMessageBox( SDL_MESSAGEBOX_ERROR, title, message, parentMainWindow ? host.hWnd : NULL );
|
||||||
|
}
|
||||||
|
@ -54,3 +54,10 @@ void Platform_ShellExecute( const char *path, const char *parms )
|
|||||||
|
|
||||||
ShellExecute( NULL, "open", path, parms, NULL, SW_SHOW );
|
ShellExecute( NULL, "open", path, parms, NULL, SW_SHOW );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef XASH_DEDICATED
|
||||||
|
void Platform_MessageBox( const char *title, const char *message, qboolean parentMainWindow )
|
||||||
|
{
|
||||||
|
MessageBox( parentMainWindow ? host.hWnd : NULL, message, title, MB_OK|MB_SETFOREGROUND|MB_ICONSTOP );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user