diff --git a/package.json b/package.json index 767f62b..e480682 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,8 @@ "packages": [ { - "author": "gabime", - "name": "spdlog" + "author": "anulax1225", + "name": "bakatools" }, { "author": "anulax1225", diff --git a/premake5.lua b/premake5.lua index d36e642..a9abd96 100644 --- a/premake5.lua +++ b/premake5.lua @@ -21,7 +21,8 @@ project "bakara" { "_CRT_SECURE_NO_WARNINGS", "GLFW_INCLUDE_NONE", - "IMGUI_IMPL_OPENGL_LOADER_GLAD" + "IMGUI_IMPL_OPENGL_LOADER_GLAD", + "BKMOD_ALL" } includedirs @@ -31,15 +32,16 @@ project "bakara" "%{IncludeDirs.spdlog}", "%{IncludeDirs.glad}", "%{IncludeDirs.glfw}", - "%{IncludeDirs.imgui}" - + "%{IncludeDirs.imgui}", + "%{IncludeDirs.bakatools}" } links { "GLFW", "GLAD", - "ImGui" + "ImGui", + "bakatools" } filter "configurations:Debug" diff --git a/src/bakara/core/assert.h b/src/bakara/core/assert.h deleted file mode 100644 index e222b24..0000000 --- a/src/bakara/core/assert.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -/*! \file assert.h -This file contains the assert macros. CORE macros musn't be used by the application. -*/ - -#include "base.h" -#include - -#ifdef BK_ENABLE_ASSERT - /*! \def BK_CORE_VAMSG_ASSERT(check, msg, ...) - Assertes a condition, and throw an error with the formatted message as description - @param check : Condionne to assert - @param msg : format string error message - @param ... : variable arguments to put in the string - */ - #define BK_CORE_VAMSG_ASSERT(check, msg, ...) if(!(check)) { BK_CORE_ERROR(Tools::format("Assertion [%s] failed at %s:%d\n\tError : %s", BK_STRINGIFY(check), __FILE__, __LINE__, msg), __VA_ARGS__); BK_DEBUGBREAK(); } - #define BK_CORE_MSG_ASSERT(check, msg) if(!(check)) { BK_CORE_ERROR("Assertion [{0}] failed at {1}:{2}\n\tError : {3}", BK_STRINGIFY(check), __FILE__, __LINE__, msg); BK_DEBUGBREAK(); } - #define BK_CORE_ASSERT(check) if(!(check)) { BK_CORE_ERROR("Assertion [{0}] failed at {1}:{2}", BK_STRINGIFY(check), __FILE__, __LINE__); BK_DEBUGBREAK(); } - - #define BK_VAMSG_ASSERT(check, msg, ...) if(!(check)) { BK_ERROR(Bk::Tools::format("Assertion [%s] failed at %s:%d\n\tError : %s", BK_STRINGIFY(check), __FILE__, __LINE__, msg), __VA_ARGS__); BK_DEBUGBREAK(); } - #define BK_MSG_ASSERT(check, msg) if(!(check)) { BK_ERROR("Assertion [{0}] failed at {1}:{2}\n\tError : {3}", BK_STRINGIFY(check), __FILE__, __LINE__, msg); BK_DEBUGBREAK(); } - #define BK_ASSERT(check) if(!(check)) { BK_ERROR("Assertion [{0}] failed at {1}:{2}", BK_STRINGIFY(check), __FILE__, __LINE__); BK_DEBUGBREAK(); } -#else - #define BK_CORE_VAMSG_ASSERT(check, msg, ...) - #define BK_CORE_MSG_ASSERT(check, msg) - #define BK_CORE_ASSERT(check) - - #define BK_VAMSG_ASSERT(check, msg, ...) - #define BK_MSG_ASSERT(check, msg) - #define BK_ASSERT(check) -#endif \ No newline at end of file diff --git a/src/bakara/core/base.h b/src/bakara/core/base.h index 525e0f2..33e47ff 100644 --- a/src/bakara/core/base.h +++ b/src/bakara/core/base.h @@ -1,25 +1,10 @@ #pragma once -#include "log.h" - #define BK_STRINGIFY(x) #x #define BIT_SHIFT(x) (1 << x) #define BK_BIND_EVENT_FN(fn) [this](Event& e) { fn(e); } #define BK_BIND_DISPACHER_FN(event, fn) [this](event& e) -> bool{ return fn(e); } -#ifdef BK_DEBUG - #if defined(BK_PLATFORM_WINDOWS) - #define BK_DEBUGBREAK() __debugbreak() - #elif defined(BK_PLATFORM_LINUX) - #include - #define BK_DEBUGBREAK() raise(SIGTRAP) - #else - #error "Plaform doesn't support debug yet" - #endif - #define BK_ENABLE_ASSERT -#else - #define BK_DEBUGBREAK() -#endif diff --git a/src/bakara/core/log.cpp b/src/bakara/core/log.cpp deleted file mode 100644 index 4d6da7e..0000000 --- a/src/bakara/core/log.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "log.h" - -namespace Bk { - - std::shared_ptr Log::p_core_logger; - std::shared_ptr Log::p_app_logger; - - void Log::init() - { - std::vector log_sinks; - log_sinks.emplace_back(std::make_shared()); - log_sinks.emplace_back(std::make_shared("bakara.log", true)); - - log_sinks[0]->set_pattern("%^[%T] %n: %v%$"); - log_sinks[1]->set_pattern("[%T] [%l] %n: %v"); - - p_core_logger = std::make_shared("BAKARA", begin(log_sinks), end(log_sinks)); - spdlog::register_logger(p_core_logger); - p_core_logger->set_level(spdlog::level::trace); - p_core_logger->flush_on(spdlog::level::trace); - - p_app_logger = std::make_shared("APP", begin(log_sinks), end(log_sinks)); - spdlog::register_logger(p_app_logger); - p_app_logger->set_level(spdlog::level::trace); - p_app_logger->flush_on(spdlog::level::trace); - } - -} \ No newline at end of file diff --git a/src/bakara/core/log.h b/src/bakara/core/log.h deleted file mode 100644 index 1e53a3f..0000000 --- a/src/bakara/core/log.h +++ /dev/null @@ -1,47 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -namespace Bk { - - class Log - { - public: - static void init(); - - static std::shared_ptr& get_core_logger() { return p_core_logger; } - static std::shared_ptr& get_app_logger() { return p_app_logger; } - private: - static std::shared_ptr p_core_logger; - static std::shared_ptr p_app_logger; - }; - #ifdef BK_DEBUG - #define BK_CORE_TRACE(...) ::Bk::Log::get_core_logger()->trace(__VA_ARGS__) - #define BK_CORE_INFO(...) ::Bk::Log::get_core_logger()->info(__VA_ARGS__) - #define BK_CORE_WARN(...) ::Bk::Log::get_core_logger()->warn(__VA_ARGS__) - #define BK_CORE_ERROR(...) ::Bk::Log::get_core_logger()->error(__VA_ARGS__) - #define BK_CORE_CRITICAL(...) ::Bk::Log::get_core_logger()->critical(__VA_ARGS__) - - #define BK_TRACE(...) ::Bk::Log::get_app_logger()->trace(__VA_ARGS__) - #define BK_INFO(...) ::Bk::Log::get_app_logger()->info(__VA_ARGS__) - #define BK_WARN(...) ::Bk::Log::get_app_logger()->warn(__VA_ARGS__) - #define BK_ERROR(...) ::Bk::Log::get_app_logger()->error(__VA_ARGS__) - #define BK_CRITICAL(...) ::Bk::Log::get_app_logger()->critical(__VA_ARGS__) - #else - #define BK_CORE_TRACE(...) - #define BK_CORE_INFO(...) - #define BK_CORE_WARN(...) - #define BK_CORE_ERROR(...) - #define BK_CORE_CRITICAL(...) - - #define BK_TRACE(...) - #define BK_INFO(...) - #define BK_WARN(...) - #define BK_ERROR(...) - #define BK_CRITICAL(...) - #endif -} \ No newline at end of file diff --git a/src/bkpch.h b/src/bkpch.h index 681be0e..97f7159 100644 --- a/src/bkpch.h +++ b/src/bkpch.h @@ -15,6 +15,7 @@ Precompiled headers communly used in bakara. #include #include #include +#include #include #include diff --git a/src/bakara/plaforms/window/glfw/win_glfw.cpp b/src/plaforms/window/glfw/win_glfw.cpp similarity index 100% rename from src/bakara/plaforms/window/glfw/win_glfw.cpp rename to src/plaforms/window/glfw/win_glfw.cpp diff --git a/src/bakara/plaforms/window/glfw/win_glfw.h b/src/plaforms/window/glfw/win_glfw.h similarity index 100% rename from src/bakara/plaforms/window/glfw/win_glfw.h rename to src/plaforms/window/glfw/win_glfw.h