Did some tweaks to the CMakeLists
This commit is contained in:
@ -3,21 +3,32 @@
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Add Sources
|
||||
file(GLOB_RECURSE SRCS ${CMAKE_CURRENT_SOURCE_DIR}/*.c)
|
||||
add_library(game STATIC ${SRCS})
|
||||
target_include_directories(game PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_link_libraries(game PUBLIC
|
||||
glad
|
||||
cglm
|
||||
duktape
|
||||
stb
|
||||
# Definitions
|
||||
|
||||
# Libraries
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
glad
|
||||
cglm
|
||||
stb
|
||||
duktape
|
||||
)
|
||||
|
||||
# Set up flags
|
||||
add_compile_definitions(
|
||||
SETTING_PLATFORM_GLFW=1
|
||||
SETTING_PLATFORM=1
|
||||
SETTING_PLATFORM_USE_GLAD=1
|
||||
SETTING_ASSET_PREFIX="../../../assets/"
|
||||
# Sources
|
||||
file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.c)
|
||||
file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.h)
|
||||
|
||||
list(FILTER SOURCES EXCLUDE REGEX ".*game\\/.*")
|
||||
list(FILTER HEADERS EXCLUDE REGEX ".*game\\/.*")
|
||||
|
||||
target_sources(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
${SOURCES}
|
||||
${HEADERS}
|
||||
)
|
||||
|
||||
# Includes
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
)
|
12
src/engine/client.c
Normal file
12
src/engine/client.c
Normal file
@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "client.h"
|
||||
|
||||
void clientInit(client_t *client) {
|
||||
client->setTitle = NULL;
|
||||
}
|
23
src/engine/client.h
Normal file
23
src/engine/client.h
Normal file
@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../libs.h"
|
||||
|
||||
/** Callback to set the window title */
|
||||
typedef void clientsettitle_t(char *string);
|
||||
|
||||
typedef struct {
|
||||
clientsettitle_t *setTitle;
|
||||
} client_t;
|
||||
|
||||
/**
|
||||
* Initialize the client to its default state.
|
||||
*
|
||||
* @param client Client to initialize.
|
||||
*/
|
||||
void clientInit(client_t *client);
|
@ -9,9 +9,8 @@
|
||||
|
||||
void engineInit(engine_t *engine) {
|
||||
randSeed(123);
|
||||
|
||||
engine->name = SETTING_GAME_NAME;
|
||||
|
||||
engine->name = GAME_NAME;
|
||||
clientInit(&engine->client);
|
||||
epochInit(&engine->time);
|
||||
renderInit();
|
||||
inputInit(&engine->input);
|
||||
|
@ -7,11 +7,16 @@
|
||||
|
||||
#pragma once
|
||||
#include "../libs.h"
|
||||
#include "client.h"
|
||||
#include "../util/rand.h"
|
||||
#include "../input/input.h"
|
||||
#include "../epoch/epoch.h"
|
||||
#include "../display/render.h"
|
||||
|
||||
// #if !defined(GAME_NAME)
|
||||
// #error You need to define the GAME_NAME string
|
||||
// #endif
|
||||
|
||||
typedef struct {
|
||||
/** Name of the game */
|
||||
char *name;
|
||||
@ -24,6 +29,9 @@ typedef struct {
|
||||
|
||||
/** Input Manager for the game */
|
||||
input_t input;
|
||||
|
||||
/** Game client information */
|
||||
client_t client;
|
||||
} engine_t;
|
||||
|
||||
/**
|
||||
|
@ -169,6 +169,7 @@ int32_t xmlLoadChild(xml_t *xml, char *data, int32_t i) {
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
return i;
|
||||
}
|
||||
|
||||
void xmlLoad(xml_t *xml, char *data) {
|
||||
|
Reference in New Issue
Block a user