comparison Engine/stuff.h @ 2499:68cdef6879a0

engine folder
author Ritor1
date Fri, 19 Sep 2014 02:57:42 +0600
parents
children a902abdfc7f2
comparison
equal deleted inserted replaced
2498:92eeeb5200f2 2499:68cdef6879a0
1 #pragma once
2 #include <windows.h>
3 #include <stdio.h>
4
5
6
7 inline void Assert(bool condition, const char *format, ...)
8 {
9 if (condition)
10 return;
11
12 va_list va;
13 va_start(va, format);
14 char msg[4096];
15 vsprintf(msg, format, va);
16 MessageBoxA(nullptr, msg, "Assert", 0);
17 va_end(va);
18
19 __debugbreak();
20 }
21
22 inline void Error(const char *format, ...)
23 {
24 va_list va;
25 va_start(va, format);
26 char msg[4096];
27 vsprintf(msg, format, va);
28 MessageBoxA(nullptr, msg, "Error", 0);
29 va_end(va);
30
31 __debugbreak();
32 }
33
34
35
36 inline void log(char *format, ...)
37 {
38 va_list va;
39 va_start(va, format);
40 char msg[256];
41 vsprintf(msg, format, va);
42 va_end(va);
43 DWORD w;
44
45 WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), msg, strlen(msg), &w, 0);
46 }