changeset 2317:345b1ff000bb

add stuff.h
author Ritor1
date Thu, 20 Mar 2014 09:13:42 +0600
parents 25f771e528f0
children 133882370e83
files stuff.h
diffstat 1 files changed, 46 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stuff.h	Thu Mar 20 09:13:42 2014 +0600
@@ -0,0 +1,46 @@
+#pragma once
+#include <windows.h>
+#include <stdio.h>
+
+
+
+inline void Assert(bool condition, const char *format, ...)
+{
+  if (condition)
+    return;
+  
+  va_list va;
+  va_start(va, format);
+    char msg[4096];
+    vsprintf(msg, format, va);
+    MessageBoxA(nullptr, msg, "Assert", 0);
+  va_end(va);
+
+  __debugbreak();
+}
+
+inline void Error(const char *format, ...)
+{
+  va_list va;
+  va_start(va, format);
+    char msg[4096];
+    vsprintf(msg, format, va);
+    MessageBoxA(nullptr, msg, "Error", 0);
+  va_end(va);
+
+  __debugbreak();
+}
+
+
+
+inline void log(char *format, ...)
+{
+  va_list va;
+  va_start(va, format);
+  char msg[256];
+  vsprintf(msg, format, va);
+  va_end(va);
+  DWORD w;
+
+  WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), msg, strlen(msg), &w, 0);
+}
\ No newline at end of file