I came up with this for my assert. It does look alot better.
Code:
#pragma once
//Check if program is debug build
#ifndef NDEBUG
void __assert_win32_(const char* message, const char* file, const int& line);
void __assert_console_(const char* message, const char* file, const int& line);
#if defined(WIN32_ASSERT)
#define assert(x) do { if (!x) { __assert_win32_(#x, __FILE__, __LINE__); } } while(0);
#elif defined(CONSOLE_ASSERT)
#define assert(x) do { if (!x) { __assert_console_(#x, __FILE__, __LINE__); } } while(0);
#endif
#endif
and the implementation of the functions is
Code:
#include "myassert.h"
void __assert_win32_(const char* message, const char* file, const int& line)
{
std::stringstream ss;
ss << "Assertion Error: \nFile: " << file << "\nLine: " << line << "\n\nVariable: " << message;
MessageBoxA(NULL, ss.str().c_str(), "!!!ASSERT ERROR!!!", NULL);
__asm { int 3 }
}
void __assert_console_(const char* message, const char* file, const int& line)
{
printf("Error Variable: %s\nFile: %s\nLine: %d",message, file, line);
__asm { int 3 }
}
Hope this will help someone.