Skip to content

Commit

Permalink
[engine]Issue #116: Use debug log tag for places where missed before
Browse files Browse the repository at this point in the history
  • Loading branch information
Miquel Angel Quinones Garcia committed Feb 19, 2013
1 parent 75edb86 commit 14ee822
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 36 deletions.
2 changes: 1 addition & 1 deletion IndieLib/common/src/DebugApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ bool DebugApi::init() {
*_count << "Indielib version: "<<IND_VERSION.major<<"."<<IND_VERSION.minor<<"."<<IND_VERSION.revision;
*_count << endl;
*_count << endl;
*_count << "[g_debug.log]:" << " (";
*_count << "[Init time]:" << " (";

// Date
string days [7] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thrusday", "Friday", "Saturday"};
Expand Down
4 changes: 2 additions & 2 deletions IndieLib/common/src/IND_Image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,12 +669,12 @@ void IND_Image::setAlphaChannel(BYTE pR, BYTE pG, BYTE pB) {
}//LOOP END
}//LOOP END
} else {
g_debug->header("Intent to set alpha channel via colorkey to non 32-bit RGBA image!",2);
g_debug->header("Intent to set alpha channel via colorkey to non 32-bit RGBA image!",DebugApi::LogHeaderError);
}
break;

default:
g_debug->header("Intent to set alpha channel via colorkey to not supported image!",2);
g_debug->header("Intent to set alpha channel via colorkey to not supported image!",DebugApi::LogHeaderError);
break;
}
}
Expand Down
2 changes: 2 additions & 0 deletions IndieLib/common/src/IND_Render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1431,6 +1431,8 @@ IND_Window* IND_Render::createRender(IND_WindowProperties& windowProperties) {
} else {
return (_wrappedRenderer->initRenderAndWindow(windowProperties));
}

g_debug->header("Render created", DebugApi::LogHeaderEnd);
}

/*
Expand Down
18 changes: 10 additions & 8 deletions IndieLib/common/src/IND_TmxMapManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ bool IND_TmxMapManager::init() {
g_debug->header("Preparing TmxMapManager", DebugApi::LogHeaderOk);
_ok = true;

//FreeImage_Initialise();
//const char* freeImageVer = FreeImage_GetVersion();
//const char* freeImageCopyright = FreeImage_GetCopyrightMessage();
//g_debug->header("Using FreeImage ver:",1);
//g_debug->header(freeImageVer,1);
//g_debug->header(freeImageCopyright,1);
// FreeImage_Initialise();
// const char* freeImageVer = FreeImage_GetVersion();
// const char* freeImageCopyright = FreeImage_GetCopyrightMessage();
// g_debug->header("Using FreeImage version: ",DebugApi::LogHeaderInfo);
// g_debug->dataChar(freeImageVer, true);
// g_debug->header("Copyright: ", DebugApi::LogHeaderInfo);
// g_debug->dataChar(freeImageCopyright, true);
// g_debug->header("ImageManager Initialised", DebugApi::LogHeaderEnd);
g_debug->header("TmxMapManager OK", DebugApi::LogHeaderEnd);

//TODO: REGISTER ERROR HANDLERS FOR FREEIMAGE
Expand Down Expand Up @@ -91,7 +93,7 @@ bool IND_TmxMapManager::add(IND_TmxMap *pNewTmxMap,const char *pName) {
g_debug->header("Loading TmxMap", DebugApi::LogHeaderBegin);

if(!pName) {
g_debug->header("Invalid File name provided (null)",2);
g_debug->header("Invalid File name provided (null)",DebugApi::LogHeaderError);
return 0;
}

Expand Down Expand Up @@ -170,7 +172,7 @@ Tmx::Map* IND_TmxMapManager::load(const char *pName) {
g_debug->header("Loading TmxMap", DebugApi::LogHeaderBegin);
if(!pName) {
g_debug->header("Invalid File name provided (null)",2);
g_debug->header("Invalid File name provided (null)",DebugApi::LogHeaderError);
return NULL;
}
Expand Down
8 changes: 4 additions & 4 deletions IndieLib/common/src/IND_Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ bool IND_Window::create(IND_WindowProperties& props) {
windowFlags);
if (!_attributes._sdlWindow) {
g_debug->header("Error creating SDL window", DebugApi::LogHeaderError);
g_debug->header(std::string(SDL_GetError()),2);
g_debug->header(std::string(SDL_GetError()),DebugApi::LogHeaderError);
return 0;
}

if (!reset(props)) {
g_debug->header("Error setting SDL window params", DebugApi::LogHeaderError);
g_debug->header(std::string(SDL_GetError()),2);
g_debug->header(std::string(SDL_GetError()),DebugApi::LogHeaderError);
return 0;
}

Expand All @@ -129,7 +129,7 @@ bool IND_Window::create(IND_WindowProperties& props) {
if(SDL_FALSE == SDL_GetWindowWMInfo(getSDLWindow(),_attributes._windowInfo)) {

g_debug->header("Error while getting SDL window manager info: " , DebugApi::LogHeaderError);
g_debug->header(std::string(SDL_GetError()),2);
g_debug->header(std::string(SDL_GetError()),DebugApi::LogHeaderError);
return 0;
}

Expand Down Expand Up @@ -195,7 +195,7 @@ bool IND_Window::reset(IND_WindowProperties& props) {

if (props._bpp != 32) {
g_debug->header("Error creating SDL window", DebugApi::LogHeaderError);
g_debug->header(std::string(SDL_GetError()),2);
g_debug->header(std::string(SDL_GetError()),DebugApi::LogHeaderError);
return 0;
}

Expand Down
29 changes: 12 additions & 17 deletions IndieLib/common/src/platform/OSOpenGLManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Suite 330, Boston, MA 02111-1307 USA
// --------------------------------------------------------------------------------

void OSOpenGLManager::setOpenGLContextParams(IND_ColorFormat colorFormat, int numBitsPerColor, int numDepthBits, int numStencilBits, bool doublebuffer) {
g_debug->header("Initiating OpenGL SDL Context Parameters", DebugApi::LogHeaderInfo);
g_debug->header("Initiating OpenGL SDL Context Parameters", DebugApi::LogHeaderOk);

if (IND_RGBA == colorFormat) {
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, numBitsPerColor);
Expand Down Expand Up @@ -67,8 +67,7 @@ void OSOpenGLManager::setOpenGLContextParams(IND_ColorFormat colorFormat, int nu
_numStencilBits = numStencilBits;
_colorBufferFormat = colorFormat;

g_debug->header("OpenGL Context Parameters Initated", DebugApi::LogHeaderInfo);
g_debug->dataChar("OK", true);
g_debug->header("OpenGL Context Parameters Initated", DebugApi::LogHeaderOk);
}

bool OSOpenGLManager::checkOpenGLSDLContextProps() {
Expand All @@ -90,17 +89,17 @@ bool OSOpenGLManager::checkOpenGLSDLContextProps() {
SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE,&contextDepthSize);
SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE,&contextSencilSize);

g_debug->header("Created GL context R size: ",3);
g_debug->header("Created GL context R size: ",DebugApi::LogHeaderInfo);
g_debug->dataInt(contextRSize,true);
g_debug->header("Created GL context G size: ",3);
g_debug->header("Created GL context G size: ",DebugApi::LogHeaderInfo);
g_debug->dataInt(contextGSize,true);
g_debug->header("Created GL context B size: ",3);
g_debug->header("Created GL context B size: ",DebugApi::LogHeaderInfo);
g_debug->dataInt(contextBSize,true);
g_debug->header("Created GL context A size: ",3);
g_debug->header("Created GL context A size: ",DebugApi::LogHeaderInfo);
g_debug->dataInt(contextASize,true);
g_debug->header("Created GL context Depth size: ",3);
g_debug->header("Created GL context Depth size: ",DebugApi::LogHeaderInfo);
g_debug->dataInt(contextDepthSize,true);
g_debug->header("Created GL context Stencil size: ",3);
g_debug->header("Created GL context Stencil size: ",DebugApi::LogHeaderInfo);
g_debug->dataInt(contextSencilSize,true);

//RGB color buffer size check
Expand Down Expand Up @@ -135,8 +134,7 @@ bool OSOpenGLManager::checkOpenGLSDLContextProps() {
}

bool OSOpenGLManager::createOpenGLSDLContext() {
g_debug->header("Creating OpenGL context", DebugApi::LogHeaderInfo);
g_debug->dataChar("OK", true);
g_debug->header("Creating OpenGL context", DebugApi::LogHeaderOk);

_sdlWindow = _window->getSDLWindow();
_glContext = SDL_GL_CreateContext(_sdlWindow);
Expand All @@ -146,18 +144,15 @@ bool OSOpenGLManager::createOpenGLSDLContext() {
return false;
}

g_debug->header("OpenGL context created", DebugApi::LogHeaderInfo);
g_debug->dataChar("OK", true);
g_debug->header("OpenGL context created", DebugApi::LogHeaderOk);
return true;
}

void OSOpenGLManager::endOpenGLContext() {
if (_glContext) {
g_debug->header("Destroying OpenGL Context", DebugApi::LogHeaderInfo);
g_debug->dataChar("OK", true);
g_debug->header("Destroying OpenGL Context", DebugApi::LogHeaderOk);
SDL_GL_DeleteContext(_glContext);
g_debug->header("OpenGL Context Destroyed", DebugApi::LogHeaderInfo);
g_debug->dataChar("OK", true);
g_debug->header("OpenGL Context Destroyed", DebugApi::LogHeaderOk);
}
}

Expand Down
8 changes: 4 additions & 4 deletions IndieLib/common/src/render/opengl/OpenGLRender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,17 @@ IND_Window* OpenGLRender::initRenderAndWindow(IND_WindowProperties& props) {
g_debug->header("Creating OpenGL Render", DebugApi::LogHeaderBegin);
_ok = initializeOpenGLRender();
if (!_ok) {
g_debug->header("Finalizing OpenGL", DebugApi::LogHeaderBegin);
g_debug->header("Finalizing OpenGL", DebugApi::LogHeaderWarning);
freeVars();
g_debug->header("OpenGL finalized", DebugApi::LogHeaderEnd);
return NULL;
}

g_debug->header("Checking created OpenGL context pixel format", DebugApi::LogHeaderBegin);
g_debug->header("Checking created OpenGL context pixel format", DebugApi::LogHeaderOk);
if(!_osOpenGLMgr->checkOpenGLSDLContextProps()) {
g_debug->header("Different GL context pixel format used", DebugApi::LogHeaderEnd);
g_debug->header("Different GL context pixel format used", DebugApi::LogHeaderWarning);
} else {
g_debug->header("Same GL context pixel format used", DebugApi::LogHeaderEnd);
g_debug->header("Same GL context pixel format used", DebugApi::LogHeaderOk);
}

writeInfo();
Expand Down

0 comments on commit 14ee822

Please sign in to comment.