fix: Fix resources conflict and update scripts
This commit is contained in:
parent
580ecd8dce
commit
3277461858
@ -8,11 +8,17 @@ set(EDITOR_INCLUDE_DIR include)
|
|||||||
set(EDITOR_RESOURCES_DIR resources)
|
set(EDITOR_RESOURCES_DIR resources)
|
||||||
|
|
||||||
file(GLOB_RECURSE EDITOR_SOURCES ${EDITOR_SOURCE_DIR}/*.cpp)
|
file(GLOB_RECURSE EDITOR_SOURCES ${EDITOR_SOURCE_DIR}/*.cpp)
|
||||||
file(COPY ${EDITOR_RESOURCES_DIR}/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
|
|
||||||
add_executable(${NAME})
|
add_executable(${NAME})
|
||||||
|
|
||||||
|
# Add resources folder
|
||||||
|
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||||
|
file(COPY ${EDITOR_RESOURCES_DIR} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
target_compile_definitions(${NAME} PUBLIC EDITOR_RESOURCES_PATH="resources/")
|
||||||
|
else()
|
||||||
|
target_compile_definitions(${NAME} PUBLIC EDITOR_RESOURCES_PATH="${CMAKE_CURRENT_SOURCE_DIR}/resources/")
|
||||||
|
endif()
|
||||||
|
|
||||||
target_sources(${NAME} PRIVATE ${EDITOR_SOURCES})
|
target_sources(${NAME} PRIVATE ${EDITOR_SOURCES})
|
||||||
target_include_directories(${NAME} PRIVATE ${EDITOR_INCLUDE_DIR})
|
target_include_directories(${NAME} PRIVATE ${EDITOR_INCLUDE_DIR})
|
||||||
|
|
||||||
target_link_libraries(${NAME} engine)
|
target_link_libraries(${NAME} engine)
|
||||||
|
49
editor/resources/imgui.ini
Normal file
49
editor/resources/imgui.ini
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
[Window][DockSpaceViewport_11111111]
|
||||||
|
Pos=0,24
|
||||||
|
Size=900,576
|
||||||
|
Collapsed=0
|
||||||
|
|
||||||
|
[Window][ Properties]
|
||||||
|
Pos=706,24
|
||||||
|
Size=194,576
|
||||||
|
Collapsed=0
|
||||||
|
DockId=0x00000002,0
|
||||||
|
|
||||||
|
[Window][Debug##Default]
|
||||||
|
Pos=60,60
|
||||||
|
Size=400,400
|
||||||
|
Collapsed=0
|
||||||
|
|
||||||
|
[Window][ Entities]
|
||||||
|
Pos=0,24
|
||||||
|
Size=176,576
|
||||||
|
Collapsed=0
|
||||||
|
DockId=0x00000003,0
|
||||||
|
|
||||||
|
[Window][ Files]
|
||||||
|
Pos=178,442
|
||||||
|
Size=526,158
|
||||||
|
Collapsed=0
|
||||||
|
DockId=0x00000006,0
|
||||||
|
|
||||||
|
[Window][ Scene]
|
||||||
|
Pos=178,24
|
||||||
|
Size=526,416
|
||||||
|
Collapsed=0
|
||||||
|
DockId=0x00000005,0
|
||||||
|
|
||||||
|
[Window][ Console]
|
||||||
|
Pos=178,442
|
||||||
|
Size=526,158
|
||||||
|
Collapsed=0
|
||||||
|
DockId=0x00000006,1
|
||||||
|
|
||||||
|
[Docking][Data]
|
||||||
|
DockSpace ID=0x8B93E3BD Window=0xA787BDB4 Pos=0,24 Size=900,576 Split=X
|
||||||
|
DockNode ID=0x00000003 Parent=0x8B93E3BD SizeRef=176,576 Selected=0xCCD86976
|
||||||
|
DockNode ID=0x00000004 Parent=0x8B93E3BD SizeRef=722,576 Split=X
|
||||||
|
DockNode ID=0x00000001 Parent=0x00000004 SizeRef=526,576 Split=Y Selected=0xEE09B48D
|
||||||
|
DockNode ID=0x00000005 Parent=0x00000001 SizeRef=517,416 CentralNode=1 Selected=0xEE09B48D
|
||||||
|
DockNode ID=0x00000006 Parent=0x00000001 SizeRef=517,158 Selected=0x3CB89FC3
|
||||||
|
DockNode ID=0x00000002 Parent=0x00000004 SizeRef=194,576 Selected=0x7B89DB48
|
||||||
|
|
@ -33,17 +33,19 @@ void GUI::LoadConfigs()
|
|||||||
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
|
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
|
||||||
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
|
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
|
||||||
|
|
||||||
|
io.IniFilename = EDITOR_RESOURCES_PATH"imgui.ini";
|
||||||
|
|
||||||
float baseFontSize = 14.0f;
|
float baseFontSize = 14.0f;
|
||||||
float iconFontSize = baseFontSize * 2.0f / 2.4f; // FontAwesome fonts need to have their sizes reduced by 2.0f/3.0f in order to align correctly
|
float iconFontSize = baseFontSize * 2.0f / 2.4f; // FontAwesome fonts need to have their sizes reduced by 2.0f/3.0f in order to align correctly
|
||||||
|
|
||||||
io.Fonts->AddFontFromFileTTF("fonts/Ruda-Bold.ttf", baseFontSize);
|
io.Fonts->AddFontFromFileTTF(ENGINE_RESOURCES_PATH"fonts/Ruda-Bold.ttf", baseFontSize);
|
||||||
|
|
||||||
static const ImWchar iconsRanges[] = { ICON_MIN_FA, ICON_MAX_16_FA, 0 };
|
static const ImWchar iconsRanges[] = { ICON_MIN_FA, ICON_MAX_16_FA, 0 };
|
||||||
ImFontConfig iconsConfig;
|
ImFontConfig iconsConfig;
|
||||||
iconsConfig.MergeMode = true;
|
iconsConfig.MergeMode = true;
|
||||||
iconsConfig.PixelSnapH = true;
|
iconsConfig.PixelSnapH = true;
|
||||||
iconsConfig.GlyphMinAdvanceX = iconFontSize;
|
iconsConfig.GlyphMinAdvanceX = iconFontSize;
|
||||||
io.Fonts->AddFontFromFileTTF( "fonts/" FONT_ICON_FILE_NAME_FAS, iconFontSize, &iconsConfig, iconsRanges );
|
io.Fonts->AddFontFromFileTTF(ENGINE_RESOURCES_PATH"fonts/" FONT_ICON_FILE_NAME_FAS, iconFontSize, &iconsConfig, iconsRanges );
|
||||||
|
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
|
|
||||||
|
@ -21,14 +21,17 @@ file(GLOB COMPONENTS_SOURCES "${COMPONENTS_INCLUDES}/*.cpp")
|
|||||||
set(UI_INCLUDES ui)
|
set(UI_INCLUDES ui)
|
||||||
file(GLOB UI_SOURCES "${UI_INCLUDES}/*.cpp")
|
file(GLOB UI_SOURCES "${UI_INCLUDES}/*.cpp")
|
||||||
|
|
||||||
|
set(ENGINE_RESOURCES_DIR resources)
|
||||||
|
|
||||||
# Build engine as library
|
# Build engine as library
|
||||||
add_library(${PROJECT_NAME})
|
add_library(${PROJECT_NAME})
|
||||||
|
|
||||||
# Add resources folder
|
# Add resources folder
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||||
target_compile_definitions(${PROJECT_NAME} PUBLIC RESOURCES_PATH="./resources/")
|
file(COPY ${ENGINE_RESOURCES_DIR} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
target_compile_definitions(${PROJECT_NAME} PUBLIC ENGINE_RESOURCES_PATH="${CMAKE_CURRENT_BINARY_DIR}/resources/")
|
||||||
else()
|
else()
|
||||||
target_compile_definitions(${PROJECT_NAME} PUBLIC RESOURCES_PATH="${CMAKE_SOURCE_DIR}/engine/resources/")
|
target_compile_definitions(${PROJECT_NAME} PUBLIC ENGINE_RESOURCES_PATH="${CMAKE_CURRENT_SOURCE_DIR}/resources/")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Link sources, include directories, and third party libraries
|
# Link sources, include directories, and third party libraries
|
||||||
|
@ -47,7 +47,7 @@ RendererData& Renderer::GetData()
|
|||||||
|
|
||||||
void Renderer::LoadShaders()
|
void Renderer::LoadShaders()
|
||||||
{
|
{
|
||||||
s_Data.m_Shader = new Shader(RESOURCES_PATH"shaders/vertex.glsl", RESOURCES_PATH"shaders/fragment.glsl");
|
s_Data.m_Shader = new Shader(ENGINE_RESOURCES_PATH"shaders/vertex.glsl", ENGINE_RESOURCES_PATH"shaders/fragment.glsl");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::SetupBuffers()
|
void Renderer::SetupBuffers()
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
[Window][DockSpaceViewport_11111111]
|
|
||||||
Pos=0,19
|
|
||||||
Size=900,581
|
|
||||||
Collapsed=0
|
|
||||||
|
|
||||||
[Window][Debug##Default]
|
|
||||||
Pos=60,60
|
|
||||||
Size=400,400
|
|
||||||
Collapsed=0
|
|
||||||
|
|
||||||
[Window][Hierarchy]
|
|
||||||
Pos=0,19
|
|
||||||
Size=189,581
|
|
||||||
Collapsed=0
|
|
||||||
DockId=0x00000005,0
|
|
||||||
|
|
||||||
[Window][Scene]
|
|
||||||
Pos=191,19
|
|
||||||
Size=510,420
|
|
||||||
Collapsed=0
|
|
||||||
DockId=0x00000003,0
|
|
||||||
|
|
||||||
[Window][Project]
|
|
||||||
Pos=191,441
|
|
||||||
Size=510,159
|
|
||||||
Collapsed=0
|
|
||||||
DockId=0x00000004,0
|
|
||||||
|
|
||||||
[Window][Console]
|
|
||||||
Pos=191,441
|
|
||||||
Size=510,159
|
|
||||||
Collapsed=0
|
|
||||||
DockId=0x00000004,1
|
|
||||||
|
|
||||||
[Window][Inspector]
|
|
||||||
Pos=703,19
|
|
||||||
Size=197,581
|
|
||||||
Collapsed=0
|
|
||||||
DockId=0x00000002,0
|
|
||||||
|
|
||||||
[Docking][Data]
|
|
||||||
DockSpace ID=0x8B93E3BD Window=0xA787BDB4 Pos=0,19 Size=900,581 Split=X
|
|
||||||
DockNode ID=0x00000005 Parent=0x8B93E3BD SizeRef=189,581 Selected=0x29EABFBD
|
|
||||||
DockNode ID=0x00000006 Parent=0x8B93E3BD SizeRef=709,581 Split=X
|
|
||||||
DockNode ID=0x00000001 Parent=0x00000006 SizeRef=701,581 Split=Y
|
|
||||||
DockNode ID=0x00000003 Parent=0x00000001 SizeRef=608,420 CentralNode=1 Selected=0xE192E354
|
|
||||||
DockNode ID=0x00000004 Parent=0x00000001 SizeRef=608,159 Selected=0xD04A4B96
|
|
||||||
DockNode ID=0x00000002 Parent=0x00000006 SizeRef=197,581 Selected=0xE7039252
|
|
||||||
|
|
@ -1,34 +1,43 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
BUILD_DIR="build"
|
RELEASE_BUILD_DIR="build-release"
|
||||||
|
DEBUG_BUILD_DIR="build-debug"
|
||||||
EDITOR_DIR="editor"
|
EDITOR_DIR="editor"
|
||||||
NAME="ferx"
|
NAME="ferx"
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
release)
|
build-release)
|
||||||
cmake -S .. -B ../"$BUILD_DIR" -G Ninja -DCMAKE_BUILD_TYPE=Release
|
cmake -S .. -B ../"$RELEASE_BUILD_DIR" -G Ninja -DCMAKE_BUILD_TYPE=Release
|
||||||
cmake --build ../"$BUILD_DIR" -j8
|
cmake --build ../"$RELEASE_BUILD_DIR" -j8
|
||||||
;;
|
;;
|
||||||
debug)
|
build-debug)
|
||||||
cmake -S .. -B ../"$BUILD_DIR" -G Ninja -DCMAKE_BUILD_TYPE=Debug
|
cmake -S .. -B ../"$DEBUG_BUILD_DIR" -G Ninja -DCMAKE_BUILD_TYPE=Debug
|
||||||
cmake --build ../"$BUILD_DIR" -j8
|
cmake --build ../"$DEBUG_BUILD_DIR" -j8
|
||||||
;;
|
;;
|
||||||
run)
|
run-release)
|
||||||
cd "../$BUILD_DIR/$EDITOR_DIR" && ./"$NAME"
|
cd "../$RELEASE_BUILD_DIR/$EDITOR_DIR" && ./"$NAME"
|
||||||
;;
|
;;
|
||||||
clean)
|
run-debug)
|
||||||
cmake --build ../"$BUILD_DIR" --target clean
|
cd "../$DEBUG_BUILD_DIR/$EDITOR_DIR" && ./"$NAME"
|
||||||
;;
|
;;
|
||||||
clean-all)
|
clean-release)
|
||||||
rm -r ../"$BUILD_DIR"
|
cmake --build ../"$RELEASE_BUILD_DIR" --target clean
|
||||||
|
;;
|
||||||
|
clean-debug)
|
||||||
|
cmake --build ../"$DEBUG_BUILD_DIR" --target clean
|
||||||
|
;;
|
||||||
|
clean-release-all)
|
||||||
|
rm -r ../"$RELEASE_BUILD_DIR"
|
||||||
|
;;
|
||||||
|
clean-debug-all)
|
||||||
|
rm -r ../"$DEBUG_BUILD_DIR"
|
||||||
;;
|
;;
|
||||||
all)
|
all)
|
||||||
bash $0 enter_dir
|
bash $0 build-debug
|
||||||
bash $0 debug
|
bash $0 run-debug
|
||||||
bash $0 run
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: $0 {release|debug|run|clean|clean-all|all}"
|
echo "Usage: $0 {all|build-release|build-debug|run-release|run-debug|clean-release|clean-debug|clean-release-all|clean-debug-all}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -1,24 +1,34 @@
|
|||||||
BUILD_DIR = build
|
DEBUG_BUILD_DIR = build-debug
|
||||||
|
RELEASE_BUILD_DIR = build-release
|
||||||
EDITOR_DIR = editor
|
EDITOR_DIR = editor
|
||||||
NAME = ferx
|
NAME = ferx
|
||||||
|
|
||||||
RM += -r
|
RM += -r
|
||||||
|
|
||||||
all: debug run
|
all: build-debug run-debug
|
||||||
|
|
||||||
release:
|
build-release:
|
||||||
cmake -S .. -B ../$(BUILD_DIR) -G Ninja -DCMAKE_BUILD_TYPE=Release
|
cmake -S .. -B ../$(RELEASE_BUILD_DIR) -G Ninja -DCMAKE_BUILD_TYPE=Release
|
||||||
cmake --build ../$(BUILD_DIR) -j8
|
cmake --build ../$(RELEASE_BUILD_DIR) -j8
|
||||||
|
|
||||||
debug:
|
build-debug:
|
||||||
cmake -S .. -B ../$(BUILD_DIR) -G Ninja -DCMAKE_BUILD_TYPE=Debug
|
cmake -S .. -B ../$(DEBUG_BUILD_DIR) -G Ninja -DCMAKE_BUILD_TYPE=Debug
|
||||||
cmake --build ../$(BUILD_DIR) -j8
|
cmake --build ../$(DEBUG_BUILD_DIR) -j8
|
||||||
|
|
||||||
run:
|
run-release:
|
||||||
cd ../$(BUILD_DIR)/${EDITOR_DIR} && ./${NAME}
|
cd ../$(RELEASE_BUILD_DIR)/${EDITOR_DIR} && ./${NAME}
|
||||||
|
|
||||||
clean:
|
run-debug:
|
||||||
cmake --build ../$(BUILD_DIR) --target clean
|
cd ../$(DEBUG_BUILD_DIR)/${EDITOR_DIR} && ./${NAME}
|
||||||
|
|
||||||
|
clean-release:
|
||||||
|
cmake --build ../$(RELEASE_BUILD_DIR) --target clean
|
||||||
|
|
||||||
clean-all:
|
clean-debug:
|
||||||
$(RM) ../$(BUILD_DIR)
|
cmake --build ../$(DEBUG_BUILD_DIR) --target clean
|
||||||
|
|
||||||
|
clean-release-all:
|
||||||
|
$(RM) ../$(RELEASE_BUILD_DIR)
|
||||||
|
|
||||||
|
clean-debug-all:
|
||||||
|
$(RM) ../$(DEBUG_BUILD_DIR)
|
||||||
|
Loading…
Reference in New Issue
Block a user