add editor
This commit is contained in:
parent
cad187038c
commit
c62b63d0b9
@ -1,12 +1,13 @@
|
||||
#pragma once
|
||||
#include "module/module.h"
|
||||
namespace api {
|
||||
class EDITOR_API EditorModule : public api::IDynamicModule
|
||||
class EDITOR_API EditorModule : public IDynamicModule
|
||||
{
|
||||
public:
|
||||
void OnLoad(int argc, char** argv) override;
|
||||
void OnUnload() override;
|
||||
void InitMetaData(void) override {};
|
||||
void Initialize(void)override;
|
||||
};
|
||||
IMPLEMENT_DYNAMIC_MODULE(EDITOR_API, EditorModule, editor)
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
#include "data/global.h"
|
||||
namespace api {
|
||||
APP_API EngineConfig gEngineConfig{};
|
||||
}
|
||||
@ -1,6 +1,10 @@
|
||||
#include "engine_config.h"
|
||||
#include "project_config.h"
|
||||
namespace api {
|
||||
constexpr const char* CFileResourcePath = "/work/assets/file_resource.meta";
|
||||
constexpr const char* CFileFlagName = "/work/assets/file_flag.meta";
|
||||
constexpr const char* CFileMapName = "/work/assets/file_map.meta";
|
||||
constexpr const char* CFileMountName = "/work/assets/file_mount.meta";
|
||||
|
||||
extern APP_API EngineConfig gEngineConfig;
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
#include "data/engine_config.h"
|
||||
namespace api {
|
||||
|
||||
}
|
||||
@ -1,14 +1,26 @@
|
||||
#include "editor/editor.h"
|
||||
#include "data/global.h"
|
||||
#include "imgui.h"
|
||||
namespace api {
|
||||
void EditorModule::OnLoad(int argc, char** argv)
|
||||
{
|
||||
IMGUI_CHECKVERSION();
|
||||
ImGui::CreateContext();
|
||||
|
||||
}
|
||||
|
||||
void EditorModule::OnUnload()
|
||||
{
|
||||
}
|
||||
|
||||
void EditorModule::Initialize(void)
|
||||
{
|
||||
IDynamicModule::Initialize();
|
||||
IMGUI_CHECKVERSION();
|
||||
ImGui::CreateContext();
|
||||
ImGui::StyleColorsDark();
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // 可选:启用键盘导航
|
||||
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; // 可选:启用Docking
|
||||
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; // 可选:启用多视口
|
||||
if (gEngineConfig.API == GraphicsAPI::Vulkan) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
#include "engine/api.h"
|
||||
#include "app_impl.inl"
|
||||
#include "os/file_manager.h"
|
||||
#include "xmalloc_new_delete.h"
|
||||
class ENGINE_API EngineModule : public api::IDynamicModule
|
||||
|
||||
@ -13,6 +13,7 @@ target("editor")
|
||||
add_headerfiles("include/editor/*.h")
|
||||
add_includedirs("include")
|
||||
add_files("src/editor/*.cpp")
|
||||
add_defines("WITH_EDITOR", {public = true})
|
||||
add_packages("imgui",{public = true})
|
||||
add_deps("engine",{public = true})
|
||||
includes("xmake/xmake.lua")
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#include "zlog.h"
|
||||
#include "zworld.h"
|
||||
#include "data/global.h"
|
||||
#include "vkn/vulkan_window.h"
|
||||
#include "vkn/vulkan_api.h"
|
||||
#include "render/pass/demo_pass.h"
|
||||
@ -9,6 +10,7 @@ RenderAPI* API;
|
||||
void ZWorldModule::OnLoad(int argc, char** argv)
|
||||
{
|
||||
// 创建窗口
|
||||
gEngineConfig.API = GraphicsAPI::Vulkan;
|
||||
auto window = new vkn::VulkanWindow(&SDL_CreateWindow, { "zengine" , SDL_WINDOW_VULKAN }, 1080, 720);
|
||||
API = new vkn::VulkanAPI();
|
||||
auto args = vkn::VulkanWindowArgs::Default();
|
||||
@ -34,7 +36,7 @@ void ZWorldModule::MainLoop()
|
||||
if (event_.type == SDL_QUIT) {
|
||||
running = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
API->graph.AddRenderPass<DemoPass>();
|
||||
API->BeginFrame();
|
||||
API->Render();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user