new logger

scripts are now more error prone
This commit is contained in:
Eduardo Bart
2011-04-22 15:48:02 -03:00
parent e611734396
commit 96e0b1e909
30 changed files with 181 additions and 178 deletions

View File

@@ -211,7 +211,7 @@ void Platform::init(const char *appName)
wc.lpszClassName = win32.appName.c_str(); // Set The Class Name
if(!RegisterClassA(&wc))
logFatal("Failed to register the window class.");
logFatal("FATAL ERROR: Failed to register the window class.");
// force first tick
Platform::getTicks();
@@ -226,7 +226,7 @@ void Platform::terminate()
if(win32.instance) {
if(!UnregisterClassA(win32.appName.c_str(), win32.instance))
logError("Unregister class failed.");
logError("ERROR: Unregister class failed.");
win32.instance = NULL;
}
@@ -286,7 +286,7 @@ bool Platform::createWindow(int x, int y, int width, int height, int minWidth, i
if(!win32.window) {
terminate();
logFatal("Window creation error.");
logFatal("FATAL ERROR: Window creation error.");
return false;
}
@@ -315,31 +315,31 @@ bool Platform::createWindow(int x, int y, int width, int height, int minWidth, i
if(!(win32.hdc = GetDC(win32.window))) {
terminate();
logFatal("Can't Create A GL Device Context.");
logFatal("FATAL ERROR: Can't Create A GL Device Context.");
return false;
}
if(!(pixelFormat = ChoosePixelFormat(win32.hdc, &pfd))) {
terminate();
logFatal("Can't Find A Suitable PixelFormat.");
logFatal("FATAL ERROR: Can't Find A Suitable PixelFormat.");
return false;
}
if(!SetPixelFormat(win32.hdc, pixelFormat, &pfd)) {
terminate();
logFatal("Can't Set The PixelFormat.");
logFatal("FATAL ERROR: Can't Set The PixelFormat.");
return false;
}
if(!(win32.hrc = wglCreateContext(win32.hdc))) {
terminate();
logFatal("Can't Create A GL Rendering Context.");
logFatal("FATAL ERROR: Can't Create A GL Rendering Context.");
return false;
}
if(!wglMakeCurrent(win32.hdc, win32.hrc)) {
terminate();
logFatal("Can't Activate The GL Rendering Context.");
logFatal("FATAL ERROR: Can't Activate The GL Rendering Context.");
return false;
}
@@ -350,24 +350,24 @@ void Platform::destroyWindow()
{
if(win32.hrc) {
if(!wglMakeCurrent(NULL, NULL))
logError("Release Of DC And RC Failed.");
logError("ERROR: Release Of DC And RC Failed.");
if(!wglDeleteContext(win32.hrc))
logError("Release Rendering Context Failed.");
logError("ERROR: Release Rendering Context Failed.");
win32.hrc = NULL;
}
if(win32.hdc) {
if(!ReleaseDC(win32.window, win32.hdc))
logError("Release Device Context Failed.");
logError("ERROR: Release Device Context Failed.");
win32.hdc = NULL;
}
if(win32.window) {
if(!DestroyWindow(win32.window))
logError("Destroy window failed.");
logError("ERROR: Destroy window failed.");
win32.window = NULL;
}
@@ -502,7 +502,7 @@ std::string Platform::getAppUserDir()
std::stringstream sdir;
sdir << PHYSFS_getUserDir() << "/." << win32.appName << "/";
if((mkdir(sdir.str().c_str()) != 0) && (errno != EEXIST))
logError("Couldn't create directory for saving configuration file. (%s)", sdir.str().c_str());
logError("ERROR: Couldn't create directory for saving configuration file. (%s)", sdir.str().c_str());
return sdir.str();
}