Linux fix
This commit is contained in:
parent
786535bac7
commit
f46cf23550
4 changed files with 110 additions and 92 deletions
2
Dependencies/imgui
vendored
2
Dependencies/imgui
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 8e834740f0f1a9422ebb104087e26ad218c50173
|
Subproject commit 3ee908d0db082aba35decf4f33bec9ec3e1376eb
|
|
@ -3,13 +3,14 @@
|
||||||
#define LIGHT_CONFIG_H
|
#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
|
// suppress undefined debug trap
|
||||||
// #define LIGHT_IGNORE_UNDEFINED_DEBUG_TRAP
|
#define LIGHT_IGNORE_UNDEFINED_DEBUG_TRAP
|
||||||
|
|
||||||
// log opengl shader compile info
|
// log opengl shader compile info
|
||||||
// #define LIGHT_OPENGL_ENABLE_SHADER_INFO_LOG
|
// #define LIGHT_OPENGL_ENABLE_SHADER_INFO_LOG
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,105 +2,126 @@
|
||||||
#ifndef LIGHT_DEBUG_TRAP_H
|
#ifndef LIGHT_DEBUG_TRAP_H
|
||||||
#define LIGHT_DEBUG_TRAP_H
|
#define LIGHT_DEBUG_TRAP_H
|
||||||
|
|
||||||
|
#include "Base/Base.h"
|
||||||
|
|
||||||
// https://github.com/nemequ/portable-snippets/tree/master/debug-trap
|
// https://github.com/nemequ/portable-snippets/tree/master/debug-trap
|
||||||
|
|
||||||
#ifdef LIGHT_DIST
|
#ifdef LIGHT_DIST
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define LT_DEBUG_TRAP() LT_FILE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}, FILE: {}, LINE: {}", __FUNCSIG__, __FILE__, __LINE__) // or __FUNCSIG__
|
#define LT_DEBUG_TRAP() \
|
||||||
|
LT_FILE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}, FILE: {}, LINE: {}", \
|
||||||
|
__FUNCSIG__, __FILE__, __LINE__) // or __FUNCSIG__
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define LT_DEBUG_TRAP() LT_FILE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}", __PRETTY_FUNCTION__ )
|
#define LT_DEBUG_TRAP() \
|
||||||
|
LT_FILE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}", __PRETTY_FUNCTION__)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(LT_DEBUG_TRAP) && defined(__has_builtin) && !defined(__ibmxl__)
|
#if !defined(LT_DEBUG_TRAP) && defined(__has_builtin) && !defined(__ibmxl__)
|
||||||
#if __has_builtin(__builtin_debugtrap)
|
#if __has_builtin(__builtin_debugtrap)
|
||||||
#define LT_DEBUG_TRAP() __builtin_debugtrap()
|
#define LT_DEBUG_TRAP() __builtin_debugtrap()
|
||||||
|
|
||||||
#elif __has_builtin(__debugbreak)
|
#elif __has_builtin(__debugbreak)
|
||||||
#define LT_DEBUG_TRAP() __debugbreak()
|
#define LT_DEBUG_TRAP() __debugbreak()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(LT_DEBUG_TRAP)
|
#if !defined(LT_DEBUG_TRAP)
|
||||||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||||
#define LT_DEBUG_TRAP() __debugbreak()
|
#define LT_DEBUG_TRAP() __debugbreak()
|
||||||
|
|
||||||
#elif defined(__ARMCC_VERSION)
|
#elif defined(__ARMCC_VERSION)
|
||||||
#define LT_DEBUG_TRAP() __breakpoint(42)
|
#define LT_DEBUG_TRAP() __breakpoint(42)
|
||||||
|
|
||||||
#elif defined(__ibmxl__) || defined(__xlC__)
|
#elif defined(__ibmxl__) || defined(__xlC__)
|
||||||
#include <builtins.h>
|
#include <builtins.h>
|
||||||
#define LT_DEBUG_TRAP() __trap(42)
|
#define LT_DEBUG_TRAP() __trap(42)
|
||||||
|
|
||||||
#elif defined(__DMC__) && defined(_M_IX86)
|
#elif defined(__DMC__) && defined(_M_IX86)
|
||||||
static inline void LT_DEBUG_TRAP(void) { __asm int 3h; }
|
static inline void LT_DEBUG_TRAP(void) { __asm int 3h; }
|
||||||
|
|
||||||
#elif defined(__i386__) || defined(__x86_64__)
|
#elif defined(__i386__) || defined(__x86_64__)
|
||||||
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("int3"); }
|
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("int3"); }
|
||||||
|
|
||||||
#elif defined(__thumb__)
|
#elif defined(__thumb__)
|
||||||
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__(".inst 0xde01"); }
|
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__(".inst 0xde01"); }
|
||||||
|
|
||||||
#elif defined(__aarch64__)
|
#elif defined(__aarch64__)
|
||||||
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__(".inst 0xd4200000"); }
|
static inline void LT_DEBUG_TRAP(void) {
|
||||||
|
__asm__ __volatile__(".inst 0xd4200000");
|
||||||
|
}
|
||||||
|
|
||||||
#elif defined(__arm__)
|
#elif defined(__arm__)
|
||||||
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__(".inst 0xe7f001f0"); }
|
static inline void LT_DEBUG_TRAP(void) {
|
||||||
|
__asm__ __volatile__(".inst 0xe7f001f0");
|
||||||
|
}
|
||||||
|
|
||||||
#elif defined (__alpha__) && !defined(__osf__)
|
#elif defined(__alpha__) && !defined(__osf__)
|
||||||
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("bpt"); }
|
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("bpt"); }
|
||||||
|
|
||||||
#elif defined(_54_)
|
#elif defined(_54_)
|
||||||
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("ESTOP"); }
|
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("ESTOP"); }
|
||||||
|
|
||||||
#elif defined(_55_)
|
#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"); }
|
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_)
|
#elif defined(_64P_)
|
||||||
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("SWBP 0"); }
|
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("SWBP 0"); }
|
||||||
|
|
||||||
#elif defined(_6x_)
|
#elif defined(_6x_)
|
||||||
static inline void LT_DEBUG_TRAP(void) { __asm__ __volatile__("NOP\n .word 0x10000000"); }
|
static inline void LT_DEBUG_TRAP(void) {
|
||||||
|
__asm__ __volatile__("NOP\n .word 0x10000000");
|
||||||
|
}
|
||||||
|
|
||||||
#elif defined(__STDC_HOSTED__) && (__STDC_HOSTED__ == 0) && defined(__GNUC__)
|
#elif defined(__STDC_HOSTED__) && (__STDC_HOSTED__ == 0) && defined(__GNUC__)
|
||||||
#define LT_DEBUG_TRAP() __builtin_trap()
|
#define LT_DEBUG_TRAP() __builtin_trap()
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#if defined(SIGTRAP)
|
#if defined(SIGTRAP)
|
||||||
#define LT_DEBUG_TRAP() raise(SIGTRAP)
|
#define LT_DEBUG_TRAP() raise(SIGTRAP)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define LT_DEBUG_TRAP() raise(SIGABRT)
|
#define LT_DEBUG_TRAP() raise(SIGABRT)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(LT_DEBUG_TRAP)
|
#if !defined(LT_DEBUG_TRAP)
|
||||||
#if !defined(LIGHT_IGNORE_UNDEFINED_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"
|
#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
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
|
@ -1,34 +1,30 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Entity.h"
|
#include "Scene/Entity.h"
|
||||||
|
|
||||||
#include "Base/Base.h"
|
#include "Base/Base.h"
|
||||||
|
|
||||||
namespace Light {
|
namespace Light {
|
||||||
|
|
||||||
class NativeScript
|
class NativeScript {
|
||||||
{
|
friend class Scene;
|
||||||
friend class Scene;
|
|
||||||
private:
|
|
||||||
Entity m_Entity;
|
|
||||||
unsigned int m_UniqueIdentifier = 0; // :#todo
|
|
||||||
|
|
||||||
public:
|
private:
|
||||||
NativeScript() = default;
|
Entity m_Entity;
|
||||||
virtual ~NativeScript() = default;
|
unsigned int m_UniqueIdentifier = 0; // :#todo
|
||||||
|
|
||||||
inline unsigned int GetUID() const { return m_UniqueIdentifier; }
|
public:
|
||||||
|
NativeScript() = default;
|
||||||
|
virtual ~NativeScript() = default;
|
||||||
|
|
||||||
template<typename T>
|
inline unsigned int GetUID() const { return m_UniqueIdentifier; }
|
||||||
T& GetComponent()
|
|
||||||
{
|
|
||||||
return m_Entity.GetComponent<T>();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
template <typename T> T &GetComponent() { return m_Entity.GetComponent<T>(); }
|
||||||
virtual void OnCreate () {}
|
|
||||||
virtual void OnDestroy() {}
|
|
||||||
virtual void OnUpdate(float ts) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
protected:
|
||||||
|
virtual void OnCreate() {}
|
||||||
|
virtual void OnDestroy() {}
|
||||||
|
virtual void OnUpdate(float ts) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Light
|
||||||
|
|
Loading…
Add table
Reference in a new issue