Skip to content

Commit

Permalink
Dmon (#417)
Browse files Browse the repository at this point in the history
Filewatcher
  • Loading branch information
roeas authored Nov 8, 2023
1 parent afb689e commit 35aafaf
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 294 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@
[submodule "Engine/Source/ThirdParty/imgui-node-editor"]
path = Engine/Source/ThirdParty/imgui-node-editor
url = https://github.com/thedmd/imgui-node-editor
[submodule "Engine/Source/ThirdParty/dmon"]
path = Engine/Source/ThirdParty/dmon
url = https://github.com/CatDogEngine/dmon
2 changes: 2 additions & 0 deletions Engine/Auto/Scripts/editor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ project("Editor")
path.join(ThirdPartySourcePath, "imguizmo/*.cpp"),
path.join(ThirdPartySourcePath, "imgui-node-editor/*.h"),
path.join(ThirdPartySourcePath, "imgui-node-editor/*.cpp"),
path.join(ThirdPartySourcePath, "dmon/*.h"),
}

vpaths {
Expand Down Expand Up @@ -55,6 +56,7 @@ project("Editor")
path.join(ThirdPartySourcePath, "imgui"),
path.join(ThirdPartySourcePath, "imguizmo"),
path.join(ThirdPartySourcePath, "imgui-node-editor"),
path.join(ThirdPartySourcePath, "dmon"),
ThirdPartySourcePath,
}

Expand Down
38 changes: 34 additions & 4 deletions Engine/Source/Editor/EditorApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "Rendering/TerrainRenderer.h"
#include "Rendering/WorldRenderer.h"
#include "Rendering/ParticleRenderer.h"
#include "Resources/FileWatcher.h"
#include "Resources/FileWatcher.hpp"
#include "Resources/ResourceBuilder.h"
#include "Resources/ShaderBuilder.h"
#include "Scene/SceneDatabase.h"
Expand Down Expand Up @@ -113,9 +113,39 @@ void EditorApp::Init(engine::EngineInitArgs initArgs)
});
resourceThread.detach();

// TODO : Shader hot compile and load.
m_pFileWatcher = std::make_unique<FileWatcher>(CDENGINE_BUILTIN_SHADER_PATH);
m_pFileWatcher->EnableWatchSubTree();
#if 0
// Test code, will be removed in the next PR.
auto FileWatchCallback = [](
WatchID id, WatchAction action,
const char* rootDir, const char* filePath,
const char* oldFilePath, void* user)
{
switch (action)
{
case DMON_ACTION_CREATE:
CD_FATAL("Create");
break;

case DMON_ACTION_DELETE:
CD_FATAL("Delete");
break;

case DMON_ACTION_MODIFY:
CD_FATAL("Modify");
break;

case DMON_ACTION_MOVE:
CD_FATAL("Move");
break;

default:
CD_FATAL("Default");
}
};

m_pFileWatcher = std::make_unique<FileWatcher>();
m_pFileWatcher->Watch(CDENGINE_BUILTIN_SHADER_PATH, FileWatchCallback, DMON_WATCHFLAGS_RECURSIVE, nullptr);
#endif
}

void EditorApp::Shutdown()
Expand Down
228 changes: 0 additions & 228 deletions Engine/Source/Editor/Resources/FileWatcher.cpp

This file was deleted.

58 changes: 0 additions & 58 deletions Engine/Source/Editor/Resources/FileWatcher.h

This file was deleted.

Loading

0 comments on commit 35aafaf

Please sign in to comment.