A bit more code cleanup

This commit is contained in:
YourWishes committed 2021-11-22 20:25:45 -08:00
1 parent a4198e8396
commit 6c9eb8b685
217 files changed
+188 -166

No files matched your search

+8 -79
View File
@@ -40,13 +40,17 @@ set(TEMP_DIR "${BUILD_DIR}/temp")
# Include tools # Include tools
add_subdirectory(tools) add_subdirectory(tools)
# Now change sources depending on the target type # Include the client or the test tools
if(TARGET_TYPE STREQUAL test) if(TARGET_TYPE STREQUAL test)
add_subdirectory(test) add_subdirectory(test)
elseif(TARGET_TYPE STREQUAL game) elseif(TARGET_TYPE STREQUAL game)
# Set up shared assets add_subdirectory(client)
endif()
# Shaders # Add global sources.
add_subdirectory(lib)
# Set up shared assets
tool_copy(shader_textured tool_copy(shader_textured
${ASSETS_SOURCE_DIR}/shared/shaders/textured.vert shaders/textured.vert ${ASSETS_SOURCE_DIR}/shared/shaders/textured.vert shaders/textured.vert
${ASSETS_SOURCE_DIR}/shared/shaders/textured.frag shaders/textured.frag ${ASSETS_SOURCE_DIR}/shared/shaders/textured.frag shaders/textured.frag
@@ -56,93 +60,18 @@ elseif(TARGET_TYPE STREQUAL game)
${ASSETS_SOURCE_DIR}/shared/shaders/singlerenderlist.frag shaders/singlerenderlist.frag ${ASSETS_SOURCE_DIR}/shared/shaders/singlerenderlist.frag shaders/singlerenderlist.frag
) )
# Fonts
tool_copy(font_opensans tool_copy(font_opensans
${ASSETS_SOURCE_DIR}/shared/fonts/opensans/OpenSans-Regular.ttf fonts/opensans/OpenSans-Regular.ttf ${ASSETS_SOURCE_DIR}/shared/fonts/opensans/OpenSans-Regular.ttf fonts/opensans/OpenSans-Regular.ttf
${ASSETS_SOURCE_DIR}/shared/fonts/opensans/OpenSans-Bold.ttf fonts/opensans/OpenSans-Bold.ttf ${ASSETS_SOURCE_DIR}/shared/fonts/opensans/OpenSans-Bold.ttf fonts/opensans/OpenSans-Bold.ttf
) )
# Textures
tool_texture(texture_test tool_texture(texture_test
${ASSETS_SOURCE_DIR}/shared/textures/test_texture.png textures/test_texture ${ASSETS_SOURCE_DIR}/shared/textures/test_texture.png textures/test_texture
) )
# Locales
tool_copy(locale_en tool_copy(locale_en
${ASSETS_SOURCE_DIR}/locale/language/en-US.csv locale/language/en-US.csv ${ASSETS_SOURCE_DIR}/locale/language/en-US.csv locale/language/en-US.csv
) )
# Poker Game # Add actual game sources
if(TARGET_GAME STREQUAL poker)
add_compile_definitions(
GAME_NAME="Penny's Poker"
GAME_FILE="poker/game.h"
GAME_TYPE=pokergame_t
GAME_INIT=pokerGameInit
GAME_UPDATE=pokerGameUpdate
GAME_DISPOSE=pokerGameDispose
GAME_VERSION=1.0
)
# Characters
set(DIR_CHARS "${ASSETS_SOURCE_DIR}/poker/characters")
tool_vn_character(vn_penny
${DIR_CHARS}/penny/character.xml poker/characters/penny/sprite
)
tool_vn_character(vn_lucy
${DIR_CHARS}/lucy/character.xml poker/characters/lucy/sprite
)
tool_vn_character(vn_julie
${DIR_CHARS}/julie/character.xml poker/characters/julie/sprite
)
tool_vn_character(vn_sammy
${DIR_CHARS}/sammy/character.xml poker/characters/sammy/sprite
)
tool_vn_character(vn_jenny
${DIR_CHARS}/jenny/character.xml poker/characters/jenny/sprite
)
# World
tool_texture(texture_pub
${ASSETS_SOURCE_DIR}/poker/world/pub/pub_skywall.png poker/world/pub
)
tool_assets(
shader_textured
shader_singlerenderlist
font_opensans
texture_test
texture_pub
vn_penny
vn_lucy
vn_julie
vn_sammy
vn_jenny
locale_en
)
elseif(TARGET_GAME STREQUAL sandbox)
add_compile_definitions(
GAME_NAME="Sandbox"
GAME_VERSION=1.0
)
tool_assets(
shader_textured
font_opensans
texture_test
)
endif()
# Common Game Dependencies.
add_dependencies(${PROJECT_NAME} assets )
add_subdirectory(client)
endif()
# Add global sources.
add_subdirectory(lib)
add_subdirectory(src) add_subdirectory(src)
+4 -4
View File
@@ -6,10 +6,10 @@
#pragma once #pragma once
#include <glad/glad.h> #include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <dawn/libs.h> #include "libs.h"
#include <dawn/display/render.h> #include "display/render.h"
#include <dawn/input/input.h> #include "input/input.h"
#include <dawninit.h> #include "game/game.h"
#define WINDOW_WIDTH_DEFAULT 1280 #define WINDOW_WIDTH_DEFAULT 1280
#define WINDOW_HEIGHT_DEFAULT WINDOW_WIDTH_DEFAULT/16*9 #define WINDOW_HEIGHT_DEFAULT WINDOW_WIDTH_DEFAULT/16*9
+9 -10
View File
@@ -18,19 +18,18 @@ target_include_directories(${PROJECT_NAME}
) )
# Dawn Sources # Dawn Sources
file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/dawn/*.c(pp|xx)) file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.c(pp|xx))
file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/dawn/*.h(pp|xx)) file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.h(pp|xx))
# Exclude Game Sources
list(FILTER SOURCES EXCLUDE REGEX ".*games\\/.*")
list(FILTER HEADERS EXCLUDE REGEX ".*games\\/.*")
target_sources(${PROJECT_NAME} target_sources(${PROJECT_NAME}
PRIVATE PRIVATE
${SOURCES} ${SOURCES}
${HEADERS} ${HEADERS}
) )
# Sandbox Game Sources # Add Game Sources
file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/sandbox/*.c(pp|xx)) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/games/${TARGET_GAME})
file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/sandbox/*.h(pp|xx))
target_sources(${PROJECT_NAME}
PRIVATE
${SOURCES}
${HEADERS}
)
-32
View File
@@ -1,32 +0,0 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "loadingscene.h"
void loadingSceneInit(
loadingscene_t *scene,
assetmanager_t *assetManager
) {
scene->manager = assetManager;
}
void loadingSceneStart(loadingscene_t *scene) {
assetManagerStart(scene->manager);
}
bool loadingSceneUpdate(loadingscene_t *scene) {
assetManagerUpdate(scene->manager);
return scene->manager->finished;
}
void loadingSceneRender(loadingscene_t *scene) {
}
void loadingSceneDispose(loadingscene_t *scene) {
}
-26
View File
@@ -1,26 +0,0 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "../file/assetmanager.h"
typedef struct {
assetmanager_t *manager;
} loadingscene_t;
void loadingSceneInit(
loadingscene_t *scene,
assetmanager_t *assetManager
);
void loadingSceneStart(loadingscene_t *scene);
bool loadingSceneUpdate(loadingscene_t *scene);
void loadingSceneRender(loadingscene_t *scene);
void loadingSceneDispose(loadingscene_t *scene);
-9
View File
@@ -1,9 +0,0 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include <sandbox/game.h>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -6,7 +6,7 @@
*/ */
#pragma once #pragma once
#include <dawn/libs.h> #include "../libs.h"
#include "matrix.h" #include "matrix.h"
#include "camera.h" #include "camera.h"
#include "texture.h" #include "texture.h"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+62
View File
@@ -0,0 +1,62 @@
# Copyright (c) 2021 Dominic Msters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
tool_game(
"Penny's Poker"
1.0
)
file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.c(pp|xx))
file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.h(pp|xx))
target_sources(${PROJECT_NAME}
PRIVATE
${SOURCES}
${HEADERS}
)
# Characters
set(DIR_CHARS "${ASSETS_SOURCE_DIR}/poker/characters")
tool_vn_character(vn_penny
${DIR_CHARS}/penny/character.xml poker/characters/penny/sprite
)
tool_vn_character(vn_lucy
${DIR_CHARS}/lucy/character.xml poker/characters/lucy/sprite
)
tool_vn_character(vn_julie
${DIR_CHARS}/julie/character.xml poker/characters/julie/sprite
)
tool_vn_character(vn_sammy
${DIR_CHARS}/sammy/character.xml poker/characters/sammy/sprite
)
tool_vn_character(vn_jenny
${DIR_CHARS}/jenny/character.xml poker/characters/jenny/sprite
)
# World
tool_texture(texture_pub
${ASSETS_SOURCE_DIR}/poker/world/pub/pub_skywall.png poker/world/pub
)
# Generate assets
tool_assets(
shader_textured
shader_singlerenderlist
font_opensans
texture_test
texture_pub
vn_penny
vn_lucy
vn_julie
vn_sammy
vn_jenny
locale_en
)
# Add Assets
add_dependencies(${PROJECT_NAME} assets)
File renamed without changes.
+37
View File
@@ -0,0 +1,37 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "../../libs.h"
#include "../../engine/engine.h"
typedef struct {
engine_t engine;
} game_t;
/**
* Initializes the Dawn Game instance.
*
* @param game Game to instanciate.
* @return True if successful otherwise false.
*/
bool gameInit(game_t *game);
/**
* Update the Dawn Game Instance.
*
* @param game Game to update.
* @param delta The delta of the game to tick by.
*/
bool gameUpdate(game_t *game, float delta);
/**
* Cleanup the dawn game instance.
*
* @param game Game to dispose.
*/
void gameDispose(game_t *game);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 217 files, more files were not shown because too many files have changed in this diff. Show more