annotate stuff.h @ 2495:7b076fe64f23

GetItemTextureFilename fix
author Ritor1
date Wed, 17 Sep 2014 17:35:13 +0600
parents 345b1ff000bb
children
rev   line source
2317
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
1 #pragma once
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
2 #include <windows.h>
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
3 #include <stdio.h>
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
4
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
5
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
6
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
7 inline void Assert(bool condition, const char *format, ...)
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
8 {
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
9 if (condition)
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
10 return;
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
11
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
12 va_list va;
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
13 va_start(va, format);
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
14 char msg[4096];
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
15 vsprintf(msg, format, va);
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
16 MessageBoxA(nullptr, msg, "Assert", 0);
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
17 va_end(va);
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
18
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
19 __debugbreak();
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
20 }
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
21
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
22 inline void Error(const char *format, ...)
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
23 {
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
24 va_list va;
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
25 va_start(va, format);
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
26 char msg[4096];
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
27 vsprintf(msg, format, va);
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
28 MessageBoxA(nullptr, msg, "Error", 0);
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
29 va_end(va);
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
30
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
31 __debugbreak();
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
32 }
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
33
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
34
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
35
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
36 inline void log(char *format, ...)
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
37 {
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
38 va_list va;
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
39 va_start(va, format);
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
40 char msg[256];
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
41 vsprintf(msg, format, va);
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
42 va_end(va);
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
43 DWORD w;
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
44
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
45 WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), msg, strlen(msg), &w, 0);
345b1ff000bb add stuff.h
Ritor1
parents:
diff changeset
46 }