Overload Logger started
This commit is contained in:
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@@ -50,6 +50,9 @@
|
||||
"typeindex": "cpp",
|
||||
"typeinfo": "cpp",
|
||||
"utility": "cpp",
|
||||
"variant": "cpp"
|
||||
"variant": "cpp",
|
||||
"condition_variable": "cpp",
|
||||
"mutex": "cpp",
|
||||
"valarray": "cpp"
|
||||
}
|
||||
}
|
||||
1
CMakeFiles/Progress/1
Normal file
1
CMakeFiles/Progress/1
Normal file
@@ -0,0 +1 @@
|
||||
empty
|
||||
1
CMakeFiles/Progress/count.txt
Normal file
1
CMakeFiles/Progress/count.txt
Normal file
@@ -0,0 +1 @@
|
||||
12
|
||||
2
TODO.txt
2
TODO.txt
@@ -9,7 +9,7 @@ x -> complete
|
||||
|
||||
**TODO**
|
||||
[-] Comment the code
|
||||
[ ] Overload operators in the logger and support for streams
|
||||
[?] Overload operators in the logger and support for streams
|
||||
[ ] Entity system
|
||||
[ ] Entity manager
|
||||
[ ] Ability to make entities and manage textures between them
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
|
||||
static void resetColour() {
|
||||
std::cout
|
||||
<< "\033[" << CONSOLE_COLOUR_BG_DEFAULT << "m";
|
||||
<< "\033[" << CONSOLE_COLOUR_BG_DEFAULT << "m"
|
||||
<< "\033[" << CONSOLE_COLOUR_FG_DEFAULT << "m";
|
||||
}
|
||||
|
||||
|
||||
@@ -10,17 +10,27 @@ public:
|
||||
std::cout << getTime() << " " << obj << std::endl;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
static void info(T obj) {
|
||||
std::cout
|
||||
<< getTime() << " [" << Colour::getColouredText(CONSOLE_COLOUR_FG_GREEN, "INFO")
|
||||
<< "] " << obj << std::endl;
|
||||
}
|
||||
class Log {
|
||||
public:
|
||||
Log();
|
||||
|
||||
template<class T>
|
||||
Log* operator<<(T obj) {
|
||||
m_stream << obj;
|
||||
return this;
|
||||
}
|
||||
~Log() {
|
||||
std::string output = m_stream.str();
|
||||
Logger::log(output);
|
||||
}
|
||||
private:
|
||||
std::stringstream m_stream;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
static void info(T obj) {
|
||||
std::cout
|
||||
<< getTime() << " [" << Colour::getColouredText(CONSOLE_COLOUR_FG_LIGHT_BLUE, "DEBUG")
|
||||
<< getTime() << " [" << Colour::getColouredText(CONSOLE_COLOUR_FG_GREEN, "INFO")
|
||||
<< "] " << obj << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
#include "crumpet-engine/crumpet-engine.h"
|
||||
#include "crumpet-engine/rect.h"
|
||||
|
||||
#include <logger.h>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
Logger.Log() << "Okay, this is epic" << 1234;
|
||||
|
||||
Game game;
|
||||
game.renderer.createWindow("Crumpet Engine", 600, 400, SCREEN_MODE_VSYNC);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user