Extracted all parts of all characters
This commit is contained in:
@ -28,8 +28,9 @@ project(${TARGET_NAME} VERSION 1.0)
|
||||
add_executable(${PROJECT_NAME})
|
||||
|
||||
# Variables
|
||||
SET(ROOT_DIR "${CMAKE_SOURCE_DIR}")
|
||||
set(ROOT_DIR "${CMAKE_SOURCE_DIR}")
|
||||
set(TOOLS_DIR "${ROOT_DIR}/tools")
|
||||
set(ASSETS_DIR "assets")
|
||||
|
||||
# Include tools
|
||||
add_subdirectory(tools)
|
||||
@ -48,13 +49,31 @@ elseif(TARGET_TYPE STREQUAL game)
|
||||
GAME_DISPOSE=pokerGameDispose
|
||||
GAME_VERSION=1.0
|
||||
)
|
||||
|
||||
set(DIR_CHARS poker/characters)
|
||||
tool_vn_character(penny
|
||||
${DIR_CHARS}/penny/character.xml ${DIR_CHARS}/penny.png
|
||||
)
|
||||
tool_vn_character(lucy
|
||||
${DIR_CHARS}/lucy/character.xml ${DIR_CHARS}/lucy.png
|
||||
)
|
||||
tool_vn_character(jenny
|
||||
${DIR_CHARS}/jenny/character.xml ${DIR_CHARS}/jenny.png
|
||||
)
|
||||
tool_vn_character(sammy
|
||||
${DIR_CHARS}/sammy/character.xml ${DIR_CHARS}/sammy.png
|
||||
)
|
||||
|
||||
set(DIR_CHARS assets/poker/characters/penny)
|
||||
|
||||
tool_vn_character(penny ${DIR_CHARS}/character.xml ${DIR_CHARS}/bruh.png)
|
||||
|
||||
add_dependencies(${PROJECT_NAME} penny)
|
||||
tool_assets(
|
||||
penny
|
||||
lucy
|
||||
jenny
|
||||
sammy
|
||||
)
|
||||
endif()
|
||||
|
||||
# Common Game Dependencies.
|
||||
add_dependencies(${PROJECT_NAME} assets)
|
||||
add_subdirectory(client)
|
||||
endif()
|
||||
|
||||
|
@ -3,4 +3,5 @@
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
add_subdirectory(file)
|
||||
add_subdirectory(vn)
|
12
tools/file/CMakeLists.txt
Normal file
12
tools/file/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
||||
# Copyright (c) 2021 Dominic Msters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
function(tool_assets args)
|
||||
add_custom_target(assets
|
||||
COMMAND tar -C ./assets -cvf test.zip *
|
||||
DEPENDS ${ARGV}
|
||||
COMMENT "Compressing Assets"
|
||||
)
|
||||
endfunction()
|
@ -3,10 +3,9 @@
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
|
||||
function(tool_vn_character DEP_NAME IN OUT)
|
||||
add_custom_target(${DEP_NAME}
|
||||
COMMAND node ${TOOLS_DIR}/vn/character-sheet-generator.js --root="${ROOT_DIR}" --in="${ROOT_DIR}/${IN}" --out="${OUT}"
|
||||
COMMAND node ${TOOLS_DIR}/vn/character-sheet-generator.js --assets="${ASSETS_DIR}" --root="${ROOT_DIR}" --in="${IN}" --out="${OUT}"
|
||||
COMMENT "Adding VN Character ${FILE_NAME}"
|
||||
)
|
||||
endfunction()
|
@ -7,6 +7,7 @@ const { mkdirp } = require('../utils/file');
|
||||
|
||||
// Parse Args
|
||||
if(!args.root) throw new Error(`Missing root argument`);
|
||||
if(!args.assets) throw new Error(`Missing assets argument`);
|
||||
if(!args.in) throw new Error(`Missing in argument`);
|
||||
if(!args.out) throw new Error(`Missing out argument`);
|
||||
if(!args.in.endsWith('xml')) throw new Error(`Invalid in XML`);
|
||||
@ -14,9 +15,9 @@ if(!args.out.endsWith('png')) throw new Error(`Invalid out PNG`);
|
||||
|
||||
// Determine in and out.
|
||||
const root = path.resolve(args.root);
|
||||
const file = path.resolve(args.in);
|
||||
const file = path.resolve(args.root, args.assets, args.in);
|
||||
if(!fs.existsSync(file)) throw new Error(`Could not find ${file}`);
|
||||
const outFile = path.resolve(args.out);
|
||||
const outFile = path.resolve(args.assets, args.out);
|
||||
if(fs.existsSync(outFile)) return;
|
||||
|
||||
// Load XML
|
||||
@ -25,7 +26,7 @@ const [ character ] = data.elements;
|
||||
|
||||
// Validate file.
|
||||
if(!character.attributes.context) throw new Error(`Missing context`)
|
||||
const dir = path.resolve(root, 'assets', character.attributes.context);
|
||||
const dir = path.resolve(root, args.assets, character.attributes.context);
|
||||
|
||||
// Parse base and layers
|
||||
const base = character.elements.find(e => e.name == 'base').attributes;
|
||||
|
Reference in New Issue
Block a user