Linux fix

This commit is contained in:
Light3039 2021-08-03 17:34:45 +04:30
parent 786535bac7
commit f46cf23550
4 changed files with 110 additions and 92 deletions

2
Dependencies/imgui vendored

@ -1 +1 @@
Subproject commit 8e834740f0f1a9422ebb104087e26ad218c50173
Subproject commit 3ee908d0db082aba35decf4f33bec9ec3e1376eb

View file

@ -3,11 +3,12 @@
#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

View file

@ -2,14 +2,19 @@
#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__
#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__ )
#define LT_DEBUG_TRAP() \
LT_FILE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}", __PRETTY_FUNCTION__)
#endif
#endif
@ -45,10 +50,14 @@
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"); }
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"); }
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"); }
@ -57,13 +66,18 @@
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"); }
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(_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__)
#define LT_DEBUG_TRAP() __builtin_trap()
@ -83,22 +97,29 @@
#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"
#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__
#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__ )
#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__
#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__ )
#define LT_DEBUG_TRAP() \
LT_ENGINE_CRITICAL("DEBUG_TRAP REQUESTED AT: {}", __PRETTY_FUNCTION__)
#endif
#endif

View file

@ -1,14 +1,14 @@
#pragma once
#include "Entity.h"
#include "Scene/Entity.h"
#include "Base/Base.h"
namespace Light {
class NativeScript
{
class NativeScript {
friend class Scene;
private:
Entity m_Entity;
unsigned int m_UniqueIdentifier = 0; // :#todo
@ -19,11 +19,7 @@ namespace Light {
inline unsigned int GetUID() const { return m_UniqueIdentifier; }
template<typename T>
T& GetComponent()
{
return m_Entity.GetComponent<T>();
}
template <typename T> T &GetComponent() { return m_Entity.GetComponent<T>(); }
protected:
virtual void OnCreate() {}
@ -31,4 +27,4 @@ namespace Light {
virtual void OnUpdate(float ts) {}
};
}
} // namespace Light