Browse Source

Code cleanup

master
Rick van Vonderen 5 years ago
parent
commit
f5cdd27508
  1. 2
      inferno/src/inferno/application.cpp
  2. 2
      inferno/src/inferno/application.h
  3. 4
      inferno/src/inferno/core.h
  4. 3
      inferno/src/inferno/entrypoint.h
  5. 5
      inferno/src/inferno/event/applicationevent.h
  6. 2
      inferno/src/inferno/event/event.h
  7. 4
      inferno/src/inferno/log.cpp
  8. 14
      inferno/src/inferno/log.h
  9. 4
      inferno/src/inferno/settings.cpp
  10. 2
      inferno/src/inferno/window.h

2
inferno/src/inferno/application.cpp

@ -1,5 +1,3 @@
#include <memory> // unique_ptr
#include <glad/glad.h> #include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>

2
inferno/src/inferno/application.h

@ -1,7 +1,7 @@
#ifndef APPLICATION_H #ifndef APPLICATION_H
#define APPLICATION_H #define APPLICATION_H
#include <memory> // unique_ptr #include <memory> // std::unique_ptr
namespace Inferno { namespace Inferno {

4
inferno/src/inferno/core.h

@ -1,8 +1,8 @@
#ifndef CORE_H #ifndef CORE_H
#define CORE_H #define CORE_H
#include <csignal> // raise #include <csignal> // raise
#include <functional> // bind #include <functional> // std::bind
#define BIT(x) (1 << x) #define BIT(x) (1 << x)

3
inferno/src/inferno/entrypoint.h

@ -17,8 +17,7 @@ int main(int argc, char* argv[])
(void)argv; (void)argv;
// Initialize Log // Initialize Log
Inferno::Log::init(); Inferno::Log::initialize();
NF_CORE_INFO("Initialized Log!");
// Start application // Start application
auto app = Inferno::createApplication(); auto app = Inferno::createApplication();

5
inferno/src/inferno/event/applicationevent.h

@ -1,7 +1,7 @@
#ifndef APPLICATIONEVENT_H #ifndef APPLICATIONEVENT_H
#define APPLICATIONEVENT_H #define APPLICATIONEVENT_H
#include <sstream> // stringstream #include <sstream> // std::stringstream
#include "inferno/event/event.h" #include "inferno/event/event.h"
@ -18,7 +18,8 @@ namespace Inferno {
WindowResizeEvent(int width, int height) : WindowResizeEvent(int width, int height) :
m_width(width), m_height(height) {} m_width(width), m_height(height) {}
virtual std::string toString() const override { virtual std::string toString() const override
{
std::stringstream ss; std::stringstream ss;
ss << "WindowResize: " << m_width << "x" << m_height; ss << "WindowResize: " << m_width << "x" << m_height;
return ss.str(); return ss.str();

2
inferno/src/inferno/event/event.h

@ -1,7 +1,7 @@
#ifndef EVENT_H #ifndef EVENT_H
#define EVENT_H #define EVENT_H
#include <ostream> // ostream #include <ostream> // std::ostream
#include "inferno/core.h" #include "inferno/core.h"

4
inferno/src/inferno/log.cpp

@ -6,12 +6,14 @@ namespace Inferno {
std::shared_ptr<Logger> Log::m_coreLogger; std::shared_ptr<Logger> Log::m_coreLogger;
std::shared_ptr<Logger> Log::m_gameLogger; std::shared_ptr<Logger> Log::m_gameLogger;
void Log::init() void Log::initialize()
{ {
// Create engine Logger // Create engine Logger
m_coreLogger = std::make_shared<Logger>("Inferno"); m_coreLogger = std::make_shared<Logger>("Inferno");
// Create game Logger // Create game Logger
m_gameLogger = std::make_shared<Logger>("Game"); m_gameLogger = std::make_shared<Logger>("Game");
NF_CORE_INFO("Log initialized");
} }
Logger::Logger(const char* name) : Logger::Logger(const char* name) :

14
inferno/src/inferno/log.h

@ -1,19 +1,18 @@
#ifndef LOG_H #ifndef LOG_H
#define LOG_H #define LOG_H
#include <cstdio> // sprintf, printf #include <cstdio> // printf, sprintf
#include <cstring> // strlen #include <cstring> // strlen
#include <memory> // shared_ptr #include <memory> // std::shared_ptr
#include <string> // string #include <string> // std::string
namespace Inferno { namespace Inferno {
class Logger; class Logger;
class Log class Log {
{
public: public:
static void init(); static void initialize();
// ----------------------------------------- // -----------------------------------------
@ -25,8 +24,7 @@ namespace Inferno {
static std::shared_ptr<Logger> m_gameLogger; static std::shared_ptr<Logger> m_gameLogger;
}; };
class Logger class Logger {
{
public: public:
Logger(const char* name); Logger(const char* name);
~Logger(); ~Logger();

4
inferno/src/inferno/settings.cpp

@ -1,6 +1,6 @@
#include <fstream> // std::ifstream, std::ofstream #include <fstream> // std::ifstream, std::ofstream
#include <iomanip> // std::setfill, std::setw #include <iomanip> // std::setfill, std::setw
#include <string> // std::string #include <string> // std::string
#include "inferno/core.h" #include "inferno/core.h"
#include "inferno/log.h" #include "inferno/log.h"
@ -26,7 +26,7 @@ namespace Inferno {
void Settings::initialize() void Settings::initialize()
{ {
nlohmann::json m_json = load(); nlohmann::json m_json = this->load();
try { try {
m_properties.title = m_json["window"]["title"].get<std::string>().c_str(); m_properties.title = m_json["window"]["title"].get<std::string>().c_str();

2
inferno/src/inferno/window.h

@ -1,7 +1,7 @@
#ifndef WINDOW_H #ifndef WINDOW_H
#define WINDOW_H #define WINDOW_H
#include <functional> // function #include <functional> // std::function
class GLFWwindow; class GLFWwindow;

Loading…
Cancel
Save