add submodule box2D, add mono lib for linux and some minor code tweaks
This commit is contained in:
@@ -23,3 +23,6 @@
|
||||
[submodule "Prism/vendor/yaml-cpp"]
|
||||
path = Prism/vendor/yaml-cpp
|
||||
url = https://github.com/jbeder/yaml-cpp
|
||||
[submodule "Prism/vendor/Box2D"]
|
||||
path = Prism/vendor/Box2D
|
||||
url = https://github.com/erincatto/box2d.git
|
||||
|
||||
@@ -17,6 +17,7 @@ add_subdirectory(vendor/EnTT EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(vendor/mono EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(vendor/FastNoise EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(vendor/yaml-cpp EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(vendor/Box2D EXCLUDE_FROM_ALL)
|
||||
|
||||
|
||||
# ------------- imgui -------------
|
||||
@@ -54,6 +55,7 @@ set(LINK_LIBRARIES_PRIVATE
|
||||
tinyFileDialogs
|
||||
FastNoise
|
||||
yaml-cpp
|
||||
box2d
|
||||
)
|
||||
|
||||
set(LINK_LIBRARIES_PUBLIC
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
namespace Prism
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#define BIND_EVENT_FN(fn) std::bind(&Application::##fn, this, std::placeholders::_1)
|
||||
#else
|
||||
#define BIND_EVENT_FN(fn) std::bind(&Application::fn, this, std::placeholders::_1)
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Prism
|
||||
Application* CreateApplication();
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#define PM_BIND_EVENT_FN(fn) std::bind(&##fn, this, std::placeholders::_1)
|
||||
#else
|
||||
#define PM_BIND_EVENT_FN(fn) std::bind(&fn, this, std::placeholders::_1)
|
||||
|
||||
@@ -42,13 +42,15 @@ namespace Prism
|
||||
#define PM_DEBUGBREAK() asm("int3")
|
||||
#endif
|
||||
|
||||
#define PM_EXPEND_VARGS(x) x
|
||||
|
||||
#define PM_ASSERT_NO_MESSAGE(condition) { if(!(condition)) { PM_CORE_ERROR("Assertion Failed!"); PM_DEBUGBREAK(); } }
|
||||
#define PM_ASSERT_MESSAGE(condition, ...) { if(!(condition)) { PM_CORE_ERROR("Assertion Failed: {0}", __VA_ARGS__); PM_DEBUGBREAK(); } }
|
||||
|
||||
#define PM_ASSERT_RESOLVE(arg1, arg2, macro, ...) macro
|
||||
|
||||
#define PM_ASSERT(...) PM_ASSERT_RESOLVE(__VA_ARGS__, PM_ASSERT_MESSAGE, PM_ASSERT_NO_MESSAGE)(__VA_ARGS__)
|
||||
#define PM_CORE_ASSERT(...) PM_ASSERT_RESOLVE(__VA_ARGS__, PM_ASSERT_MESSAGE, PM_ASSERT_NO_MESSAGE)(__VA_ARGS__)
|
||||
#define PM_ASSERT(...) PM_EXPEND_VARGS(PM_ASSERT_RESOLVE(__VA_ARGS__, PM_ASSERT_MESSAGE, PM_ASSERT_NO_MESSAGE)(__VA_ARGS__))
|
||||
#define PM_CORE_ASSERT(...) PM_EXPEND_VARGS(PM_ASSERT_RESOLVE(__VA_ARGS__, PM_ASSERT_MESSAGE, PM_ASSERT_NO_MESSAGE)(__VA_ARGS__))
|
||||
#else
|
||||
#define PM_ASSERT(x, ...)
|
||||
#define PM_CORE_ASSERT(x, ...)
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Prism
|
||||
EventCategoryMouseButton = BIT(4)
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
// MSVC
|
||||
#define EVENT_CLASS_TYPE(type) static EventType GetStaticType() { return EventType::##type; }\
|
||||
virtual EventType GetEventType() const override { return GetStaticType(); }\
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace Prism
|
||||
name = entity.GetComponent<TagComponent>().Tag.c_str();
|
||||
|
||||
const ImGuiTreeNodeFlags node_flags = (entity == m_SelectionContext ? ImGuiTreeNodeFlags_Selected : 0) | ImGuiTreeNodeFlags_OpenOnArrow;
|
||||
const bool opened = ImGui::TreeNodeEx((void*)(uint32_t)entity, node_flags, name);
|
||||
const bool opened = ImGui::TreeNodeEx((const void*)(uintptr_t)(uint32_t)entity, node_flags, name);
|
||||
if (ImGui::IsItemClicked())
|
||||
{
|
||||
m_SelectionContext = entity;
|
||||
@@ -284,7 +284,8 @@ namespace Prism
|
||||
s_IDBuffer[0] = '#';
|
||||
s_IDBuffer[1] = '#';
|
||||
memset(s_IDBuffer + 2, 0, 14);
|
||||
itoa(s_Counter++, s_IDBuffer + 2, 16);
|
||||
// itoa(s_Counter++, s_IDBuffer + 2, 16);
|
||||
snprintf(s_IDBuffer + 2, 14, "%x", s_Counter++);
|
||||
|
||||
if (error)
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.9f, 0.2f, 0.2f, 1.0f));
|
||||
@@ -313,7 +314,9 @@ namespace Prism
|
||||
s_IDBuffer[0] = '#';
|
||||
s_IDBuffer[1] = '#';
|
||||
memset(s_IDBuffer + 2, 0, 14);
|
||||
itoa(s_Counter++, s_IDBuffer + 2, 16);
|
||||
// itoa(s_Counter++, s_IDBuffer + 2, 16);
|
||||
snprintf(s_IDBuffer + 2, 14, "%x", s_Counter++);
|
||||
|
||||
ImGui::InputText(s_IDBuffer, (char*)value, 256, ImGuiInputTextFlags_ReadOnly);
|
||||
|
||||
ImGui::PopItemWidth();
|
||||
@@ -331,7 +334,9 @@ namespace Prism
|
||||
s_IDBuffer[0] = '#';
|
||||
s_IDBuffer[1] = '#';
|
||||
memset(s_IDBuffer + 2, 0, 14);
|
||||
itoa(s_Counter++, s_IDBuffer + 2, 16);
|
||||
// itoa(s_Counter++, s_IDBuffer + 2, 16);
|
||||
snprintf(s_IDBuffer + 2, 14, "%x", s_Counter++);
|
||||
|
||||
if (ImGui::DragInt(s_IDBuffer, &value))
|
||||
modified = true;
|
||||
|
||||
@@ -352,7 +357,9 @@ namespace Prism
|
||||
s_IDBuffer[0] = '#';
|
||||
s_IDBuffer[1] = '#';
|
||||
memset(s_IDBuffer + 2, 0, 14);
|
||||
itoa(s_Counter++, s_IDBuffer + 2, 16);
|
||||
// itoa(s_Counter++, s_IDBuffer + 2, 16);
|
||||
snprintf(s_IDBuffer + 2, 14, "%x", s_Counter++);
|
||||
|
||||
if (ImGui::DragFloat(s_IDBuffer, &value, delta))
|
||||
modified = true;
|
||||
|
||||
@@ -373,7 +380,9 @@ namespace Prism
|
||||
s_IDBuffer[0] = '#';
|
||||
s_IDBuffer[1] = '#';
|
||||
memset(s_IDBuffer + 2, 0, 14);
|
||||
itoa(s_Counter++, s_IDBuffer + 2, 16);
|
||||
// itoa(s_Counter++, s_IDBuffer + 2, 16);
|
||||
snprintf(s_IDBuffer + 2, 14, "%x", s_Counter++);
|
||||
|
||||
if (ImGui::DragFloat2(s_IDBuffer, glm::value_ptr(value), delta))
|
||||
modified = true;
|
||||
|
||||
@@ -394,7 +403,9 @@ namespace Prism
|
||||
s_IDBuffer[0] = '#';
|
||||
s_IDBuffer[1] = '#';
|
||||
memset(s_IDBuffer + 2, 0, 14);
|
||||
itoa(s_Counter++, s_IDBuffer + 2, 16);
|
||||
// itoa(s_Counter++, s_IDBuffer + 2, 16);
|
||||
snprintf(s_IDBuffer + 2, 14, "%x", s_Counter++);
|
||||
|
||||
if (ImGui::DragFloat3(s_IDBuffer, glm::value_ptr(value), delta))
|
||||
modified = true;
|
||||
|
||||
@@ -415,7 +426,9 @@ namespace Prism
|
||||
s_IDBuffer[0] = '#';
|
||||
s_IDBuffer[1] = '#';
|
||||
memset(s_IDBuffer + 2, 0, 14);
|
||||
itoa(s_Counter++, s_IDBuffer + 2, 16);
|
||||
// itoa(s_Counter++, s_IDBuffer + 2, 16);
|
||||
snprintf(s_IDBuffer + 2, 14, "%x", s_Counter++);
|
||||
|
||||
if (ImGui::DragFloat4(s_IDBuffer, glm::value_ptr(value), delta))
|
||||
modified = true;
|
||||
|
||||
@@ -451,7 +464,7 @@ namespace Prism
|
||||
|
||||
// ID
|
||||
ImGui::SameLine();
|
||||
ImGui::TextDisabled("%llx", id);
|
||||
ImGui::TextDisabled("%llx", (uint64_t)id);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
|
||||
@@ -22,14 +22,14 @@ namespace Prism
|
||||
OpenGLVertexBuffer(uint32_t size, VertexBufferUsage usage = VertexBufferUsage::Dynamic);
|
||||
virtual ~OpenGLVertexBuffer();
|
||||
|
||||
virtual void SetData(void* buffer, uint32_t size, uint32_t offset = 0);
|
||||
virtual void Bind() const;
|
||||
void SetData(void* buffer, uint32_t size, uint32_t offset = 0) override;
|
||||
void Bind() const override;
|
||||
|
||||
virtual const BufferLayout& GetLayout() const override { return m_Layout; }
|
||||
virtual void SetLayout(const BufferLayout& layout) override { m_Layout = layout; }
|
||||
|
||||
virtual uint32_t GetSize() const { return m_Size; }
|
||||
virtual RendererID GetRendererID() const { return m_RendererID; }
|
||||
uint32_t GetSize() const override { return m_Size; }
|
||||
RendererID GetRendererID() const override { return m_RendererID; }
|
||||
private:
|
||||
RendererID m_RendererID = 0;
|
||||
uint32_t m_Size;
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Prism
|
||||
inline uint32_t GetCount() const override { return m_Count; }
|
||||
inline uint32_t GetOffset() const override { return m_Offset; }
|
||||
inline uint32_t GetAbsoluteOffset() const { return m_Struct ? m_Struct->GetOffset() + m_Offset : m_Offset; }
|
||||
inline ShaderDomain GetDomain() const { return m_Domain; }
|
||||
inline ShaderDomain GetDomain() const override { return m_Domain; }
|
||||
|
||||
int32_t GetLocation() const { return m_Location; }
|
||||
inline Type GetType() const { return m_Type; }
|
||||
@@ -109,7 +109,7 @@ namespace Prism
|
||||
virtual ShaderDomain GetDomain() const { return m_Domain; }
|
||||
inline const ShaderUniformList& GetUniformDeclarations() const override { return m_Uniforms; }
|
||||
|
||||
ShaderUniformDeclaration* FindUniform(const std::string& name);
|
||||
ShaderUniformDeclaration* FindUniform(const std::string& name) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Prism
|
||||
virtual std::pair<uint32_t, uint32_t> GetSize() const override { return { m_Data.Width, m_Data.Height }; }
|
||||
virtual std::pair<float, float> GetWindowPos() const override;
|
||||
|
||||
inline void* GetNativeWindow() const { return m_Window; }
|
||||
inline void* GetNativeWindow() const override { return m_Window; }
|
||||
|
||||
private:
|
||||
virtual void Init(const WindowProps& props);
|
||||
|
||||
@@ -600,7 +600,7 @@ namespace Prism
|
||||
ImGui::Begin("Script Engine Debug");
|
||||
for (auto& [sceneID, entityMap] : s_EntityInstanceMap)
|
||||
{
|
||||
bool opened = ImGui::TreeNode((void*)(uint64_t)sceneID, "Scene (%llx)", sceneID);
|
||||
bool opened = ImGui::TreeNode((void*)(uint64_t)sceneID, "Scene (%llx)", (uint64_t)sceneID);
|
||||
if (opened)
|
||||
{
|
||||
Ref<Scene> scene = Scene::GetScene(sceneID);
|
||||
@@ -610,7 +610,7 @@ namespace Prism
|
||||
std::string entityName = "Unnamed Entity";
|
||||
if (entity.HasComponent<TagComponent>())
|
||||
entityName = entity.GetComponent<TagComponent>().Tag;
|
||||
opened = ImGui::TreeNode((void*)(uint64_t)entityID, "%s (%llx)", entityName.c_str(), entityID);
|
||||
opened = ImGui::TreeNode((void*)(uint64_t)entityID, "%s (%llx)", entityName.c_str(), (uint64_t)entityID);
|
||||
if (opened)
|
||||
{
|
||||
for (auto& [moduleName, fieldMap] : entityInstanceData.ModuleFieldMap)
|
||||
|
||||
@@ -44,38 +44,38 @@ namespace Prism
|
||||
{
|
||||
InitComponentTypes();
|
||||
|
||||
mono_add_internal_call("Prism.Noise::PerlinNoise_Native", Prism::Script::Prism_Noise_PerlinNoise);
|
||||
mono_add_internal_call("Prism.Noise::PerlinNoise_Native", (const void*)Prism::Script::Prism_Noise_PerlinNoise);
|
||||
|
||||
mono_add_internal_call("Prism.Entity::GetTransform_Native", Prism::Script::Prism_Entity_GetTransform);
|
||||
mono_add_internal_call("Prism.Entity::SetTransform_Native", Prism::Script::Prism_Entity_SetTransform);
|
||||
mono_add_internal_call("Prism.Entity::CreateComponent_Native", Prism::Script::Prism_Entity_CreateComponent);
|
||||
mono_add_internal_call("Prism.Entity::HasComponent_Native", Prism::Script::Prism_Entity_HasComponent);
|
||||
mono_add_internal_call("Prism.Entity::GetTransform_Native",(const void*)Prism::Script::Prism_Entity_GetTransform);
|
||||
mono_add_internal_call("Prism.Entity::SetTransform_Native",(const void*)Prism::Script::Prism_Entity_SetTransform);
|
||||
mono_add_internal_call("Prism.Entity::CreateComponent_Native",(const void*)Prism::Script::Prism_Entity_CreateComponent);
|
||||
mono_add_internal_call("Prism.Entity::HasComponent_Native",(const void*)Prism::Script::Prism_Entity_HasComponent);
|
||||
|
||||
mono_add_internal_call("Prism.MeshComponent::GetMesh_Native", Prism::Script::Prism_MeshComponent_GetMesh);
|
||||
mono_add_internal_call("Prism.MeshComponent::SetMesh_Native", Prism::Script::Prism_MeshComponent_SetMesh);
|
||||
mono_add_internal_call("Prism.MeshComponent::GetMesh_Native",(const void*)Prism::Script::Prism_MeshComponent_GetMesh);
|
||||
mono_add_internal_call("Prism.MeshComponent::SetMesh_Native",(const void*)Prism::Script::Prism_MeshComponent_SetMesh);
|
||||
|
||||
mono_add_internal_call("Prism.Input::IsKeyPressed_Native", Prism::Script::Prism_Input_IsKeyPressed);
|
||||
mono_add_internal_call("Prism.Input::IsKeyPressed_Native", (const void*)Prism::Script::Prism_Input_IsKeyPressed);
|
||||
|
||||
mono_add_internal_call("Prism.Texture2D::Constructor_Native", Prism::Script::Prism_Texture2D_Constructor);
|
||||
mono_add_internal_call("Prism.Texture2D::Destructor_Native", Prism::Script::Prism_Texture2D_Destructor);
|
||||
mono_add_internal_call("Prism.Texture2D::SetData_Native", Prism::Script::Prism_Texture2D_SetData);
|
||||
mono_add_internal_call("Prism.Texture2D::Constructor_Native", (const void*)Prism::Script::Prism_Texture2D_Constructor);
|
||||
mono_add_internal_call("Prism.Texture2D::Destructor_Native", (const void*)Prism::Script::Prism_Texture2D_Destructor);
|
||||
mono_add_internal_call("Prism.Texture2D::SetData_Native", (const void*)Prism::Script::Prism_Texture2D_SetData);
|
||||
|
||||
mono_add_internal_call("Prism.Material::Destructor_Native", Prism::Script::Prism_Material_Destructor);
|
||||
mono_add_internal_call("Prism.Material::SetFloat_Native", Prism::Script::Prism_Material_SetFloat);
|
||||
mono_add_internal_call("Prism.Material::SetTexture_Native", Prism::Script::Prism_Material_SetTexture);
|
||||
mono_add_internal_call("Prism.Material::Destructor_Native", (const void*)Prism::Script::Prism_Material_Destructor);
|
||||
mono_add_internal_call("Prism.Material::SetFloat_Native", (const void*)Prism::Script::Prism_Material_SetFloat);
|
||||
mono_add_internal_call("Prism.Material::SetTexture_Native", (const void*)Prism::Script::Prism_Material_SetTexture);
|
||||
|
||||
mono_add_internal_call("Prism.MaterialInstance::Destructor_Native", Prism::Script::Prism_MaterialInstance_Destructor);
|
||||
mono_add_internal_call("Prism.MaterialInstance::SetFloat_Native", Prism::Script::Prism_MaterialInstance_SetFloat);
|
||||
mono_add_internal_call("Prism.MaterialInstance::SetVector3_Native", Prism::Script::Prism_MaterialInstance_SetVector3);
|
||||
mono_add_internal_call("Prism.MaterialInstance::SetTexture_Native", Prism::Script::Prism_MaterialInstance_SetTexture);
|
||||
mono_add_internal_call("Prism.MaterialInstance::Destructor_Native", (const void*)Prism::Script::Prism_MaterialInstance_Destructor);
|
||||
mono_add_internal_call("Prism.MaterialInstance::SetFloat_Native", (const void*)Prism::Script::Prism_MaterialInstance_SetFloat);
|
||||
mono_add_internal_call("Prism.MaterialInstance::SetVector3_Native", (const void*)Prism::Script::Prism_MaterialInstance_SetVector3);
|
||||
mono_add_internal_call("Prism.MaterialInstance::SetTexture_Native", (const void*)Prism::Script::Prism_MaterialInstance_SetTexture);
|
||||
|
||||
mono_add_internal_call("Prism.Mesh::Constructor_Native", Prism::Script::Prism_Mesh_Constructor);
|
||||
mono_add_internal_call("Prism.Mesh::Destructor_Native", Prism::Script::Prism_Mesh_Destructor);
|
||||
mono_add_internal_call("Prism.Mesh::GetMaterial_Native", Prism::Script::Prism_Mesh_GetMaterial);
|
||||
mono_add_internal_call("Prism.Mesh::GetMaterialByIndex_Native", Prism::Script::Prism_Mesh_GetMaterialByIndex);
|
||||
mono_add_internal_call("Prism.Mesh::GetMaterialCount_Native", Prism::Script::Prism_Mesh_GetMaterialCount);
|
||||
mono_add_internal_call("Prism.Mesh::Constructor_Native", (const void*)Prism::Script::Prism_Mesh_Constructor);
|
||||
mono_add_internal_call("Prism.Mesh::Destructor_Native", (const void*)Prism::Script::Prism_Mesh_Destructor);
|
||||
mono_add_internal_call("Prism.Mesh::GetMaterial_Native", (const void*)Prism::Script::Prism_Mesh_GetMaterial);
|
||||
mono_add_internal_call("Prism.Mesh::GetMaterialByIndex_Native", (const void*)Prism::Script::Prism_Mesh_GetMaterialByIndex);
|
||||
mono_add_internal_call("Prism.Mesh::GetMaterialCount_Native", (const void*)Prism::Script::Prism_Mesh_GetMaterialCount);
|
||||
|
||||
mono_add_internal_call("Prism.MeshFactory::CreatePlane_Native", Prism::Script::Prism_MeshFactory_CreatePlane);
|
||||
mono_add_internal_call("Prism.MeshFactory::CreatePlane_Native", (const void*)Prism::Script::Prism_MeshFactory_CreatePlane);
|
||||
|
||||
// static bool IsKeyPressed(KeyCode key) { return s_Instance->IsKeyPressedImpl(key); }
|
||||
//
|
||||
|
||||
+1
Submodule Prism/vendor/Box2D added at 3a4f0da837
Vendored
+5
-1
@@ -9,6 +9,10 @@ target_include_directories(mono INTERFACE
|
||||
file(GLOB MONO_DLL bin/*.dll)
|
||||
file(COPY ${MONO_DLL} DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||
|
||||
file(GLOB_RECURSE MONO_LIBRARY lib/*.lib)
|
||||
if (WIN32)
|
||||
file(GLOB_RECURSE MONO_LIBRARY lib/Windows/*.lib)
|
||||
else ()
|
||||
file(GLOB_RECURSE MONO_LIBRARY lib/Linux/*.a)
|
||||
endif ()
|
||||
|
||||
target_link_libraries(mono INTERFACE ${MONO_LIBRARY})
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Vendored
Vendored
Reference in New Issue
Block a user