diff --git a/CMakeLists.txt b/CMakeLists.txt index dc18f4f..3161fd1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,13 @@ cmake_minimum_required(VERSION 3.22) -set(CMAKE_CXX_STANDARD 17) # Declare project project(ferx) +# Define C++ standard +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + # Define variables of directory paths -set(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/editor/src) -set(INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/editor/include) set(THIRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty) # Add thirdparty libraries @@ -15,14 +16,6 @@ add_subdirectory(${THIRDPARTY_DIR}/glfw) add_subdirectory(${THIRDPARTY_DIR}/glm) add_subdirectory(${THIRDPARTY_DIR}/imgui) -# Define macros for the project sources -file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS "${SOURCE_DIR}/*.cpp") -add_executable(${PROJECT_NAME}) - -target_compile_definitions(${PROJECT_NAME} PUBLIC RESOURCES_PATH="${CMAKE_CURRENT_SOURCE_DIR}/resources/") # This is useful to get an ASSETS_PATH in your IDE during development but you should comment this if you compile a release version and uncomment the next line -#target_compile_definitions(${PROJECT_NAME} PUBLIC RESOURCES_PATH="./resources/") # Uncomment this line to setup the ASSETS_PATH macro to the final assets directory when you share the game - -target_sources(${PROJECT_NAME} PRIVATE ${SOURCES} ) -target_include_directories(${PROJECT_NAME} PRIVATE ${INCLUDE_DIR}) - -target_link_libraries(${PROJECT_NAME} PRIVATE glfw glad glm imgui) +# Add engine and editor +add_subdirectory(engine) +add_subdirectory(editor) diff --git a/Makefile b/Makefile index ab126bc..fd57751 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ BUILD_DIR = build +EDITOR_DIR = editor NAME = ferx RM += -r @@ -14,7 +15,7 @@ debug: cmake --build $(BUILD_DIR) -j8 run: - cd $(BUILD_DIR) && ./${NAME} + cd $(BUILD_DIR)/${EDITOR_DIR} && ./${NAME} clean: cmake --build $(BUILD_DIR) --target clean diff --git a/editor/CMakeLists.txt b/editor/CMakeLists.txt new file mode 100644 index 0000000..cca5ab6 --- /dev/null +++ b/editor/CMakeLists.txt @@ -0,0 +1,16 @@ +project(editor) + +set(NAME ferx) +set(EDITOR_SOURCE_DIR src) +set(EDITOR_INCLUDE_DIR include) +set(EDITOR_RESOURCES_DIR resources) + +file(GLOB_RECURSE EDITOR_SOURCES ${EDITOR_SOURCE_DIR}/*.cpp) +file(COPY ${EDITOR_RESOURCES_DIR}/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + +add_executable(${NAME} ${EDITOR_SOURCES} ${EDITOR_HEADERS}) + +target_sources(${NAME} PRIVATE ${EDITOR_SOURCES}) +target_include_directories(${NAME} PRIVATE ${EDITOR_INCLUDE_DIR}) + +target_link_libraries(${NAME} engine) diff --git a/editor/resources/imgui.ini b/editor/resources/imgui.ini new file mode 100644 index 0000000..00c4073 --- /dev/null +++ b/editor/resources/imgui.ini @@ -0,0 +1,49 @@ +[Window][DockSpaceViewport_11111111] +Pos=0,19 +Size=800,581 +Collapsed=0 + +[Window][Debug##Default] +Pos=60,60 +Size=400,400 +Collapsed=0 + +[Window][Hierarchy] +Pos=602,19 +Size=198,581 +Collapsed=0 +DockId=0x00000006,0 + +[Window][Scene] +Pos=192,19 +Size=408,428 +Collapsed=0 +DockId=0x00000003,0 + +[Window][Project] +Pos=192,449 +Size=408,151 +Collapsed=0 +DockId=0x00000004,0 + +[Window][Console] +Pos=192,449 +Size=408,151 +Collapsed=0 +DockId=0x00000004,1 + +[Window][Inspector] +Pos=0,19 +Size=190,581 +Collapsed=0 +DockId=0x00000001,0 + +[Docking][Data] +DockSpace ID=0x8B93E3BD Window=0xA787BDB4 Pos=0,19 Size=800,581 Split=X + DockNode ID=0x00000005 Parent=0x8B93E3BD SizeRef=600,581 Split=X + DockNode ID=0x00000001 Parent=0x00000005 SizeRef=190,581 Selected=0xE7039252 + DockNode ID=0x00000002 Parent=0x00000005 SizeRef=408,581 Split=Y + DockNode ID=0x00000003 Parent=0x00000002 SizeRef=608,428 CentralNode=1 Selected=0xE192E354 + DockNode ID=0x00000004 Parent=0x00000002 SizeRef=608,151 Selected=0xD04A4B96 + DockNode ID=0x00000006 Parent=0x8B93E3BD SizeRef=198,581 Selected=0x29EABFBD + diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt new file mode 100644 index 0000000..de3a54b --- /dev/null +++ b/engine/CMakeLists.txt @@ -0,0 +1,16 @@ +project(engine) + +set(ENGINE_SOURCE_DIR src) +set(ENGINE_INCLUDE_DIR include) + +file(GLOB_RECURSE ENGINE_SOURCES ${ENGINE_SOURCE_DIR}/*.cpp) + +add_library(${PROJECT_NAME}) + +target_compile_definitions(${PROJECT_NAME} PUBLIC RESOURCES_PATH="${CMAKE_CURRENT_SOURCE_DIR}/resources/") # This is useful to get an ASSETS_PATH in your IDE during development but you should comment this if you compile a release version and uncomment the next line +#target_compile_definitions(${PROJECT_NAME} PUBLIC RESOURCES_PATH="./resources/") # Uncomment this line to setup the ASSETS_PATH macro to the final assets directory when you share the game + +target_sources(${PROJECT_NAME} PRIVATE ${ENGINE_SOURCES}) +target_include_directories(${PROJECT_NAME} PRIVATE ${ENGINE_INCLUDE_DIR}) + +target_link_libraries(${PROJECT_NAME} glfw glad glm imgui) diff --git a/engine/src/main.cpp b/engine/src/main.cpp new file mode 100644 index 0000000..e69de29