diff --git a/.vscode/settings.json b/.vscode/settings.json index 0d534e8..a39e00b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -50,6 +50,9 @@ "typeindex": "cpp", "typeinfo": "cpp", "utility": "cpp", - "variant": "cpp" + "variant": "cpp", + "condition_variable": "cpp", + "mutex": "cpp", + "valarray": "cpp" } } \ No newline at end of file diff --git a/CMakeFiles/Progress/1 b/CMakeFiles/Progress/1 new file mode 100644 index 0000000..7b4d68d --- /dev/null +++ b/CMakeFiles/Progress/1 @@ -0,0 +1 @@ +empty \ No newline at end of file diff --git a/CMakeFiles/Progress/count.txt b/CMakeFiles/Progress/count.txt new file mode 100644 index 0000000..48082f7 --- /dev/null +++ b/CMakeFiles/Progress/count.txt @@ -0,0 +1 @@ +12 diff --git a/TODO.txt b/TODO.txt index 86db8ea..0de1cbd 100644 --- a/TODO.txt +++ b/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 diff --git a/include/colour.h b/include/colour.h index c5be5bb..bdfe70f 100644 --- a/include/colour.h +++ b/include/colour.h @@ -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"; } diff --git a/include/logger.h b/include/logger.h index 3e37b12..ca9b1f4 100644 --- a/include/logger.h +++ b/include/logger.h @@ -10,17 +10,27 @@ public: std::cout << getTime() << " " << obj << std::endl; } - template - static void info(T obj) { - std::cout - << getTime() << " [" << Colour::getColouredText(CONSOLE_COLOUR_FG_GREEN, "INFO") - << "] " << obj << std::endl; - } + class Log { + public: + Log(); + + template + 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 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; } diff --git a/src/main.cpp b/src/main.cpp index 59012b5..d1ac87d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,7 +1,12 @@ #include "crumpet-engine/crumpet-engine.h" #include "crumpet-engine/rect.h" +#include + 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);