2005-05-26 03:59:23 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2005, Stephan Aßmus <superstippi@gmx.de>. 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DEBUG_INFO_MANAGER_H
|
|
|
|
#define DEBUG_INFO_MANAGER_H
|
|
|
|
|
|
|
|
#include <OS.h>
|
|
|
|
|
|
|
|
#if __HAIKU__
|
2005-11-10 16:38:22 +03:00
|
|
|
# define ON_SCREEN_DEBUGGING_INFO 0
|
2005-05-26 03:59:23 +04:00
|
|
|
#else
|
2005-11-10 16:38:22 +03:00
|
|
|
# define ON_SCREEN_DEBUGGING_INFO 0
|
2005-05-26 03:59:23 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ON_SCREEN_DEBUGGING_INFO
|
|
|
|
extern char* gDebugString;
|
|
|
|
# define CRITICAL(x) { sprintf(gDebugString, (x)); DebugInfoManager::Default()->AddInfo(gDebugString); }
|
|
|
|
#else
|
2005-11-10 16:38:22 +03:00
|
|
|
//# define CRITICAL(x) debugger (x)
|
|
|
|
# define CRITICAL(x) ;
|
2005-05-26 03:59:23 +04:00
|
|
|
#endif // ON_SCREEN_DEBUGGING_INFO
|
|
|
|
|
|
|
|
class DebugInfoManager {
|
2005-07-12 21:41:22 +04:00
|
|
|
public:
|
|
|
|
virtual ~DebugInfoManager();
|
2005-05-26 03:59:23 +04:00
|
|
|
|
2005-07-12 21:41:22 +04:00
|
|
|
static DebugInfoManager *Default();
|
|
|
|
void AddInfo(const char* string);
|
2005-05-26 03:59:23 +04:00
|
|
|
|
2005-07-12 21:41:22 +04:00
|
|
|
private:
|
|
|
|
DebugInfoManager();
|
|
|
|
static DebugInfoManager *sDefaultInstance;
|
2005-05-26 03:59:23 +04:00
|
|
|
|
|
|
|
#if ON_SCREEN_DEBUGGING_INFO
|
2005-07-12 21:41:22 +04:00
|
|
|
friend class RootLayer;
|
|
|
|
void SetRootLayer(RootLayer* layer);
|
2005-05-26 03:59:23 +04:00
|
|
|
|
2005-07-12 21:41:22 +04:00
|
|
|
RootLayer *fRootLayer;
|
2005-05-26 03:59:23 +04:00
|
|
|
#endif // ON_SCREEN_DEBUGGING_INFO
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // DEBUG_INFO_H
|