added a little debugging facility for printing on-screen debugging info on Haiku. For those like me without serial debugging... also made RootLayer use the desktop background color.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12819 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2005-05-25 23:59:23 +00:00
parent d85db27509
commit d593ad8f06
7 changed files with 195 additions and 33 deletions
+64
View File
@@ -0,0 +1,64 @@
/*
* Copyright 2005, Stephan Aßmus <[email protected]>. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Class used to manage global access to on-screen debugging info
* in the RootLayer class.
*
*/
#include "RootLayer.h"
#include "DebugInfoManager.h"
// init globals
DebugInfoManager*
DebugInfoManager::sDefaultInstance = NULL;
#if ON_SCREEN_DEBUGGING_INFO
char* gDebugString = new char[2048];
#endif
// destructor
DebugInfoManager::~DebugInfoManager()
{
}
// Default
DebugInfoManager*
DebugInfoManager::Default()
{
if (!sDefaultInstance)
sDefaultInstance = new DebugInfoManager();
return sDefaultInstance;
}
// AddInfo
void
DebugInfoManager::AddInfo(const char* string)
{
#if ON_SCREEN_DEBUGGING_INFO
if (fRootLayer) {
fRootLayer->AddDebugInfo(string);
}
#endif // ON_SCREEN_DEBUGGING_INFO
}
// constructor
DebugInfoManager::DebugInfoManager()
#if ON_SCREEN_DEBUGGING_INFO
: fRootLayer(NULL)
#endif // ON_SCREEN_DEBUGGING_INFO
{
gDebugString[0] = 0;
}
#if ON_SCREEN_DEBUGGING_INFO
// SetRootLayer
void
DebugInfoManager::SetRootLayer(RootLayer* layer)
{
fRootLayer = layer;
}
#endif // ON_SCREEN_DEBUGGING_INFO