From e1cbce2703f3e778d419cd5eff2771edb925fbec Mon Sep 17 00:00:00 2001 From: En Yi Date: Sat, 21 Jan 2023 09:38:14 +0800 Subject: [PATCH] Make a directory for ECS Changelog: - Move Entity and Component files into a dedicated folder - This is for clean up --- CMakeLists.txt | 15 +++++---------- engine/CMakeLists.txt | 1 + engine/EC/CMakeLists.txt | 14 ++++++++++++++ components.h => engine/EC/components.h | 0 entManager.c => engine/EC/entManager.c | 0 entManager.h => engine/EC/entManager.h | 0 entity.h => engine/EC/entity.h | 0 mempool.c => engine/EC/mempool.c | 0 mempool.h => engine/EC/mempool.h | 0 {sc => engine/EC/sc}/CMakeLists.txt | 0 {sc => engine/EC/sc}/LICENSE | 0 {sc => engine/EC/sc}/array/CMakeLists.txt | 0 {sc => engine/EC/sc}/array/README.md | 0 {sc => engine/EC/sc}/array/sc_array.h | 0 {sc => engine/EC/sc}/heap/CMakeLists.txt | 0 {sc => engine/EC/sc}/heap/README.md | 0 {sc => engine/EC/sc}/heap/sc_heap.c | 0 {sc => engine/EC/sc}/heap/sc_heap.h | 0 {sc => engine/EC/sc}/map/CMakeLists.txt | 0 {sc => engine/EC/sc}/map/README.md | 0 {sc => engine/EC/sc}/map/sc_map.c | 0 {sc => engine/EC/sc}/map/sc_map.h | 0 {sc => engine/EC/sc}/queue/CMakeLists.txt | 0 {sc => engine/EC/sc}/queue/README.md | 0 {sc => engine/EC/sc}/queue/sc_queue.h | 0 25 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 engine/CMakeLists.txt create mode 100644 engine/EC/CMakeLists.txt rename components.h => engine/EC/components.h (100%) rename entManager.c => engine/EC/entManager.c (100%) rename entManager.h => engine/EC/entManager.h (100%) rename entity.h => engine/EC/entity.h (100%) rename mempool.c => engine/EC/mempool.c (100%) rename mempool.h => engine/EC/mempool.h (100%) rename {sc => engine/EC/sc}/CMakeLists.txt (100%) rename {sc => engine/EC/sc}/LICENSE (100%) rename {sc => engine/EC/sc}/array/CMakeLists.txt (100%) rename {sc => engine/EC/sc}/array/README.md (100%) rename {sc => engine/EC/sc}/array/sc_array.h (100%) rename {sc => engine/EC/sc}/heap/CMakeLists.txt (100%) rename {sc => engine/EC/sc}/heap/README.md (100%) rename {sc => engine/EC/sc}/heap/sc_heap.c (100%) rename {sc => engine/EC/sc}/heap/sc_heap.h (100%) rename {sc => engine/EC/sc}/map/CMakeLists.txt (100%) rename {sc => engine/EC/sc}/map/README.md (100%) rename {sc => engine/EC/sc}/map/sc_map.c (100%) rename {sc => engine/EC/sc}/map/sc_map.h (100%) rename {sc => engine/EC/sc}/queue/CMakeLists.txt (100%) rename {sc => engine/EC/sc}/queue/README.md (100%) rename {sc => engine/EC/sc}/queue/sc_queue.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b028b6..d15f671 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,11 +7,9 @@ set(CMAKE_C_STANDARD 99) set(RAYLIB_DIR $ENV{HOME}/Documents/Coding/raylib/out/) -add_subdirectory(sc) +add_subdirectory(engine) add_executable(${PROJECT_NAME} main.c - entManager.c - mempool.c ) target_include_directories(${PROJECT_NAME} @@ -25,6 +23,7 @@ target_link_directories(${PROJECT_NAME} ) target_link_libraries(${PROJECT_NAME} + lib_EC sc_queue sc_map raylib @@ -33,8 +32,6 @@ target_link_libraries(${PROJECT_NAME} add_executable(EntManager_test entManager_test.c - entManager.c - mempool.c ) target_compile_options(EntManager_test PRIVATE -fsanitize=address -gdwarf-4) target_link_options(EntManager_test PRIVATE -fsanitize=address -gdwarf-4) @@ -48,17 +45,15 @@ target_link_directories(EntManager_test ${RAYLIB_DIR}/lib ) target_link_libraries(EntManager_test + lib_EC sc_queue sc_map ) - add_executable(scene_test scene_test.c scene_impl.c scene.c - entManager.c - mempool.c ) target_include_directories(scene_test @@ -76,6 +71,7 @@ target_link_directories(scene_test ) target_link_libraries(scene_test + lib_EC sc_queue sc_map sc_array @@ -87,8 +83,6 @@ add_executable(scene_test_mem scene_test.c scene_impl.c scene.c - entManager.c - mempool.c ) target_include_directories(scene_test_mem @@ -105,6 +99,7 @@ target_link_directories(scene_test_mem ) target_link_libraries(scene_test_mem + lib_EC sc_queue sc_map sc_array diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt new file mode 100644 index 0000000..0bb7590 --- /dev/null +++ b/engine/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(EC) diff --git a/engine/EC/CMakeLists.txt b/engine/EC/CMakeLists.txt new file mode 100644 index 0000000..f397030 --- /dev/null +++ b/engine/EC/CMakeLists.txt @@ -0,0 +1,14 @@ +add_subdirectory(sc) +add_library(lib_EC STATIC + mempool.c + entManager.c +) +target_include_directories(lib_EC + PUBLIC + ${CMAKE_CURRENT_LIST_DIR} + ${RAYLIB_DIR}/include +) +target_link_libraries(lib_EC + PRIVATE + raylib +) diff --git a/components.h b/engine/EC/components.h similarity index 100% rename from components.h rename to engine/EC/components.h diff --git a/entManager.c b/engine/EC/entManager.c similarity index 100% rename from entManager.c rename to engine/EC/entManager.c diff --git a/entManager.h b/engine/EC/entManager.h similarity index 100% rename from entManager.h rename to engine/EC/entManager.h diff --git a/entity.h b/engine/EC/entity.h similarity index 100% rename from entity.h rename to engine/EC/entity.h diff --git a/mempool.c b/engine/EC/mempool.c similarity index 100% rename from mempool.c rename to engine/EC/mempool.c diff --git a/mempool.h b/engine/EC/mempool.h similarity index 100% rename from mempool.h rename to engine/EC/mempool.h diff --git a/sc/CMakeLists.txt b/engine/EC/sc/CMakeLists.txt similarity index 100% rename from sc/CMakeLists.txt rename to engine/EC/sc/CMakeLists.txt diff --git a/sc/LICENSE b/engine/EC/sc/LICENSE similarity index 100% rename from sc/LICENSE rename to engine/EC/sc/LICENSE diff --git a/sc/array/CMakeLists.txt b/engine/EC/sc/array/CMakeLists.txt similarity index 100% rename from sc/array/CMakeLists.txt rename to engine/EC/sc/array/CMakeLists.txt diff --git a/sc/array/README.md b/engine/EC/sc/array/README.md similarity index 100% rename from sc/array/README.md rename to engine/EC/sc/array/README.md diff --git a/sc/array/sc_array.h b/engine/EC/sc/array/sc_array.h similarity index 100% rename from sc/array/sc_array.h rename to engine/EC/sc/array/sc_array.h diff --git a/sc/heap/CMakeLists.txt b/engine/EC/sc/heap/CMakeLists.txt similarity index 100% rename from sc/heap/CMakeLists.txt rename to engine/EC/sc/heap/CMakeLists.txt diff --git a/sc/heap/README.md b/engine/EC/sc/heap/README.md similarity index 100% rename from sc/heap/README.md rename to engine/EC/sc/heap/README.md diff --git a/sc/heap/sc_heap.c b/engine/EC/sc/heap/sc_heap.c similarity index 100% rename from sc/heap/sc_heap.c rename to engine/EC/sc/heap/sc_heap.c diff --git a/sc/heap/sc_heap.h b/engine/EC/sc/heap/sc_heap.h similarity index 100% rename from sc/heap/sc_heap.h rename to engine/EC/sc/heap/sc_heap.h diff --git a/sc/map/CMakeLists.txt b/engine/EC/sc/map/CMakeLists.txt similarity index 100% rename from sc/map/CMakeLists.txt rename to engine/EC/sc/map/CMakeLists.txt diff --git a/sc/map/README.md b/engine/EC/sc/map/README.md similarity index 100% rename from sc/map/README.md rename to engine/EC/sc/map/README.md diff --git a/sc/map/sc_map.c b/engine/EC/sc/map/sc_map.c similarity index 100% rename from sc/map/sc_map.c rename to engine/EC/sc/map/sc_map.c diff --git a/sc/map/sc_map.h b/engine/EC/sc/map/sc_map.h similarity index 100% rename from sc/map/sc_map.h rename to engine/EC/sc/map/sc_map.h diff --git a/sc/queue/CMakeLists.txt b/engine/EC/sc/queue/CMakeLists.txt similarity index 100% rename from sc/queue/CMakeLists.txt rename to engine/EC/sc/queue/CMakeLists.txt diff --git a/sc/queue/README.md b/engine/EC/sc/queue/README.md similarity index 100% rename from sc/queue/README.md rename to engine/EC/sc/queue/README.md diff --git a/sc/queue/sc_queue.h b/engine/EC/sc/queue/sc_queue.h similarity index 100% rename from sc/queue/sc_queue.h rename to engine/EC/sc/queue/sc_queue.h