diff --git a/Dependencies/imgui b/Dependencies/imgui index 8e83474..3ee908d 160000 --- a/Dependencies/imgui +++ b/Dependencies/imgui @@ -1 +1 @@ -Subproject commit 8e834740f0f1a9422ebb104087e26ad218c50173 +Subproject commit 3ee908d0db082aba35decf4f33bec9ec3e1376eb diff --git a/Engine/src/Engine/Base/Config.h b/Engine/src/Engine/Base/Config.h index e697914..bb88417 100644 --- a/Engine/src/Engine/Base/Config.h +++ b/Engine/src/Engine/Base/Config.h @@ -3,13 +3,14 @@ #define LIGHT_CONFIG_H // -// you can uncomment any of these definitions to config the project to your liking +// you can uncomment any of these definitions to config the project to your +// liking // // suppress undefined debug trap -// #define LIGHT_IGNORE_UNDEFINED_DEBUG_TRAP +#define LIGHT_IGNORE_UNDEFINED_DEBUG_TRAP // log opengl shader compile info // #define LIGHT_OPENGL_ENABLE_SHADER_INFO_LOG -#endif \ No newline at end of file +#endif diff --git a/Engine/src/Engine/Base/Portables/DebugTrap.h b/Engine/src/Engine/Base/Portables/DebugTrap.h index 0e736c2..bc36351 100644 --- a/Engine/src/Engine/Base/Portables/DebugTrap.h +++ b/Engine/src/Engine/Base/Portables/DebugTrap.h @@ -2,105 +2,126 @@ #ifndef LIGHT_DEBUG_TRAP_H #define LIGHT_DEBUG_TRAP_H +#include "Base/Base.h" + // https://github.com/nemequ/portable-snippets/tree/master/debug-trap #ifdef LIGHT_DIST - #ifdef _MSC_VER - #define LT_DEBUG_TRAP() LT_FILE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}, FILE: {}, LINE: {}", __FUNCSIG__, __FILE__, __LINE__) // or __FUNCSIG__ +#ifdef _MSC_VER +#define LT_DEBUG_TRAP() \ + LT_FILE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}, FILE: {}, LINE: {}", \ + __FUNCSIG__, __FILE__, __LINE__) // or __FUNCSIG__ - #else - #define LT_DEBUG_TRAP() LT_FILE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}", __PRETTY_FUNCTION__ ) +#else +#define LT_DEBUG_TRAP() \ + LT_FILE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}", __PRETTY_FUNCTION__) - #endif +#endif #endif #if !defined(LT_DEBUG_TRAP) && defined(__has_builtin) && !defined(__ibmxl__) - #if __has_builtin(__builtin_debugtrap) - #define LT_DEBUG_TRAP() __builtin_debugtrap() +#if __has_builtin(__builtin_debugtrap) +#define LT_DEBUG_TRAP() __builtin_debugtrap() - #elif __has_builtin(__debugbreak) - #define LT_DEBUG_TRAP() __debugbreak() +#elif __has_builtin(__debugbreak) +#define LT_DEBUG_TRAP() __debugbreak() - #endif +#endif #endif #if !defined(LT_DEBUG_TRAP) - #if defined(_MSC_VER) || defined(__INTEL_COMPILER) - #define LT_DEBUG_TRAP() __debugbreak() +#if defined(_MSC_VER) || defined(__INTEL_COMPILER) +#define LT_DEBUG_TRAP() __debugbreak() - #elif defined(__ARMCC_VERSION) - #define LT_DEBUG_TRAP() __breakpoint(42) +#elif defined(__ARMCC_VERSION) +#define LT_DEBUG_TRAP() __breakpoint(42) - #elif defined(__ibmxl__) || defined(__xlC__) - #include - #define LT_DEBUG_TRAP() __trap(42) +#elif defined(__ibmxl__) || defined(__xlC__) +#include +#define LT_DEBUG_TRAP() __trap(42) - #elif defined(__DMC__) && defined(_M_IX86) - static inline void LT_DEBUG_TRAP(void) { __asm int 3h; } +#elif defined(__DMC__) && defined(_M_IX86) +static inline void LT_DEBUG_TRAP(void) { __asm int 3h; } - #elif defined(__i386__) || defined(__x86_64__) - static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("int3"); } +#elif defined(__i386__) || defined(__x86_64__) +static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("int3"); } - #elif defined(__thumb__) - static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__(".inst 0xde01"); } +#elif defined(__thumb__) +static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__(".inst 0xde01"); } - #elif defined(__aarch64__) - static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__(".inst 0xd4200000"); } +#elif defined(__aarch64__) +static inline void LT_DEBUG_TRAP(void) { + __asm__ __volatile__(".inst 0xd4200000"); +} - #elif defined(__arm__) - static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__(".inst 0xe7f001f0"); } +#elif defined(__arm__) +static inline void LT_DEBUG_TRAP(void) { + __asm__ __volatile__(".inst 0xe7f001f0"); +} - #elif defined (__alpha__) && !defined(__osf__) - static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("bpt"); } +#elif defined(__alpha__) && !defined(__osf__) +static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("bpt"); } - #elif defined(_54_) - static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("ESTOP"); } +#elif defined(_54_) +static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("ESTOP"); } - #elif defined(_55_) - static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__(";\n .if (.MNEMONIC)\n ESTOP_1\n .else\n ESTOP_1()\n .endif\n NOP"); } +#elif defined(_55_) +static inline void LT_DEBUG_TRAP(void) { + __asm__ __volatile__( + ";\n .if (.MNEMONIC)\n ESTOP_1\n .else\n ESTOP_1()\n .endif\n NOP"); +} - #elif defined(_64P_) - static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("SWBP 0"); } +#elif defined(_64P_) +static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("SWBP 0"); } - #elif defined(_6x_) - static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("NOP\n .word 0x10000000"); } +#elif defined(_6x_) +static inline void LT_DEBUG_TRAP(void) { + __asm__ __volatile__("NOP\n .word 0x10000000"); +} - #elif defined(__STDC_HOSTED__) && (__STDC_HOSTED__ == 0) && defined(__GNUC__) - #define LT_DEBUG_TRAP() __builtin_trap() +#elif defined(__STDC_HOSTED__) && (__STDC_HOSTED__ == 0) && defined(__GNUC__) +#define LT_DEBUG_TRAP() __builtin_trap() - #else - #include +#else +#include - #if defined(SIGTRAP) - #define LT_DEBUG_TRAP() raise(SIGTRAP) +#if defined(SIGTRAP) +#define LT_DEBUG_TRAP() raise(SIGTRAP) - #else - #define LT_DEBUG_TRAP() raise(SIGABRT) +#else +#define LT_DEBUG_TRAP() raise(SIGABRT) - #endif - #endif +#endif +#endif #endif #if !defined(LT_DEBUG_TRAP) - #if !defined(LIGHT_IGNORE_UNDEFINED_DEBUG_TRAP) - #error "failed to define LT_BREAK, define LIGHT_IGNORE_UNDEFINED_DEBUG_TRAP in Config.h to disable this error" +#if !defined(LIGHT_IGNORE_UNDEFINED_DEBUG_TRAP) +#error \ + "failed to define LT_BREAK, define LIGHT_IGNORE_UNDEFINED_DEBUG_TRAP in Config.h to disable this error" + +#elif defined(LIGHT_DIST) +#ifdef _MSC_VER +#define LT_DEBUG_TRAP() \ + LT_FILE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}, FILE: {}, LINE: {}", \ + __FUNCSIG__, __FILE__, __LINE__) // or __FUNCSIG__ + +#else +#define LT_DEBUG_TRAP() \ + LT_FILE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}", __PRETTY_FUNCTION__) + +#endif +#else /* !defined(LIGHT_DIST) */ +#ifdef _MSC_VER +#define LT_DEBUG_TRAP() \ + LT_ENGINE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}, FILE: {}, LINE: {}", \ + __FUNCSIG__, __FILE__, __LINE__) // or __FUNCSIG__ + +#else +#define LT_DEBUG_TRAP() \ + LT_ENGINE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}", __PRETTY_FUNCTION__) - #elif defined(LIGHT_DIST) - #ifdef _MSC_VER - #define LT_DEBUG_TRAP() LT_FILE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}, FILE: {}, LINE: {}", __FUNCSIG__, __FILE__, __LINE__) // or __FUNCSIG__ - - #else - #define LT_DEBUG_TRAP() LT_FILE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}", __PRETTY_FUNCTION__ ) - - #endif - #else /* !defined(LIGHT_DIST) */ - #ifdef _MSC_VER - #define LT_DEBUG_TRAP() LT_ENGINE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}, FILE: {}, LINE: {}", __FUNCSIG__, __FILE__, __LINE__) // or __FUNCSIG__ - - #else - #define LT_DEBUG_TRAP() LT_ENGINE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}", __PRETTY_FUNCTION__ ) - - #endif #endif #endif -#endif \ No newline at end of file +#endif +#endif diff --git a/Engine/src/Engine/Scene/Components/ScriptableEntity.h b/Engine/src/Engine/Scene/Components/ScriptableEntity.h index 0c06110..2ebf6a3 100644 --- a/Engine/src/Engine/Scene/Components/ScriptableEntity.h +++ b/Engine/src/Engine/Scene/Components/ScriptableEntity.h @@ -1,34 +1,30 @@ #pragma once -#include "Entity.h" +#include "Scene/Entity.h" #include "Base/Base.h" namespace Light { - class NativeScript - { - friend class Scene; - private: - Entity m_Entity; - unsigned int m_UniqueIdentifier = 0; // :#todo +class NativeScript { + friend class Scene; - public: - NativeScript() = default; - virtual ~NativeScript() = default; +private: + Entity m_Entity; + unsigned int m_UniqueIdentifier = 0; // :#todo - inline unsigned int GetUID() const { return m_UniqueIdentifier; } +public: + NativeScript() = default; + virtual ~NativeScript() = default; - template - T& GetComponent() - { - return m_Entity.GetComponent(); - } + inline unsigned int GetUID() const { return m_UniqueIdentifier; } - protected: - virtual void OnCreate () {} - virtual void OnDestroy() {} - virtual void OnUpdate(float ts) {} - }; + template T &GetComponent() { return m_Entity.GetComponent(); } -} \ No newline at end of file +protected: + virtual void OnCreate() {} + virtual void OnDestroy() {} + virtual void OnUpdate(float ts) {} +}; + +} // namespace Light