SUNENGINE 0.0.2
A simple and bright C++ game engine.
 
Loading...
Searching...
No Matches
ScreenLog.h
1#ifndef ScreenLog_H
2#define ScreenLog_H
3
4#include <queue>
5
7class SpriteFont;
9
17class ScreenLog
18{
19public:
20 friend class ScreenLogAttorney;
21
26 static void SetFont(SpriteFont* font) { Instance().privSetFont(font); }
27
33 static void SetAnchor(int x, int y) { Instance().privSetAnchor(x, y); }
34
40 static void AddLog(char* A, ...);
41
42private:
43 static ScreenLog* ptrInstance;
44
45 static ScreenLog& Instance()
46 {
47 if (ptrInstance == nullptr)
48 {
49 ptrInstance = new ScreenLog();
50 }
51 return *ptrInstance;
52 }
53
54 ScreenLog();
55 ScreenLog(const ScreenLog&) = delete;
56 ScreenLog& operator=(const ScreenLog&) = delete;
57 ~ScreenLog() = default;
58
63
67 std::queue<ScreenLogCommand*> ActiveCommands;
68
73
78
83
87 static char DebugBuff[256];
88
92 static void RenderLog();
93
97 static void Delete();
98
99 void privSetFont(SpriteFont* font);
100 void privSetAnchor(int x, int y);
101};
102
103#endif
Definition ScreenLogCommand.h:10
Manages a pool of ScreenLogCommand objects for efficient reuse.
Definition ScreenLogCommandPool.h:17
Manages logging messages to the screen.
Definition ScreenLog.h:18
static void AddLog(char *A,...)
Adds a log message to the screen log.
Definition ScreenLog.cpp:27
std::queue< ScreenLogCommand * > ActiveCommands
Queue of active ScreenLogCommand objects.
Definition ScreenLog.h:67
int anchorX
The x-coordinate of the anchor position.
Definition ScreenLog.h:77
static void SetFont(SpriteFont *font)
Sets the font for the screen log.
Definition ScreenLog.h:26
static void SetAnchor(int x, int y)
Sets the anchor position for the screen log.
Definition ScreenLog.h:33
static char DebugBuff[256]
Buffer for formatting debug messages.
Definition ScreenLog.h:87
int anchorY
The y-coordinate of the anchor position.
Definition ScreenLog.h:82
ScreenLogCommandPool * CommandPool
Pool of available ScreenLogCommand objects.
Definition ScreenLog.h:62
SpriteFont * pFont
Pointer to the SpriteFont used for rendering log messages.
Definition ScreenLog.h:72
static void Delete()
Deletes the singleton instance of the ScreenLog.
Definition ScreenLog.cpp:51
static void RenderLog()
Renders the log messages on the screen.
Definition ScreenLog.cpp:40
Represents a font in the SUNENGINE.
Definition SpriteFont.h:19