Add XCUI new editor sandbox phase 1
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
if(MSVC AND POLICY CMP0141)
|
||||
cmake_policy(SET CMP0141 NEW)
|
||||
endif()
|
||||
|
||||
project(XCEngineLib)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
@@ -20,6 +25,79 @@ endif()
|
||||
|
||||
find_package(Vulkan REQUIRED)
|
||||
|
||||
set(XCENGINE_OPTIONAL_UI_RESOURCE_SOURCES)
|
||||
set(XCENGINE_UIDOCUMENT_COMPILER_SOURCE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/Resources/UI/UIDocumentCompiler.cpp")
|
||||
if(EXISTS "${XCENGINE_UIDOCUMENT_COMPILER_SOURCE}")
|
||||
list(APPEND XCENGINE_OPTIONAL_UI_RESOURCE_SOURCES
|
||||
${XCENGINE_UIDOCUMENT_COMPILER_SOURCE}
|
||||
)
|
||||
else()
|
||||
set(XCENGINE_UIDOCUMENT_COMPILER_FALLBACK_SOURCE
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/generated/UIDocumentCompilerFallback.cpp")
|
||||
file(GENERATE OUTPUT "${XCENGINE_UIDOCUMENT_COMPILER_FALLBACK_SOURCE}" CONTENT [=[
|
||||
#include <XCEngine/Resources/UI/UIDocumentCompiler.h>
|
||||
|
||||
namespace XCEngine {
|
||||
namespace Resources {
|
||||
|
||||
namespace {
|
||||
constexpr const char* kUnavailableMessage =
|
||||
"UIDocument compiler implementation is unavailable in this workspace.";
|
||||
}
|
||||
|
||||
bool CompileUIDocument(const UIDocumentCompileRequest&, UIDocumentCompileResult& outResult)
|
||||
{
|
||||
outResult = {};
|
||||
outResult.errorMessage = Containers::String(kUnavailableMessage);
|
||||
outResult.succeeded = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WriteUIDocumentArtifact(
|
||||
const Containers::String&,
|
||||
const UIDocumentCompileResult&,
|
||||
Containers::String* outErrorMessage)
|
||||
{
|
||||
if (outErrorMessage != nullptr) {
|
||||
*outErrorMessage = Containers::String(kUnavailableMessage);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LoadUIDocumentArtifact(
|
||||
const Containers::String&,
|
||||
UIDocumentKind,
|
||||
UIDocumentCompileResult& outResult)
|
||||
{
|
||||
outResult = {};
|
||||
outResult.errorMessage = Containers::String(kUnavailableMessage);
|
||||
outResult.succeeded = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
Containers::String GetUIDocumentDefaultRootTag(UIDocumentKind kind)
|
||||
{
|
||||
switch (kind) {
|
||||
case UIDocumentKind::Theme:
|
||||
return Containers::String("Theme");
|
||||
case UIDocumentKind::Schema:
|
||||
return Containers::String("Schema");
|
||||
case UIDocumentKind::View:
|
||||
default:
|
||||
return Containers::String("View");
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Resources
|
||||
} // namespace XCEngine
|
||||
]=])
|
||||
list(APPEND XCENGINE_OPTIONAL_UI_RESOURCE_SOURCES
|
||||
"${XCENGINE_UIDOCUMENT_COMPILER_FALLBACK_SOURCE}"
|
||||
)
|
||||
message(STATUS "UIDocumentCompiler.cpp is missing; using generated fallback implementation for build stability.")
|
||||
endif()
|
||||
|
||||
add_library(XCEngine STATIC
|
||||
# Core (Types, RefCounted, SmartPtr, Event)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Core/Types.h
|
||||
@@ -309,7 +387,7 @@ add_library(XCEngine STATIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Resources/Shader/ShaderLoader.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Resources/AudioClip/AudioClip.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Resources/AudioClip/AudioLoader.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Resources/UI/UIDocumentCompiler.cpp
|
||||
${XCENGINE_OPTIONAL_UI_RESOURCE_SOURCES}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Resources/UI/UIDocuments.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Resources/UI/UIDocumentLoaders.cpp
|
||||
|
||||
@@ -504,6 +582,16 @@ target_link_libraries(XCEngine PUBLIC
|
||||
if(MSVC)
|
||||
target_link_libraries(XCEngine PUBLIC delayimp)
|
||||
target_link_options(XCEngine INTERFACE "/DELAYLOAD:assimp-vc143-mt.dll")
|
||||
set_target_properties(XCEngine PROPERTIES
|
||||
MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug,RelWithDebInfo>:Embedded>"
|
||||
COMPILE_PDB_NAME "XCEngine-compile"
|
||||
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/compile-pdb"
|
||||
COMPILE_PDB_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_BINARY_DIR}/compile-pdb/Debug"
|
||||
COMPILE_PDB_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_BINARY_DIR}/compile-pdb/Release"
|
||||
COMPILE_PDB_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_CURRENT_BINARY_DIR}/compile-pdb/MinSizeRel"
|
||||
COMPILE_PDB_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_CURRENT_BINARY_DIR}/compile-pdb/RelWithDebInfo"
|
||||
VS_GLOBAL_UseMultiToolTask "false"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(XCENGINE_ENABLE_MONO_SCRIPTING)
|
||||
|
||||
@@ -5,6 +5,11 @@
|
||||
namespace XCEngine {
|
||||
namespace UI {
|
||||
|
||||
enum class UITextureHandleKind : std::uint8_t {
|
||||
ImGuiDescriptor = 0,
|
||||
ShaderResourceView
|
||||
};
|
||||
|
||||
struct UIPoint {
|
||||
float x = 0.0f;
|
||||
float y = 0.0f;
|
||||
@@ -46,6 +51,7 @@ struct UITextureHandle {
|
||||
std::uintptr_t nativeHandle = 0;
|
||||
std::uint32_t width = 0;
|
||||
std::uint32_t height = 0;
|
||||
UITextureHandleKind kind = UITextureHandleKind::ImGuiDescriptor;
|
||||
|
||||
constexpr bool IsValid() const {
|
||||
return nativeHandle != 0 && width > 0 && height > 0;
|
||||
|
||||
Reference in New Issue
Block a user