REVIEWED: exit() on LOG_FATAL instead of LOG_ERROR #1796
This commit is contained in:
parent
a178a2170b
commit
71995d52b3
5 changed files with 53 additions and 43 deletions
28
src/core.c
28
src/core.c
|
@ -652,7 +652,7 @@ void InitWindow(int width, int height, const char *title)
|
||||||
#if defined(PLATFORM_UWP)
|
#if defined(PLATFORM_UWP)
|
||||||
if (!UWPIsConfigured())
|
if (!UWPIsConfigured())
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_ERROR, "UWP Functions have not been set yet, please set these before initializing raylib!");
|
TRACELOG(LOG_FATAL, "UWP Functions have not been set yet, please set these before initializing raylib!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -736,7 +736,12 @@ void InitWindow(int width, int height, const char *title)
|
||||||
// NOTE: returns true if window and graphic device has been initialized successfully
|
// NOTE: returns true if window and graphic device has been initialized successfully
|
||||||
CORE.Window.ready = InitGraphicsDevice(width, height);
|
CORE.Window.ready = InitGraphicsDevice(width, height);
|
||||||
|
|
||||||
if (!CORE.Window.ready) return;
|
// If graphic device is no properly initialized, we end program
|
||||||
|
if (!CORE.Window.ready)
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_FATAL, "Failed to initialize Graphic Device");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Init hi-res timer
|
// Init hi-res timer
|
||||||
InitTimer();
|
InitTimer();
|
||||||
|
@ -4914,6 +4919,7 @@ static void SwapBuffers(void)
|
||||||
{
|
{
|
||||||
gbm_surface_release_buffer(CORE.Window.gbmSurface, CORE.Window.prevBO);
|
gbm_surface_release_buffer(CORE.Window.gbmSurface, CORE.Window.prevBO);
|
||||||
}
|
}
|
||||||
|
|
||||||
CORE.Window.prevBO = bo;
|
CORE.Window.prevBO = bo;
|
||||||
#endif // PLATFORM_DRM
|
#endif // PLATFORM_DRM
|
||||||
#endif // PLATFORM_ANDROID || PLATFORM_RPI || PLATFORM_DRM || PLATFORM_UWP
|
#endif // PLATFORM_ANDROID || PLATFORM_RPI || PLATFORM_DRM || PLATFORM_UWP
|
||||||
|
@ -6268,15 +6274,15 @@ bool UWPIsConfigured()
|
||||||
{
|
{
|
||||||
bool pass = true;
|
bool pass = true;
|
||||||
|
|
||||||
if (uwpQueryTimeFunc == NULL) { TRACELOG(LOG_ERROR, "UWP: UWPSetQueryTimeFunc() must be called with a valid function before InitWindow()"); pass = false; }
|
if (uwpQueryTimeFunc == NULL) { TRACELOG(LOG_WARNING, "UWP: UWPSetQueryTimeFunc() must be called with a valid function before InitWindow()"); pass = false; }
|
||||||
if (uwpSleepFunc == NULL) { TRACELOG(LOG_ERROR, "UWP: UWPSetSleepFunc() must be called with a valid function before InitWindow()"); pass = false; }
|
if (uwpSleepFunc == NULL) { TRACELOG(LOG_WARNING, "UWP: UWPSetSleepFunc() must be called with a valid function before InitWindow()"); pass = false; }
|
||||||
if (uwpDisplaySizeFunc == NULL) { TRACELOG(LOG_ERROR, "UWP: UWPSetDisplaySizeFunc() must be called with a valid function before InitWindow()"); pass = false; }
|
if (uwpDisplaySizeFunc == NULL) { TRACELOG(LOG_WARNING, "UWP: UWPSetDisplaySizeFunc() must be called with a valid function before InitWindow()"); pass = false; }
|
||||||
if (uwpMouseLockFunc == NULL) { TRACELOG(LOG_ERROR, "UWP: UWPSetMouseLockFunc() must be called with a valid function before InitWindow()"); pass = false; }
|
if (uwpMouseLockFunc == NULL) { TRACELOG(LOG_WARNING, "UWP: UWPSetMouseLockFunc() must be called with a valid function before InitWindow()"); pass = false; }
|
||||||
if (uwpMouseUnlockFunc == NULL) { TRACELOG(LOG_ERROR, "UWP: UWPSetMouseUnlockFunc() must be called with a valid function before InitWindow()"); pass = false; }
|
if (uwpMouseUnlockFunc == NULL) { TRACELOG(LOG_WARNING, "UWP: UWPSetMouseUnlockFunc() must be called with a valid function before InitWindow()"); pass = false; }
|
||||||
if (uwpMouseShowFunc == NULL) { TRACELOG(LOG_ERROR, "UWP: UWPSetMouseShowFunc() must be called with a valid function before InitWindow()"); pass = false; }
|
if (uwpMouseShowFunc == NULL) { TRACELOG(LOG_WARNING, "UWP: UWPSetMouseShowFunc() must be called with a valid function before InitWindow()"); pass = false; }
|
||||||
if (uwpMouseHideFunc == NULL) { TRACELOG(LOG_ERROR, "UWP: UWPSetMouseHideFunc() must be called with a valid function before InitWindow()"); pass = false; }
|
if (uwpMouseHideFunc == NULL) { TRACELOG(LOG_WARNING, "UWP: UWPSetMouseHideFunc() must be called with a valid function before InitWindow()"); pass = false; }
|
||||||
if (uwpMouseSetPosFunc == NULL) { TRACELOG(LOG_ERROR, "UWP: UWPSetMouseSetPosFunc() must be called with a valid function before InitWindow()"); pass = false; }
|
if (uwpMouseSetPosFunc == NULL) { TRACELOG(LOG_WARNING, "UWP: UWPSetMouseSetPosFunc() must be called with a valid function before InitWindow()"); pass = false; }
|
||||||
if (uwpCoreWindow == NULL) { TRACELOG(LOG_ERROR, "UWP: A pointer to the UWP core window must be set before InitWindow()"); pass = false; }
|
if (uwpCoreWindow == NULL) { TRACELOG(LOG_WARNING, "UWP: A pointer to the UWP core window must be set before InitWindow()"); pass = false; }
|
||||||
|
|
||||||
return pass;
|
return pass;
|
||||||
}
|
}
|
||||||
|
|
32
src/raudio.c
32
src/raudio.c
|
@ -276,25 +276,27 @@ typedef struct tagBITMAPINFOHEADER {
|
||||||
// NOTE: Depends on data structure provided by the library
|
// NOTE: Depends on data structure provided by the library
|
||||||
// in charge of reading the different file types
|
// in charge of reading the different file types
|
||||||
typedef enum {
|
typedef enum {
|
||||||
MUSIC_AUDIO_NONE = 0,
|
MUSIC_AUDIO_NONE = 0, // No audio context loaded
|
||||||
MUSIC_AUDIO_WAV,
|
MUSIC_AUDIO_WAV, // WAV audio context
|
||||||
MUSIC_AUDIO_OGG,
|
MUSIC_AUDIO_OGG, // OGG audio context
|
||||||
MUSIC_AUDIO_FLAC,
|
MUSIC_AUDIO_FLAC, // FLAC audio context
|
||||||
MUSIC_AUDIO_MP3,
|
MUSIC_AUDIO_MP3, // MP3 audio context
|
||||||
MUSIC_MODULE_XM,
|
MUSIC_MODULE_XM, // XM module audio context
|
||||||
MUSIC_MODULE_MOD
|
MUSIC_MODULE_MOD // MOD module audio context
|
||||||
} MusicContextType;
|
} MusicContextType;
|
||||||
|
|
||||||
#if defined(RAUDIO_STANDALONE)
|
#if defined(RAUDIO_STANDALONE)
|
||||||
|
// Trace log level
|
||||||
|
// NOTE: Organized by priority level
|
||||||
typedef enum {
|
typedef enum {
|
||||||
LOG_ALL,
|
LOG_ALL = 0, // Display all logs
|
||||||
LOG_TRACE,
|
LOG_TRACE, // Trace logging, intended for internal use only
|
||||||
LOG_DEBUG,
|
LOG_DEBUG, // Debug logging, used for internal debugging, it should be disabled on release builds
|
||||||
LOG_INFO,
|
LOG_INFO, // Info logging, used for program execution info
|
||||||
LOG_WARNING,
|
LOG_WARNING, // Warning logging, used on recoverable failures
|
||||||
LOG_ERROR,
|
LOG_ERROR, // Error logging, used on unrecoverable failures
|
||||||
LOG_FATAL,
|
LOG_FATAL, // Fatal logging, used to abort program: exit(EXIT_FAILURE)
|
||||||
LOG_NONE
|
LOG_NONE // Disable logging
|
||||||
} TraceLogLevel;
|
} TraceLogLevel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
15
src/raylib.h
15
src/raylib.h
|
@ -498,14 +498,15 @@ typedef enum {
|
||||||
} ConfigFlags;
|
} ConfigFlags;
|
||||||
|
|
||||||
// Trace log level
|
// Trace log level
|
||||||
|
// NOTE: Organized by priority level
|
||||||
typedef enum {
|
typedef enum {
|
||||||
LOG_ALL = 0, // Display all logs
|
LOG_ALL = 0, // Display all logs
|
||||||
LOG_TRACE,
|
LOG_TRACE, // Trace logging, intended for internal use only
|
||||||
LOG_DEBUG,
|
LOG_DEBUG, // Debug logging, used for internal debugging, it should be disabled on release builds
|
||||||
LOG_INFO,
|
LOG_INFO, // Info logging, used for program execution info
|
||||||
LOG_WARNING,
|
LOG_WARNING, // Warning logging, used on recoverable failures
|
||||||
LOG_ERROR,
|
LOG_ERROR, // Error logging, used on unrecoverable failures
|
||||||
LOG_FATAL,
|
LOG_FATAL, // Fatal logging, used to abort program: exit(EXIT_FAILURE)
|
||||||
LOG_NONE // Disable logging
|
LOG_NONE // Disable logging
|
||||||
} TraceLogLevel;
|
} TraceLogLevel;
|
||||||
|
|
||||||
|
@ -1015,7 +1016,7 @@ RLAPI int GetRandomValue(int min, int max); // Returns a r
|
||||||
RLAPI void TakeScreenshot(const char *fileName); // Takes a screenshot of current screen (filename extension defines format)
|
RLAPI void TakeScreenshot(const char *fileName); // Takes a screenshot of current screen (filename extension defines format)
|
||||||
RLAPI void SetConfigFlags(unsigned int flags); // Setup init configuration flags (view FLAGS)
|
RLAPI void SetConfigFlags(unsigned int flags); // Setup init configuration flags (view FLAGS)
|
||||||
|
|
||||||
RLAPI void TraceLog(int logLevel, const char *text, ...); // Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR)
|
RLAPI void TraceLog(int logLevel, const char *text, ...); // Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...)
|
||||||
RLAPI void SetTraceLogLevel(int logLevel); // Set the current threshold (minimum) log level
|
RLAPI void SetTraceLogLevel(int logLevel); // Set the current threshold (minimum) log level
|
||||||
RLAPI void *MemAlloc(int size); // Internal memory allocator
|
RLAPI void *MemAlloc(int size); // Internal memory allocator
|
||||||
RLAPI void *MemRealloc(void *ptr, int size); // Internal memory reallocator
|
RLAPI void *MemRealloc(void *ptr, int size); // Internal memory reallocator
|
||||||
|
|
19
src/rlgl.h
19
src/rlgl.h
|
@ -329,16 +329,17 @@ typedef enum {
|
||||||
int *locs; // Shader locations array (MAX_SHADER_LOCATIONS)
|
int *locs; // Shader locations array (MAX_SHADER_LOCATIONS)
|
||||||
} Shader;
|
} Shader;
|
||||||
|
|
||||||
// TraceLog message types
|
// Trace log level
|
||||||
|
// NOTE: Organized by priority level
|
||||||
typedef enum {
|
typedef enum {
|
||||||
LOG_ALL,
|
LOG_ALL = 0, // Display all logs
|
||||||
LOG_TRACE,
|
LOG_TRACE, // Trace logging, intended for internal use only
|
||||||
LOG_DEBUG,
|
LOG_DEBUG, // Debug logging, used for internal debugging, it should be disabled on release builds
|
||||||
LOG_INFO,
|
LOG_INFO, // Info logging, used for program execution info
|
||||||
LOG_WARNING,
|
LOG_WARNING, // Warning logging, used on recoverable failures
|
||||||
LOG_ERROR,
|
LOG_ERROR, // Error logging, used on unrecoverable failures
|
||||||
LOG_FATAL,
|
LOG_FATAL, // Fatal logging, used to abort program: exit(EXIT_FAILURE)
|
||||||
LOG_NONE
|
LOG_NONE // Disable logging
|
||||||
} TraceLogLevel;
|
} TraceLogLevel;
|
||||||
|
|
||||||
// Texture formats (support depends on OpenGL version)
|
// Texture formats (support depends on OpenGL version)
|
||||||
|
|
|
@ -155,7 +155,7 @@ void TraceLog(int logType, const char *text, ...)
|
||||||
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
if (logType == LOG_ERROR) exit(1); // If error, exit program
|
if (logType == LOG_FATAL) exit(EXIT_FAILURE); // If fatal logging, exit program
|
||||||
|
|
||||||
#endif // SUPPORT_TRACELOG
|
#endif // SUPPORT_TRACELOG
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue