-
Notifications
You must be signed in to change notification settings - Fork 30
/
GigiAssert.h
40 lines (33 loc) · 1.12 KB
/
GigiAssert.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
///////////////////////////////////////////////////////////////////////////////
// Gigi Rapid Graphics Prototyping and Code Generation Suite //
// Copyright (c) 2024 Electronic Arts Inc. All rights reserved. //
///////////////////////////////////////////////////////////////////////////////
#pragma once
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
#define Assert(X, MSG, ...) \
{ \
if ((X) == false) \
{ \
static bool ignoreThis = false; \
if (!ignoreThis) \
{ \
if(!ShowErrorMessage( __FUNCTION__ "() Line " TOSTRING(__LINE__) ":\n\nExpression:\n" #X "\n\n" MSG, __VA_ARGS__)) \
ignoreThis = true; \
} \
} \
}
enum class MessageType
{
Info,
Warn,
Error
};
using GigiPrintMessageFn = void (*)(MessageType messageType, const char* msg);
void SetGigiPrintMessage(const GigiPrintMessageFn & printMessageFn);
void SetGigiHeadlessMode(bool headless);
void ShowInfoMessage(const char* msg, ...);
bool ShowErrorMessage(const char* msg, ...);
void ShowWarningMessage(const char* msg, ...);
bool AskForConfirmation(const char* msg, ...);
void ShowMessageBox(const char* msg, ...);