diff --git a/CMakeLists.txt b/CMakeLists.txt index a25a21f7..e1608021 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,10 +8,14 @@ set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED True) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/") # Variable Caches set(DAWN_CACHE_TARGET "dawn-target") +set(DAWN_TARGET_NAME "Dawn") + +if(NOT DEFINED DAWN_TARGET) + set(DAWN_TARGET linux-x64-glfw CACHE INTERNAL ${DAWN_CACHE_TARGET}) +endif() # Set Common Build Variables set(DAWN_ROOT_DIR "${CMAKE_SOURCE_DIR}") @@ -23,12 +27,7 @@ set(DAWN_ASSETS_BUILD_DIR "${DAWN_BUILD_DIR}/assets") set(DAWN_GENERATED_DIR "${DAWN_BUILD_DIR}/generated") set(DAWN_TEMP_DIR "${DAWN_BUILD_DIR}/temp") -# Add CMake Tools -add_subdirectory(cmake) - -set(DAWN_BUILD_BINARY ${DAWN_BUILD_DIR}/src/${DAWN_BUILDING}/${DAWN_TARGET_NAME}) - -# Initialize Project First. +# Initialize Project. project(Dawn VERSION 1.0.0 LANGUAGES C CXX diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt deleted file mode 100644 index 2eee3adc..00000000 --- a/cmake/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Includes -add_subdirectory(hosts) -add_subdirectory(targets) \ No newline at end of file diff --git a/cmake/hosts/CMakeLists.txt b/cmake/hosts/CMakeLists.txt deleted file mode 100644 index 18d667fb..00000000 --- a/cmake/hosts/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Check for build target, or default -if(WIN32) - set(DAWN_BUILD_HOST "build-host-win32") -elseif(UNIX AND NOT APPLE) - set(DAWN_BUILD_HOST "build-host-linux") -elseif(UNIX AND APPLE) - set(DAWN_BUILD_HOST "build-host-osx") -endif() - -add_subdirectory(${DAWN_BUILD_HOST}) \ No newline at end of file diff --git a/cmake/hosts/README.md b/cmake/hosts/README.md deleted file mode 100644 index 146cd14f..00000000 --- a/cmake/hosts/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# CMake Hosts -CMake Hosts help the build system define how a HOST (Not the target/client) does -its building. Host would be the system you are using, right now, to do the build -with. \ No newline at end of file diff --git a/cmake/hosts/build-host-linux/CMakeLists.txt b/cmake/hosts/build-host-linux/CMakeLists.txt deleted file mode 100644 index 22ea4aff..00000000 --- a/cmake/hosts/build-host-linux/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -set(DAWN_BUILD_HOST_LIBS "m" CACHE INTERNAL ${DAWN_CACHE_TARGET}) \ No newline at end of file diff --git a/cmake/hosts/build-host-osx/CMakeLists.txt b/cmake/hosts/build-host-osx/CMakeLists.txt deleted file mode 100644 index d2107d5b..00000000 --- a/cmake/hosts/build-host-osx/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -set(DAWN_BUILD_HOST_LIBS "" CACHE INTERNAL ${DAWN_CACHE_TARGET}) \ No newline at end of file diff --git a/cmake/hosts/build-host-win32/CMakeLists.txt b/cmake/hosts/build-host-win32/CMakeLists.txt deleted file mode 100644 index 11e150c8..00000000 --- a/cmake/hosts/build-host-win32/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -set(DAWN_BUILD_HOST_LIBS "" CACHE INTERNAL ${DAWN_CACHE_TARGET}) \ No newline at end of file diff --git a/cmake/modules/FindGLFW.cmake b/cmake/modules/FindGLFW.cmake deleted file mode 100644 index f61492df..00000000 --- a/cmake/modules/FindGLFW.cmake +++ /dev/null @@ -1,49 +0,0 @@ -find_path(GLFW_INCLUDE_DIR GLFW/glfw3.h - HINTS - ENV GLFWDIR - PATHS - "/usr" - "/usr/local" - "~/Library/Frameworks" - "/Library/Frameworks" - "/opt" - "$ENV{PROGRAMFILES}/glfw" - "$ENV{PROGRAMFILES}/glfw3" - PATH_SUFFIXES - include -) - -# Search for the library -FIND_LIBRARY(GLFW_LIBRARY - NAMES - glfw glfw3 GLFW GLFW3 - HINTS - ENV GLFWDIR - PATHS - "/usr" - "/usr/local" - "~/Library/Frameworks" - "/Library/Frameworks" - "/opt" - "$ENV{PROGRAMFILES}/glfw" - "$ENV{PROGRAMFILES}/glfw3" - PATH_SUFFIXES - lib - lib32 - lib64 - libs - lib-vc2012 - lib-vc2013 - lib-vc2015 - lib-vc2017 - lib-vc2019 - lib-vc2022 -) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS( - GLFW - REQUIRED_VARS GLFW_LIBRARY GLFW_INCLUDE_DIR -) - -mark_as_advanced(GLFW_LIBRARY GLFW_INCLUDE_DIR) diff --git a/cmake/modules/FindOpenAL.cmake b/cmake/modules/FindOpenAL.cmake deleted file mode 100644 index 1ca8c16e..00000000 --- a/cmake/modules/FindOpenAL.cmake +++ /dev/null @@ -1,49 +0,0 @@ -find_path(OPENAL_INCLUDE_DIR al.h - HINTS - ENV OPENALDIR - PATHS - "/usr" - "/usr/local" - "~/Library/Frameworks" - "/Library/Frameworks" - "/opt" - "$ENV{PROGRAMFILES}/openal" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]" - PATH_SUFFIXES - include/AL - AL/AL - include/OpenAL - include - AL - OpenAL -) - -# Search for the library -FIND_LIBRARY(OPENAL_LIBRARY - NAMES - OpenAL al openal OpenAL32 - HINTS - ENV OPENALDIR - PATHS - "/usr" - "/usr/local" - "~/Library/Frameworks" - "/Library/Frameworks" - "/opt" - "$ENV{PROGRAMFILES}/openal" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]" - PATH_SUFFIXES - lib - lib32 - lib64 - libs - ${_OpenAL_ARCH_DIR} -) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS( - OpenAL - REQUIRED_VARS OPENAL_LIBRARY OPENAL_INCLUDE_DIR -) - -mark_as_advanced(OPENAL_LIBRARY OPENAL_INCLUDE_DIR) diff --git a/cmake/targets/CMakeLists.txt b/cmake/targets/CMakeLists.txt deleted file mode 100644 index d5fbd0f6..00000000 --- a/cmake/targets/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Now validate we have a build target for real -if(NOT DEFINED DAWN_BUILD_TARGET) - set(DAWN_BUILD_TARGET "target-rpg-linux-glfw" CACHE INTERNAL ${DAWN_CACHE_TARGET}) -endif() - -message("Building target ${DAWN_BUILD_TARGET}") - -# Include the build target -add_subdirectory(${DAWN_BUILD_TARGET}) \ No newline at end of file diff --git a/cmake/targets/README.md b/cmake/targets/README.md deleted file mode 100644 index e03989c0..00000000 --- a/cmake/targets/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# CMake Targets -CMake Targets decide what you are intending to build. Targets are (usually) a -specific system, like vita, 3ds, switch, or a specific OS with a library, e.g. -targetting vulkan on linux vs targetting opengl on linux, or targetting opengl -on windows, etc. - -In addition the target also decides what project(s) to build. Usually this is -just the specific game and/or systems to be built, so if you are building a VN -game the target would need to let the build system know you want to rollup the -VN parts of the engine also. - -Note this is one of the very few build args that is required during the -configuration of cmake to make it build properly, failure to specify a target -will result in a build error. - -``` --DDAWN_BUILD_TARGET=target-helloworld-linux64-glfw -``` - -## Target Systems -- vita -- linux -- osx -- windows -- emscripten (Web) - -## Target Libraries -- vita (Includes OGL) -- glfw (Includes OGL) -- sdl2 (Includes OGL) - -## Target games -- liminal -- helloworld - -## Target Arcitectures -- vita (form of armv7) -- linux (x64 only) -- windows (x64 only) -- osx (targetting arm64 currently) \ No newline at end of file diff --git a/cmake/targets/target-helloworld-emscripten/CMakeLists.txt b/cmake/targets/target-helloworld-emscripten/CMakeLists.txt deleted file mode 100644 index f1818019..00000000 --- a/cmake/targets/target-helloworld-emscripten/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -set(DAWN_BUILDING dawnhelloworld CACHE INTERNAL ${DAWN_CACHE_TARGET}) -set(DAWN_BUILD_HOST_LIBS "" CACHE INTERNAL ${DAWN_CACHE_TARGET}) -set(DAWN_TARGET_EMSCRIPTEN true CACHE INTERNAL ${DAWN_CACHE_TARGET}) -set(DAWN_TARGET_GLFW true CACHE INTERNAL ${DAWN_CACHE_TARGET}) -set(DAWN_TARGET_NAME "HelloWorld" CACHE INTERNAL ${DAWN_CACHE_TARGET}) - -set(DAWN_EMSCRIPTEN_FLAGS "" CACHE INTERNAL ${DAWN_CACHE_TARGET}) - -# Ensures a .HTML file is generated. -set(CMAKE_EXECUTABLE_SUFFIX ".html" CACHE INTERNAL ${DAWN_CACHE_TARGET}) \ No newline at end of file diff --git a/cmake/targets/target-helloworld-linux-glfw/CMakeLists.txt b/cmake/targets/target-helloworld-linux-glfw/CMakeLists.txt deleted file mode 100644 index 2493a34d..00000000 --- a/cmake/targets/target-helloworld-linux-glfw/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -set(DAWN_BUILDING dawnhelloworld CACHE INTERNAL ${DAWN_CACHE_TARGET}) -set(DAWN_TARGET_LINUX true CACHE INTERNAL ${DAWN_CACHE_TARGET}) -set(DAWN_TARGET_GLFW true CACHE INTERNAL ${DAWN_CACHE_TARGET}) -set(DAWN_TARGET_NAME "HelloWorld" CACHE INTERNAL ${DAWN_CACHE_TARGET}) -set(DAWN_TARGET_ARCHIVE true CACHE INTERNAL ${DAWN_CACHE_TARGET}) \ No newline at end of file diff --git a/cmake/targets/target-helloworld-vita/CMakeLists.txt b/cmake/targets/target-helloworld-vita/CMakeLists.txt deleted file mode 100644 index e7cb57b6..00000000 --- a/cmake/targets/target-helloworld-vita/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -set(DAWN_BUILDING dawnhelloworld CACHE INTERNAL ${DAWN_CACHE_TARGET}) -set(DAWN_TARGET_VITA true CACHE INTERNAL ${DAWN_CACHE_TARGET}) -set(DAWN_BUILD_HOST_LIBS "" CACHE INTERNAL ${DAWN_CACHE_TARGET}) -set(DAWN_TARGET_NAME "HelloWorld" CACHE INTERNAL ${DAWN_CACHE_TARGET}) - -# Properties -set(DAWN_VITA_APP_NAME "Hello Vita" CACHE INTERNAL ${DAWN_CACHE_TARGET}) -set(DAWN_VITA_TITLEID "DAWN00000" CACHE INTERNAL ${DAWN_CACHE_TARGET}) -set(DAWN_VITA_VERSION "01.00" CACHE INTERNAL ${DAWN_CACHE_TARGET}) - -# Toolchain -if(DEFINED ENV{VITASDK}) - set(CMAKE_TOOLCHAIN_FILE "$ENV{VITASDK}/share/vita.toolchain.cmake" CACHE INTERNAL ${DAWN_CACHE_TARGET}) -else() - message(FATAL_ERROR "VITASDK Environment variable is missing! Either you do not have the VITASDK installed, or it is not set up with the env vars correctly.") -endif() \ No newline at end of file diff --git a/cmake/targets/target-rpg-linux-glfw/CMakeLists.txt b/cmake/targets/target-rpg-linux-glfw/CMakeLists.txt deleted file mode 100644 index 2915c185..00000000 --- a/cmake/targets/target-rpg-linux-glfw/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -set(DAWN_BUILDING dawnrpg CACHE INTERNAL ${DAWN_CACHE_TARGET}) -set(DAWN_TARGET_LINUX true CACHE INTERNAL ${DAWN_CACHE_TARGET}) -set(DAWN_TARGET_GLFW true CACHE INTERNAL ${DAWN_CACHE_TARGET}) -set(DAWN_TARGET_NAME "DawnRPG" CACHE INTERNAL ${DAWN_CACHE_TARGET}) -set(DAWN_TARGET_ARCHIVE true CACHE INTERNAL ${DAWN_CACHE_TARGET}) -set(DAWN_TARGET_TRUETYPE false CACHE INTERNAL ${DAWN_CACHE_TARGET}) \ No newline at end of file diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 8ca4cbff..c29b117d 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -3,51 +3,21 @@ # This software is released under the MIT License. # https://opensource.org/licenses/MIT -# GLFW -if(DAWN_TARGET_GLFW) - if(${CMAKE_SYSTEM_NAME} MATCHES "Emscripten") - set(DAWN_EMSCRIPTEN_FLAGS "${DAWN_EMSCRIPTEN_FLAGS} -s USE_GLFW=3" CACHE INTERNAL ${DAWN_CACHE_TARGET}) - add_subdirectory(glad) - else() - add_subdirectory(glad) - add_subdirectory(glfw) - endif() -endif() - -# SDL -if(DAWN_TARGET_SDL2) - add_subdirectory(glad) - add_subdirectory(SDL) -endif() - -# GLM add_subdirectory(glm) -# FreeType -if(${CMAKE_SYSTEM_NAME} MATCHES "Emscripten") - set(DAWN_EMSCRIPTEN_FLAGS "${DAWN_EMSCRIPTEN_FLAGS} -s USE_FREETYPE=1" CACHE INTERNAL ${DAWN_CACHE_TARGET}) -else() - add_subdirectory(freetype) -endif() - -# LibArchive -if(DAWN_TARGET_ARCHIVE) +if(DAWN_TARGET STREQUAL "linux-x64-glfw") + add_subdirectory(glad) + add_subdirectory(glfw) add_subdirectory(libarchive) +else() + message(FATAL_ERROR "Unknown target: ${DAWN_TARGET}") endif() -# OpenAL -if(DAWN_TARGET_OPENAL) - set(LIBTYPE "STATIC") - add_subdirectory(openal-soft) +# if(DAWN_TARGET_OPENAL) +# set(LIBTYPE "STATIC") +# add_subdirectory(openal-soft) - set(BUILD_TESTS OFF CACHE BOOL "Build tests" FORCE) - set(BUILD_EXAMPLES OFF CACHE BOOL "Build examples" FORCE) - add_subdirectory(AudioFile) -endif() - -# Emscripten (TESTING ONLY) -if(DEFINED DAWN_EMSCRIPTEN_FLAGS) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DAWN_EMSCRIPTEN_FLAGS}" CACHE INTERNAL ${DAWN_CACHE_TARGET}) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${DAWN_EMSCRIPTEN_FLAGS}" CACHE INTERNAL ${DAWN_CACHE_TARGET}) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${DAWN_EMSCRIPTEN_FLAGS}" CACHE INTERNAL ${DAWN_CACHE_TARGET}) -endif() \ No newline at end of file +# set(BUILD_TESTS OFF CACHE BOOL "Build tests" FORCE) +# set(BUILD_EXAMPLES OFF CACHE BOOL "Build examples" FORCE) +# add_subdirectory(AudioFile) +# endif() \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7fcf387d..783b56be 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,75 +3,21 @@ # This software is released under the MIT License. # https://opensource.org/licenses/MIT -# Custom variables -set( - DAWN_TARGET_DEPENDENCIES_LAST - CACHE INTERNAL ${DAWN_CACHE_TARGET} -) - # Build Project add_executable(${DAWN_TARGET_NAME}) -# Change what we are building. Pulled from the cmake/targets dir. -if(DEFINED DAWN_BUILDING) - add_subdirectory(${DAWN_BUILDING}) +# Add in base library +add_subdirectory(dawn) + +# Compile entry targets +if(DAWN_TARGET STREQUAL "linux-x64-glfw") + add_subdirectory(dawnlinux) + add_subdirectory(dawnglfw) + add_subdirectory(dawnopengl) + add_subdirectory(dawnpoker) +else() + message(FATAL_ERROR "You need to define an entry target") endif() -# Validate game project includes the target name -if(DEFINED DAWN_TARGET_NAME) - # Add in base library - add_subdirectory(dawn) - - # Compile entry targets - if(DAWN_TARGET_WIN32) - add_subdirectory(dawnwin32) - elseif(DAWN_TARGET_LINUX) - add_subdirectory(dawnlinux) - elseif(DAWN_TARGET_OSX) - add_subdirectory(dawnosx) - elseif(DAWN_TARGET_VITA) - add_subdirectory(dawnvita) - elseif(DAWN_TARGET_EMSCRIPTEN) - add_subdirectory(dawnemscripten) - else() - message(FATAL_ERROR "You need to define an entry target") - endif() - - # Host Libraries - target_link_libraries(${DAWN_TARGET_NAME} - PUBLIC - ${DAWN_BUILD_HOST_LIBS} - ) - - # Compile support targets - if(DAWN_TARGET_GLFW) - add_subdirectory(dawnglfw) - add_subdirectory(dawnopengl) - endif() - - if(DAWN_TARGET_TRUETYPE) - add_subdirectory(dawntruetype) - endif() - - if(DAWN_TARGET_SDL2) - add_subdirectory(dawnsdl2) - add_subdirectory(dawnopengl) - endif() - - if(DAWN_TARGET_VITA) - add_subdirectory(dawnopengl) - endif() - - if(DAWN_TARGET_OPENAL) - add_subdirectory(dawnopenal) - endif() - - # Late definitions, used by tools - if(NOT DAWN_TARGET_DEPENDENCIES_LAST) - else() - add_dependencies(${DAWN_TARGET_NAME} ${DAWN_TARGET_DEPENDENCIES_LAST}) - endif() - - # Compress the game assets. - add_dependencies(${DAWN_TARGET_NAME} dawnassets) -endif() \ No newline at end of file +# Compress the game assets. +add_dependencies(${DAWN_TARGET_NAME} dawnassets) \ No newline at end of file diff --git a/src/dawn/game/Game.cpp b/src/dawn/game/Game.cpp index 6a1d38a6..4b07d926 100644 --- a/src/dawn/game/Game.cpp +++ b/src/dawn/game/Game.cpp @@ -18,8 +18,8 @@ void Game::init() { inputManager.init(shared_from_this()); saveManager.init(shared_from_this()); - auto initialScene = GameInit::getInitialScene(); - nextFrameScene = std::make_shared(shared_from_this(), initialScene); + auto initialScene = Scene::getInitialScene(); + this->nextFrameScene = std::make_shared(shared_from_this(), initialScene); } void Game::update() { diff --git a/src/dawn/scene/Scene.hpp b/src/dawn/scene/Scene.hpp index 095a866f..c7f3814a 100644 --- a/src/dawn/scene/Scene.hpp +++ b/src/dawn/scene/Scene.hpp @@ -31,6 +31,13 @@ namespace Dawn { TimeoutEvent onTimeout; IntervalEvent onInterval; + /** + * Returns the initial scene for the game. + * + * @return Initial scene function. + */ + static const std::function getInitialScene(); + /** * Constructs a scene object. * diff --git a/src/dawnrpg/CMakeLists.txt b/src/dawnpoker/CMakeLists.txt similarity index 59% rename from src/dawnrpg/CMakeLists.txt rename to src/dawnpoker/CMakeLists.txt index 84ad2889..6ff521d1 100644 --- a/src/dawnrpg/CMakeLists.txt +++ b/src/dawnpoker/CMakeLists.txt @@ -9,9 +9,14 @@ target_include_directories(${DAWN_TARGET_NAME} ${CMAKE_CURRENT_LIST_DIR} ) +# Sources +target_sources(${DAWN_TARGET_NAME} + PRIVATE + dawnpoker.cpp +) + # Subdirs -add_subdirectory(game) -add_subdirectory(scene) +add_subdirectory(scenes) # Assets -# include("${DAWN_ASSETS_SOURCE_DIR}/games/helloworld/CMakeLists.txt") \ No newline at end of file +# include("${DAWN_ASSETS_SOURCE_DIR}/games/dawnpoker/CMakeLists.txt") \ No newline at end of file diff --git a/src/dawnpoker/dawnpoker.cpp b/src/dawnpoker/dawnpoker.cpp new file mode 100644 index 00000000..c21cc9d5 --- /dev/null +++ b/src/dawnpoker/dawnpoker.cpp @@ -0,0 +1,12 @@ +// Copyright (c) 2024 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "scenes/SceneList.hpp" + +using namespace Dawn; + +const std::function Scene::getInitialScene() { + return Dawn::testScene; +} \ No newline at end of file diff --git a/src/dawnrpg/game/CMakeLists.txt b/src/dawnpoker/scenes/CMakeLists.txt similarity index 90% rename from src/dawnrpg/game/CMakeLists.txt rename to src/dawnpoker/scenes/CMakeLists.txt index 57b52897..d2eb416c 100644 --- a/src/dawnrpg/game/CMakeLists.txt +++ b/src/dawnpoker/scenes/CMakeLists.txt @@ -5,5 +5,5 @@ target_sources(${DAWN_TARGET_NAME} PRIVATE - GameInit.cpp + TestScene.cpp ) \ No newline at end of file diff --git a/src/dawnrpg/scene/SceneList.hpp b/src/dawnpoker/scenes/SceneList.hpp similarity index 67% rename from src/dawnrpg/scene/SceneList.hpp rename to src/dawnpoker/scenes/SceneList.hpp index 6ab98c67..225d44ca 100644 --- a/src/dawnrpg/scene/SceneList.hpp +++ b/src/dawnpoker/scenes/SceneList.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2023 Dominic Masters +// Copyright (c) 2024 Dominic Masters // // This software is released under the MIT License. // https://opensource.org/licenses/MIT @@ -7,5 +7,5 @@ #include "scene/Scene.hpp" namespace Dawn { - void helloWorldScene(Scene &s); -} \ No newline at end of file + void testScene(Scene &scene); +} diff --git a/src/dawnpoker/scenes/TestScene.cpp b/src/dawnpoker/scenes/TestScene.cpp new file mode 100644 index 00000000..79875b88 --- /dev/null +++ b/src/dawnpoker/scenes/TestScene.cpp @@ -0,0 +1,29 @@ + +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "scenes/SceneList.hpp" +#include "component/display/Camera.hpp" +#include "prefab/SimpleSpinningCube.hpp" +#include "component/display/material/SimpleTexturedMaterial.hpp" +#include "display/mesh/CubeMesh.hpp" + +using namespace Dawn; + +void Dawn::testScene(Scene &s) { + auto cameraItem = s.createSceneItem(); + auto camera = cameraItem->addComponent(); + cameraItem->lookAt({ 3, 3, 3 }, { 0, 0, 0 }, { 0, 1, 0 }); + camera->clipFar = 99999.99f; + + auto cube = s.createSceneItem(); + auto cubeMesh = std::make_shared(); + auto cubeRenderer = cube->addComponent(); + auto cubeMaterial = cube->addComponent(); + + cubeRenderer->mesh = cubeMesh; + cubeMesh->createBuffers(CUBE_VERTICE_COUNT, CUBE_INDICE_COUNT); + CubeMesh::buffer(cubeMesh, glm::vec3(0,0,0), glm::vec3(1, 1, 1), 0, 0); +} \ No newline at end of file diff --git a/src/dawnrpg/game/GameInit.cpp b/src/dawnrpg/game/GameInit.cpp deleted file mode 100644 index 4aef18a2..00000000 --- a/src/dawnrpg/game/GameInit.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "game/GameInit.hpp" -#include "scene/SceneList.hpp" - -using namespace Dawn; - -std::function GameInit::getInitialScene() { - return helloWorldScene; -} \ No newline at end of file diff --git a/src/dawnrpg/scene/CMakeLists.txt b/src/dawnrpg/scene/CMakeLists.txt deleted file mode 100644 index dfda9095..00000000 --- a/src/dawnrpg/scene/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - HelloWorldScene.cpp -) \ No newline at end of file diff --git a/src/dawnrpg/scene/HelloWorldScene.cpp b/src/dawnrpg/scene/HelloWorldScene.cpp deleted file mode 100644 index 77b5958a..00000000 --- a/src/dawnrpg/scene/HelloWorldScene.cpp +++ /dev/null @@ -1,46 +0,0 @@ - -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "scene/SceneList.hpp" -#include "component/display/Camera.hpp" -#include "prefab/SimpleSpinningCube.hpp" -#include "component/display/material/SimpleTexturedMaterial.hpp" -#include "display/mesh/QuadMesh.hpp" -#include "component/ui/UICanvas.hpp" - -using namespace Dawn; - -void Dawn::helloWorldScene(Scene &s) { - // while(!s.getGame()->assetManager.isLoaded(font)) { - // s.getGame()->assetManager.update(); - // } - - auto cameraItem = s.createSceneItem(); - auto camera = cameraItem->addComponent(); - cameraItem->lookAt({ 3, 3, 3 }, { 0, 0, 0 }, { 0, 1, 0 }); - camera->clipFar = 99999.99f; - - glm::vec2 position = { 0, 0 }; - glm::vec2 size = { 1, 1 }; - auto quad = s.createSceneItem(); - auto quadMesh = std::make_shared(); - quadMesh->createBuffers(QUAD_VERTICE_COUNT, QUAD_INDICE_COUNT); - QuadMesh::buffer( - quadMesh, - glm::vec4(position.x, position.y, size.x, size.y), - glm::vec4(0, 0, 1, 1), - 0, 0, 0 - ); - - auto quadRenderer = quad->addComponent(); - quadRenderer->mesh = quadMesh; - - auto quadMaterial = quad->addComponent(); - quadMaterial->setColor(COLOR_WHITE); - - auto uiCanvasItem = s.createSceneItem(); - auto uiCanvas = uiCanvasItem->addComponent(); -} \ No newline at end of file diff --git a/src/dawntruetype/asset/AssetManagerTrueType.cpp b/src/dawntruetype/asset/AssetManagerTrueType.cpp index 797c93aa..dadb814d 100644 --- a/src/dawntruetype/asset/AssetManagerTrueType.cpp +++ b/src/dawntruetype/asset/AssetManagerTrueType.cpp @@ -3,7 +3,7 @@ // This software is released under the MIT License. // https://opensource.org/licenses/MIT -#include "AssetManager.hpp" +#include "asset/AssetManager.hpp" #include "loaders/TrueTypeLoader.hpp" template<> diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 08014a7c..00eab013 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -3,18 +3,6 @@ # This software is released under the MIT License. # https://opensource.org/licenses/MIT -# Tool Level Values -set( - DAWN_TOOL_INCLUDES - ${CMAKE_CURRENT_LIST_DIR} - CACHE INTERNAL ${DAWN_CACHE_TARGET} -) - -set( - DAWN_TOOL_GENERATED_DEPENDENCIES - CACHE INTERNAL ${DAWN_CACHE_TARGET} -) - # Tools add_subdirectory(assetstool) add_subdirectory(copytool)