Compare commits
2 Commits
c7acb71355
...
75184d9a6e
| Author | SHA1 | Date | |
|---|---|---|---|
| 75184d9a6e | |||
| 486b423343 |
@ -42,7 +42,9 @@ namespace Hazel
|
|||||||
m_CheckerBoardTexture = Texture2D::Create("assets/textures/Checkerboard.png");
|
m_CheckerBoardTexture = Texture2D::Create("assets/textures/Checkerboard.png");
|
||||||
|
|
||||||
m_IconPlay = Texture2D::Create("Resources/Icons/PlayButton.png");
|
m_IconPlay = Texture2D::Create("Resources/Icons/PlayButton.png");
|
||||||
m_IconStop = Texture2D::Create("Resources/Icons/PauseButton.png");
|
m_IconPause = Texture2D::Create("Resources/Icons/PauseButton.png");
|
||||||
|
m_IconStep = Texture2D::Create("Resources/Icons/StepButton.png");
|
||||||
|
m_IconStop = Texture2D::Create("Resources/Icons/StopButton.png");
|
||||||
m_IconSimulate = Texture2D::Create("Resources/Icons/SimulateButton.png");
|
m_IconSimulate = Texture2D::Create("Resources/Icons/SimulateButton.png");
|
||||||
|
|
||||||
m_EditorScene = CreateRef<Scene>();
|
m_EditorScene = CreateRef<Scene>();
|
||||||
@ -76,12 +78,13 @@ namespace Hazel
|
|||||||
// reset Renderer Draw Stats
|
// reset Renderer Draw Stats
|
||||||
Renderer2D::ResetStats();
|
Renderer2D::ResetStats();
|
||||||
|
|
||||||
|
m_ActiveScene->OnViewportResize((uint32_t)m_ViewPortSize.x, (uint32_t)m_ViewPortSize.y);
|
||||||
|
|
||||||
if (const auto& spec = m_FrameBuffer->GetSpecification();
|
if (const auto& spec = m_FrameBuffer->GetSpecification();
|
||||||
spec.Width != m_ViewPortSize.x || spec.Height != m_ViewPortSize.y)
|
spec.Width != m_ViewPortSize.x || spec.Height != m_ViewPortSize.y)
|
||||||
{
|
{
|
||||||
m_FrameBuffer->Resize((uint32_t)m_ViewPortSize.x, (uint32_t)m_ViewPortSize.y);
|
m_FrameBuffer->Resize((uint32_t)m_ViewPortSize.x, (uint32_t)m_ViewPortSize.y);
|
||||||
m_CameraController.OnResize(m_ViewPortSize.x, m_ViewPortSize.y);
|
m_CameraController.OnResize(m_ViewPortSize.x, m_ViewPortSize.y);
|
||||||
|
|
||||||
m_EditorCamera.SetViewPortSize(m_ViewPortSize.x, m_ViewPortSize.y);
|
m_EditorCamera.SetViewPortSize(m_ViewPortSize.x, m_ViewPortSize.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,7 +320,7 @@ namespace Hazel
|
|||||||
|
|
||||||
static float fpsRefreshTime = 0.0f;
|
static float fpsRefreshTime = 0.0f;
|
||||||
static float displayedFPS = 0;
|
static float displayedFPS = 0;
|
||||||
float currentTime = ImGui::GetTime();
|
float currentTime = static_cast<float>(ImGui::GetTime());
|
||||||
|
|
||||||
// 每秒更新一次要显示的FPS
|
// 每秒更新一次要显示的FPS
|
||||||
if (currentTime - fpsRefreshTime >= 1.0f)
|
if (currentTime - fpsRefreshTime >= 1.0f)
|
||||||
@ -594,6 +597,10 @@ namespace Hazel
|
|||||||
m_SceneHierachyPanel.SetContext(m_ActiveScene);
|
m_SceneHierachyPanel.SetContext(m_ActiveScene);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EditorLayer::OnScenePause()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void EditorLayer::OnSceneSimulation()
|
void EditorLayer::OnSceneSimulation()
|
||||||
{
|
{
|
||||||
if (m_SceneState == SceneState::Simulate)
|
if (m_SceneState == SceneState::Simulate)
|
||||||
@ -684,17 +691,27 @@ namespace Hazel
|
|||||||
ImGui::SetCursorPosX(ImGui::GetWindowContentRegionMax().x * 0.5f - size * 0.5f);
|
ImGui::SetCursorPosX(ImGui::GetWindowContentRegionMax().x * 0.5f - size * 0.5f);
|
||||||
ImGui::SetCursorPosX(ImGui::GetWindowContentRegionMax().x * 0.5f - (size * 0.5f));
|
ImGui::SetCursorPosX(ImGui::GetWindowContentRegionMax().x * 0.5f - (size * 0.5f));
|
||||||
|
|
||||||
Ref<Texture2D> icon = (m_SceneState == SceneState::Edit || m_SceneState == SceneState::Simulate)? m_IconPlay : m_IconStop;
|
bool hasPlayButton = m_SceneState == SceneState::Play || m_SceneState == SceneState::Edit;
|
||||||
if (ImGui::ImageButton("toolbar-play-edit", icon->GetRendererID(), ImVec2{size, size}, ImVec2{0, 0}, ImVec2{1, 1}))
|
bool hasSimulateButton = m_SceneState == SceneState::Simulate || m_SceneState == SceneState::Edit;
|
||||||
|
bool hasPauseButton = m_SceneState != SceneState::Edit;
|
||||||
|
|
||||||
|
if (hasPlayButton)
|
||||||
{
|
{
|
||||||
if (m_SceneState == SceneState::Edit || m_SceneState == SceneState::Simulate)
|
Ref<Texture2D> icon = (m_SceneState == SceneState::Edit || m_SceneState == SceneState::Simulate)? m_IconPlay : m_IconStop;
|
||||||
OnScenePlay();
|
if (ImGui::ImageButton("toolbar-play-edit", icon->GetRendererID(), ImVec2{size, size}, ImVec2{0, 0}, ImVec2{1, 1}))
|
||||||
else if (m_SceneState == SceneState::Play)
|
{
|
||||||
OnSceneStop();
|
if (m_SceneState == SceneState::Edit || m_SceneState == SceneState::Simulate)
|
||||||
|
OnScenePlay();
|
||||||
|
else if (m_SceneState == SceneState::Play)
|
||||||
|
OnSceneStop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SameLine();
|
if (hasSimulateButton)
|
||||||
{
|
{
|
||||||
|
if (hasPlayButton)
|
||||||
|
ImGui::SameLine();
|
||||||
|
|
||||||
Ref<Texture2D> icon = (m_SceneState == SceneState::Edit || m_SceneState == SceneState::Play)? m_IconSimulate : m_IconStop;
|
Ref<Texture2D> icon = (m_SceneState == SceneState::Edit || m_SceneState == SceneState::Play)? m_IconSimulate : m_IconStop;
|
||||||
if (ImGui::ImageButton("toolbar-simulate", icon->GetRendererID(), ImVec2{size, size}, ImVec2{0, 0}, ImVec2{1, 1}))
|
if (ImGui::ImageButton("toolbar-simulate", icon->GetRendererID(), ImVec2{size, size}, ImVec2{0, 0}, ImVec2{1, 1}))
|
||||||
{
|
{
|
||||||
@ -705,6 +722,32 @@ namespace Hazel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasPauseButton)
|
||||||
|
{
|
||||||
|
bool isPaused = m_ActiveScene->IsPaused();
|
||||||
|
ImGui::SameLine();
|
||||||
|
{
|
||||||
|
Ref<Texture2D> icon = m_IconPause;
|
||||||
|
if (ImGui::ImageButton("toolbar-pause", icon->GetRendererID(), ImVec2{size, size}, ImVec2{0, 0}, ImVec2{1, 1}))
|
||||||
|
{
|
||||||
|
m_ActiveScene->SetPaused(!isPaused);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isPaused)
|
||||||
|
{
|
||||||
|
ImGui::SameLine();
|
||||||
|
{
|
||||||
|
Ref<Texture2D> icon = m_IconStep;
|
||||||
|
if (ImGui::ImageButton("toolbar-step", icon->GetRendererID(), ImVec2{size, size}, ImVec2{0, 0}, ImVec2{1, 1}))
|
||||||
|
{
|
||||||
|
m_ActiveScene->Step();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::PopStyleVar(2);
|
ImGui::PopStyleVar(2);
|
||||||
ImGui::PopStyleColor(3);
|
ImGui::PopStyleColor(3);
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|||||||
@ -29,6 +29,7 @@ namespace Hazel
|
|||||||
void OnScenePlay();
|
void OnScenePlay();
|
||||||
void OnSceneSimulation();
|
void OnSceneSimulation();
|
||||||
void OnSceneStop();
|
void OnSceneStop();
|
||||||
|
void OnScenePause();
|
||||||
|
|
||||||
|
|
||||||
void SaveSceneAs() const;
|
void SaveSceneAs() const;
|
||||||
@ -84,7 +85,7 @@ namespace Hazel
|
|||||||
|
|
||||||
SceneState m_SceneState = SceneState::Edit;
|
SceneState m_SceneState = SceneState::Edit;
|
||||||
|
|
||||||
Ref<Texture2D> m_IconPlay, m_IconStop, m_IconSimulate;
|
Ref<Texture2D> m_IconPlay, m_IconPause, m_IconStep, m_IconStop, m_IconSimulate;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -143,6 +143,11 @@ namespace Hazel
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Scene::Step(const int frames)
|
||||||
|
{
|
||||||
|
m_StepFrame = frames;
|
||||||
|
}
|
||||||
|
|
||||||
void Scene::OnPhysics2DStart()
|
void Scene::OnPhysics2DStart()
|
||||||
{
|
{
|
||||||
b2WorldDef worldDef = b2DefaultWorldDef();
|
b2WorldDef worldDef = b2DefaultWorldDef();
|
||||||
@ -285,49 +290,52 @@ namespace Hazel
|
|||||||
|
|
||||||
void Scene::OnUpdateRuntime(TimeStep& ts)
|
void Scene::OnUpdateRuntime(TimeStep& ts)
|
||||||
{
|
{
|
||||||
// Update scripts
|
if (!m_IsPaused || m_StepFrame-- > 0)
|
||||||
{
|
{
|
||||||
// C# Script Update
|
// Update scripts
|
||||||
auto view = m_Registry.view<ScriptComponent>();
|
|
||||||
for (auto e : view)
|
|
||||||
{
|
{
|
||||||
Entity entity = {e, this};
|
// C# Script Update
|
||||||
ScriptEngine::OnUpdateEntity(entity, ts);
|
auto view = m_Registry.view<ScriptComponent>();
|
||||||
}
|
for (auto e : view)
|
||||||
|
|
||||||
//
|
|
||||||
m_Registry.view<NativeScriptComponent>().each([=, this](auto entity, auto& nsc)
|
|
||||||
{
|
|
||||||
// TODO: move to Scene::OnScenePlay
|
|
||||||
if (!nsc.Instance)
|
|
||||||
{
|
{
|
||||||
nsc.Instance = nsc.InstantiateScript();
|
Entity entity = {e, this};
|
||||||
nsc.Instance->m_Entity = Entity{entity, this};
|
ScriptEngine::OnUpdateEntity(entity, ts);
|
||||||
nsc.Instance->OnCreate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsc.Instance->OnUpdate(ts);
|
//
|
||||||
});
|
m_Registry.view<NativeScriptComponent>().each([=, this](auto entity, auto& nsc)
|
||||||
}
|
{
|
||||||
|
// TODO: move to Scene::OnScenePlay
|
||||||
|
if (!nsc.Instance)
|
||||||
|
{
|
||||||
|
nsc.Instance = nsc.InstantiateScript();
|
||||||
|
nsc.Instance->m_Entity = Entity{entity, this};
|
||||||
|
nsc.Instance->OnCreate();
|
||||||
|
}
|
||||||
|
|
||||||
// Physics
|
nsc.Instance->OnUpdate(ts);
|
||||||
{
|
});
|
||||||
b2World_Step(*m_PhysicsWorld, ts, 4);
|
}
|
||||||
|
|
||||||
auto view = m_Registry.view<RigidBody2DComponent>();
|
// Physics
|
||||||
for (auto e : view)
|
|
||||||
{
|
{
|
||||||
Entity entity = {e, this};
|
b2World_Step(*m_PhysicsWorld, ts, 4);
|
||||||
auto& transform = entity.GetComponent<TransformComponent>();
|
|
||||||
auto& rb2D = entity.GetComponent<RigidBody2DComponent>();
|
|
||||||
|
|
||||||
b2BodyId& body = rb2D.RuntimeBody;
|
auto view = m_Registry.view<RigidBody2DComponent>();
|
||||||
|
for (auto e : view)
|
||||||
|
{
|
||||||
|
Entity entity = {e, this};
|
||||||
|
auto& transform = entity.GetComponent<TransformComponent>();
|
||||||
|
auto& rb2D = entity.GetComponent<RigidBody2DComponent>();
|
||||||
|
|
||||||
const auto& position = b2Body_GetPosition(body);
|
b2BodyId& body = rb2D.RuntimeBody;
|
||||||
transform.Translation.x = position.x;
|
|
||||||
transform.Translation.y = position.y;
|
const auto& position = b2Body_GetPosition(body);
|
||||||
const float angle = b2Rot_GetAngle(b2Body_GetRotation(body));
|
transform.Translation.x = position.x;
|
||||||
transform.Rotation.z = angle;
|
transform.Translation.y = position.y;
|
||||||
|
const float angle = b2Rot_GetAngle(b2Body_GetRotation(body));
|
||||||
|
transform.Rotation.z = angle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,24 +388,27 @@ namespace Hazel
|
|||||||
|
|
||||||
void Scene::OnUpdateSimulation(TimeStep& ts, const EditorCamera& camera)
|
void Scene::OnUpdateSimulation(TimeStep& ts, const EditorCamera& camera)
|
||||||
{
|
{
|
||||||
// Physics
|
if (!m_IsPaused || m_StepFrame-- > 0)
|
||||||
{
|
{
|
||||||
b2World_Step(*m_PhysicsWorld, ts, 4);
|
// Physics
|
||||||
|
|
||||||
auto view = m_Registry.view<RigidBody2DComponent>();
|
|
||||||
for (auto e : view)
|
|
||||||
{
|
{
|
||||||
Entity entity = {e, this};
|
b2World_Step(*m_PhysicsWorld, ts, 4);
|
||||||
auto& transform = entity.GetComponent<TransformComponent>();
|
|
||||||
auto& rb2D = entity.GetComponent<RigidBody2DComponent>();
|
|
||||||
|
|
||||||
b2BodyId& body = rb2D.RuntimeBody;
|
auto view = m_Registry.view<RigidBody2DComponent>();
|
||||||
|
for (auto e : view)
|
||||||
|
{
|
||||||
|
Entity entity = {e, this};
|
||||||
|
auto& transform = entity.GetComponent<TransformComponent>();
|
||||||
|
auto& rb2D = entity.GetComponent<RigidBody2DComponent>();
|
||||||
|
|
||||||
const auto& position = b2Body_GetPosition(body);
|
b2BodyId& body = rb2D.RuntimeBody;
|
||||||
transform.Translation.x = position.x;
|
|
||||||
transform.Translation.y = position.y;
|
const auto& position = b2Body_GetPosition(body);
|
||||||
const float angle = b2Rot_GetAngle(b2Body_GetRotation(body));
|
transform.Translation.x = position.x;
|
||||||
transform.Rotation.z = angle;
|
transform.Translation.y = position.y;
|
||||||
|
const float angle = b2Rot_GetAngle(b2Body_GetRotation(body));
|
||||||
|
transform.Rotation.z = angle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -49,6 +49,10 @@ namespace Hazel
|
|||||||
Entity GetEntityByUUID(UUID uuid);
|
Entity GetEntityByUUID(UUID uuid);
|
||||||
|
|
||||||
bool IsRunning() const {return m_IsRunning; }
|
bool IsRunning() const {return m_IsRunning; }
|
||||||
|
bool IsPaused() const {return m_IsPaused; }
|
||||||
|
|
||||||
|
void SetPaused(const bool pause) {m_IsPaused = pause; }
|
||||||
|
void Step(int frames = 1);
|
||||||
|
|
||||||
template<typename... Components>
|
template<typename... Components>
|
||||||
auto GetAllEntitiesWith()
|
auto GetAllEntitiesWith()
|
||||||
@ -73,6 +77,8 @@ namespace Hazel
|
|||||||
b2WorldId* m_PhysicsWorld = nullptr;
|
b2WorldId* m_PhysicsWorld = nullptr;
|
||||||
|
|
||||||
bool m_IsRunning = false;
|
bool m_IsRunning = false;
|
||||||
|
bool m_IsPaused = false;
|
||||||
|
int m_StepFrame = 0;
|
||||||
|
|
||||||
std::unordered_map<UUID, entt::entity> m_EnttMap;
|
std::unordered_map<UUID, entt::entity> m_EnttMap;
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,8 @@
|
|||||||
#include "mono/jit/jit.h"
|
#include "mono/jit/jit.h"
|
||||||
#include "mono/metadata/assembly.h"
|
#include "mono/metadata/assembly.h"
|
||||||
#include "mono/metadata/attrdefs.h"
|
#include "mono/metadata/attrdefs.h"
|
||||||
|
#include "mono/metadata/mono-debug.h"
|
||||||
|
#include "mono/metadata/threads.h"
|
||||||
|
|
||||||
namespace Hazel
|
namespace Hazel
|
||||||
{
|
{
|
||||||
@ -72,7 +74,7 @@ namespace Hazel
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
MonoAssembly* LoadMonoAssembly(const std::filesystem::path& assemblyPath)
|
MonoAssembly* LoadMonoAssembly(const std::filesystem::path& assemblyPath, bool loadPDB = false)
|
||||||
{
|
{
|
||||||
HZ_CORE_DEBUG("Load Assemble: {0}", assemblyPath.string().c_str());
|
HZ_CORE_DEBUG("Load Assemble: {0}", assemblyPath.string().c_str());
|
||||||
uint32_t fileSize = 0;
|
uint32_t fileSize = 0;
|
||||||
@ -88,6 +90,24 @@ namespace Hazel
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (loadPDB)
|
||||||
|
{
|
||||||
|
HZ_CORE_INFO("loading pdb file...");
|
||||||
|
std::filesystem::path pdbPath(assemblyPath);
|
||||||
|
pdbPath.replace_extension(".pdb");
|
||||||
|
|
||||||
|
if (std::filesystem::exists(pdbPath))
|
||||||
|
{
|
||||||
|
uint32_t pdbFileSize = 0;
|
||||||
|
char* pdbFileData = ReadBytes(pdbPath, &pdbFileSize);
|
||||||
|
mono_debug_open_image_from_memory(image, (const mono_byte*)pdbFileData, fileSize);
|
||||||
|
HZ_CORE_INFO("loaded pdb file: {0}", pdbPath.string());
|
||||||
|
HZ_CORE_INFO(" size: {0}", pdbFileSize);
|
||||||
|
|
||||||
|
delete[] pdbFileData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string string = assemblyPath.string();
|
std::string string = assemblyPath.string();
|
||||||
MonoAssembly* assembly = mono_assembly_load_from_full(image, string.c_str(), &status, 0);
|
MonoAssembly* assembly = mono_assembly_load_from_full(image, string.c_str(), &status, 0);
|
||||||
mono_image_close(image);
|
mono_image_close(image);
|
||||||
@ -152,6 +172,8 @@ namespace Hazel
|
|||||||
Scope<filewatch::FileWatch<std::string>> AppAssemblyFileWatcher;
|
Scope<filewatch::FileWatch<std::string>> AppAssemblyFileWatcher;
|
||||||
bool AssemblyReloading = false;
|
bool AssemblyReloading = false;
|
||||||
|
|
||||||
|
bool EnableDebugging = false;
|
||||||
|
|
||||||
// runtime
|
// runtime
|
||||||
Scene* SceneContext = nullptr;
|
Scene* SceneContext = nullptr;
|
||||||
};
|
};
|
||||||
@ -235,7 +257,7 @@ namespace Hazel
|
|||||||
|
|
||||||
// TODO: move this later
|
// TODO: move this later
|
||||||
s_Data->CoreAssemblyFilePath = assemblePath;
|
s_Data->CoreAssemblyFilePath = assemblePath;
|
||||||
s_Data->CoreAssembly = Utils::LoadMonoAssembly(assemblePath);
|
s_Data->CoreAssembly = Utils::LoadMonoAssembly(assemblePath, s_Data->EnableDebugging);
|
||||||
s_Data->CoreAssemblyImage = mono_assembly_get_image(s_Data->CoreAssembly);
|
s_Data->CoreAssemblyImage = mono_assembly_get_image(s_Data->CoreAssembly);
|
||||||
|
|
||||||
// Utils::PrintAssemblyTypes(s_Data->CoreAssembly);
|
// Utils::PrintAssemblyTypes(s_Data->CoreAssembly);
|
||||||
@ -245,7 +267,7 @@ namespace Hazel
|
|||||||
{
|
{
|
||||||
// TODO: move this later
|
// TODO: move this later
|
||||||
s_Data->AppAssemblyFilePath = assemblePath;
|
s_Data->AppAssemblyFilePath = assemblePath;
|
||||||
s_Data->AppAssembly = Utils::LoadMonoAssembly(assemblePath);
|
s_Data->AppAssembly = Utils::LoadMonoAssembly(assemblePath, s_Data->EnableDebugging);
|
||||||
s_Data->AppAssemblyImage = mono_assembly_get_image(s_Data->AppAssembly);
|
s_Data->AppAssemblyImage = mono_assembly_get_image(s_Data->AppAssembly);
|
||||||
|
|
||||||
s_Data->AppAssemblyFileWatcher = CreateScope<filewatch::FileWatch<std::string>>(assemblePath.string(), OnAssemblyFileSystemEvent);
|
s_Data->AppAssemblyFileWatcher = CreateScope<filewatch::FileWatch<std::string>>(assemblePath.string(), OnAssemblyFileSystemEvent);
|
||||||
@ -408,6 +430,18 @@ namespace Hazel
|
|||||||
mono_set_dirs("Resources", "Resources");
|
mono_set_dirs("Resources", "Resources");
|
||||||
mono_set_assemblies_path("Resources/mono");
|
mono_set_assemblies_path("Resources/mono");
|
||||||
|
|
||||||
|
if (s_Data->EnableDebugging)
|
||||||
|
{
|
||||||
|
const char* argv[2]
|
||||||
|
{
|
||||||
|
"--debugger-agent=transport=dt_socket,address=127.0.0.1:2550,server=y,suspend=n,loglevel=3,logfile=MonoDebugger.log",
|
||||||
|
"--soft-breakpoints"
|
||||||
|
};
|
||||||
|
|
||||||
|
mono_jit_parse_options(2, (char**)argv);
|
||||||
|
mono_debug_init(MONO_DEBUG_FORMAT_MONO);
|
||||||
|
}
|
||||||
|
|
||||||
MonoDomain* rootDomain = mono_jit_init("HazelJITRuntime");
|
MonoDomain* rootDomain = mono_jit_init("HazelJITRuntime");
|
||||||
|
|
||||||
const char* monoPath = mono_assembly_getrootdir();
|
const char* monoPath = mono_assembly_getrootdir();
|
||||||
@ -419,6 +453,11 @@ namespace Hazel
|
|||||||
}
|
}
|
||||||
// Storage the root Domain ptr
|
// Storage the root Domain ptr
|
||||||
s_Data->RootDomain = rootDomain;
|
s_Data->RootDomain = rootDomain;
|
||||||
|
|
||||||
|
if (s_Data->EnableDebugging)
|
||||||
|
mono_debug_domain_create(s_Data->RootDomain);
|
||||||
|
|
||||||
|
mono_thread_set_main(mono_thread_current());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEngine::MonoShutdown()
|
void ScriptEngine::MonoShutdown()
|
||||||
@ -468,7 +507,8 @@ namespace Hazel
|
|||||||
|
|
||||||
MonoObject* ScriptClass::InvokeMethod(MonoObject* instance, MonoMethod* method, void** param)
|
MonoObject* ScriptClass::InvokeMethod(MonoObject* instance, MonoMethod* method, void** param)
|
||||||
{
|
{
|
||||||
return mono_runtime_invoke(method, instance, param, nullptr);
|
MonoObject* expection = nullptr;
|
||||||
|
return mono_runtime_invoke(method, instance, param, &expection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user