diff --git a/src/dawn/CMakeLists.txt b/src/dawn/CMakeLists.txt index ca965749..5f90aa66 100644 --- a/src/dawn/CMakeLists.txt +++ b/src/dawn/CMakeLists.txt @@ -43,7 +43,4 @@ target_compile_definitions(${DAWN_TARGET_NAME} PUBLIC ${DAWN_SHARED_DEFINITIONS} DAWN_DEBUG_BUILD=${DAWN_DEBUG_BUILD} -) - -# Common Prefabs -tool_prefab("prefabs/ui/debug/FPSLabel.xml") \ No newline at end of file +) \ No newline at end of file diff --git a/src/dawn/display/Tileset.cpp b/src/dawn/display/Tileset.cpp index e24f3d37..a9cc605f 100644 --- a/src/dawn/display/Tileset.cpp +++ b/src/dawn/display/Tileset.cpp @@ -18,6 +18,33 @@ TilesetGrid::TilesetGrid() { } + +TilesetGrid::TilesetGrid( + Texture *texture, + int32_t columns, + int32_t rows +) : TilesetGrid( + columns, rows, + texture->getWidth(), texture->getHeight(), + 0, 0, + 0, 0 +) { + +} + +TilesetGrid::TilesetGrid( + Texture &texture, + int32_t columns, + int32_t rows +) : TilesetGrid( + columns, rows, + texture.getWidth(), texture.getHeight(), + 0, 0, + 0, 0 +) { + +} + TilesetGrid::TilesetGrid( int32_t columns, int32_t rows, diff --git a/src/dawn/display/Tileset.hpp b/src/dawn/display/Tileset.hpp index 4ffb33aa..34e69946 100644 --- a/src/dawn/display/Tileset.hpp +++ b/src/dawn/display/Tileset.hpp @@ -6,6 +6,7 @@ #pragma once #include "dawnlibs.hpp" #include "assert/assert.hpp" +#include "display/Texture.hpp" namespace Dawn { struct Tile { @@ -53,6 +54,24 @@ namespace Dawn { * Constructs a new Tileset Grid. */ TilesetGrid(); + + /** + * Constructs a new Tileset Grid from a texture. + * + * @param texture Texture to use. + * @param columns Columns in the grid. + * @param rows Rows in the grid. + */ + TilesetGrid(Texture *texture, int32_t columns, int32_t rows); + + /** + * Constructs a new Tileset Grid from a texture. + * + * @param texture Texture to use. + * @param columns Columns in the grid. + * @param rows Rows in the grid. + */ + TilesetGrid(Texture &texture, int32_t columns, int32_t rows); /** * Constructs a new Tileset Grid. diff --git a/src/dawnliminal/CMakeLists.txt b/src/dawnliminal/CMakeLists.txt index 8efb7dbe..704d7567 100644 --- a/src/dawnliminal/CMakeLists.txt +++ b/src/dawnliminal/CMakeLists.txt @@ -17,39 +17,5 @@ add_subdirectory(game) add_subdirectory(save) # Assets -set(LIMINAL_ASSETS_DIR ${DAWN_ASSETS_DIR}/games/liminal) - -set(LIMINIAL_CHARACTER_SCALE 0.2) -tool_texture(texture_eth_faces_day - FILE="${LIMINAL_ASSETS_DIR}/textures/eth/faces_day.png" - SCALE=${LIMINIAL_CHARACTER_SCALE} -) -tool_texture(texture_eth_faces_night - FILE="${LIMINAL_ASSETS_DIR}/textures/eth/faces_night.png" - SCALE=${LIMINIAL_CHARACTER_SCALE} -) -tool_texture(texture_eth_poses_day - FILE="${LIMINAL_ASSETS_DIR}/textures/eth/poses_day.png" - SCALE=${LIMINIAL_CHARACTER_SCALE} -) -tool_texture(texture_eth_poses_night - FILE="${LIMINAL_ASSETS_DIR}/textures/eth/test.png" - SCALE=${LIMINIAL_CHARACTER_SCALE} -) - - -tool_texture(texture_border - FILE=${LIMINAL_ASSETS_DIR}/textures/texture_test.png -) -tool_truetype(font_main - REGULAR=${LIMINAL_ASSETS_DIR}/fonts/Ysabeau-Medium.ttf - BOLD=${LIMINAL_ASSETS_DIR}/fonts/Ysabeau-SemiBold.ttf - ITALICS=${LIMINAL_ASSETS_DIR}/fonts/Ysabeau-MediumItalic.ttf - BOLD_ITALICS=${LIMINAL_ASSETS_DIR}/fonts/Ysabeau-SemiBoldItalic.ttf -) - -tool_scene(${LIMINAL_ASSETS_DIR}/scenes/SceneBase.xml) -tool_vnscene(${LIMINAL_ASSETS_DIR}/scenes/Scene1Prologue0.xml) - -tool_prefab(${LIMINAL_ASSETS_DIR}/prefabs/EthPrefab.xml) -tool_prefab(${LIMINAL_ASSETS_DIR}/prefabs/VNTextbox.xml) \ No newline at end of file +set(LIMINAL_ASSETS_DIR ) +include("${DAWN_ASSETS_SOURCE_DIR}/games/liminal/CMakeLists.txt") \ No newline at end of file diff --git a/src/dawnopengl/scene/components/display/material/SimpleTexturedMaterial.cpp b/src/dawnopengl/scene/components/display/material/SimpleTexturedMaterial.cpp index 12dc52a1..801eeaa6 100644 --- a/src/dawnopengl/scene/components/display/material/SimpleTexturedMaterial.cpp +++ b/src/dawnopengl/scene/components/display/material/SimpleTexturedMaterial.cpp @@ -37,8 +37,8 @@ std::vector SimpleTexturedMaterial::getRenderPasses(IRend onlyPass.parameterBuffers[shader->bufferRenderPipeline] = &context.renderPipeline->shaderBuffer; onlyPass.renderFlags = ( - RENDER_MANAGER_RENDER_FLAG_BLEND | - RENDER_MANAGER_RENDER_FLAG_DEPTH_TEST + RENDER_MANAGER_RENDER_FLAG_BLEND + // RENDER_MANAGER_RENDER_FLAG_DEPTH_TEST ); if(this->texture != nullptr) { diff --git a/src/dawnshared/util/Xml.cpp b/src/dawnshared/util/Xml.cpp index cb5fa183..22d1dcc7 100644 --- a/src/dawnshared/util/Xml.cpp +++ b/src/dawnshared/util/Xml.cpp @@ -201,10 +201,17 @@ void Xml::load(Xml *xml, std::string data, size_t *j) { buffer += '\''; } else if(sc == "quot") { buffer += '"'; + } else if(sc == "nbsp") { + buffer += ' '; } else { - // Unknown special char? - std::cout << "Unknown Special character: " << sc << std::endl; - assertUnreachable(); + // Try parse as integer + if(sc.size() > 1 && sc[0] == '#') { + int code = std::stoi(sc.substr(1)); + buffer += (char)code; + } else { + std::cout << "Unknown Special character: " << sc << std::endl; + assertUnreachable(); + } } } else { buffer += c; diff --git a/src/dawntools/prefabtool/CMakeLists.txt b/src/dawntools/prefabtool/CMakeLists.txt index b1a0b818..b8115af4 100644 --- a/src/dawntools/prefabtool/CMakeLists.txt +++ b/src/dawntools/prefabtool/CMakeLists.txt @@ -48,7 +48,7 @@ function(tool_prefab in) STRING(REGEX REPLACE "[\.|\\|\/]" "-" prefab_name ${in}) add_custom_target(prefab_${prefab_name} - COMMAND prefabtool --input="${DAWN_ASSETS_SOURCE_DIR}/${in}" --output="${DAWN_GENERATED_DIR}/generatedprefabs" --sources="${DAWN_SOURCES_DIR}" + COMMAND prefabtool --input="${in}" --output="${DAWN_GENERATED_DIR}/generatedprefabs" --sources="${DAWN_SOURCES_DIR}" COMMENT "Generating prefab from ${in}" DEPENDS ${DEPS} ) diff --git a/src/dawntools/scenetool/CMakeLists.txt b/src/dawntools/scenetool/CMakeLists.txt index 8ae02b56..93cb94d7 100644 --- a/src/dawntools/scenetool/CMakeLists.txt +++ b/src/dawntools/scenetool/CMakeLists.txt @@ -49,7 +49,7 @@ function(tool_scene in) STRING(REGEX REPLACE "[\.|\\|\/]" "-" scene_name ${in}) add_custom_target(scene_${scene_name} - COMMAND scenetool --input="${DAWN_ASSETS_SOURCE_DIR}/${in}" --output="${DAWN_GENERATED_DIR}/generatedscenes" --sources="${DAWN_SOURCES_DIR}" + COMMAND scenetool --input="${in}" --output="${DAWN_GENERATED_DIR}/generatedscenes" --sources="${DAWN_SOURCES_DIR}" COMMENT "Generating scene from ${in}" DEPENDS ${DEPS} ) diff --git a/src/dawntools/texturetool/CMakeLists.txt b/src/dawntools/texturetool/CMakeLists.txt index 8c57f20e..4a598fa0 100644 --- a/src/dawntools/texturetool/CMakeLists.txt +++ b/src/dawntools/texturetool/CMakeLists.txt @@ -68,7 +68,7 @@ function(tool_texture target) add_custom_target(${target} COMMAND texturetool - --input="${DAWN_ASSETS_SOURCE_DIR}/${FILE}" + --input="${FILE}" --output="${DAWN_ASSETS_BUILD_DIR}/${target}" --wrapX="${WRAP_X}" --wrapY="${WRAP_Y}" diff --git a/src/dawntools/truetypetool/CMakeLists.txt b/src/dawntools/truetypetool/CMakeLists.txt index 960d3257..4a3bda50 100644 --- a/src/dawntools/truetypetool/CMakeLists.txt +++ b/src/dawntools/truetypetool/CMakeLists.txt @@ -53,19 +53,6 @@ function(tool_truetype target) set(DEPS truetypetool) endif() - if(DEFINED REGULAR) - set(REGULAR "${DAWN_ASSETS_SOURCE_DIR}/${REGULAR}") - endif() - if(DEFINED BOLD) - set(BOLD "${DAWN_ASSETS_SOURCE_DIR}/${BOLD}") - endif() - if(DEFINED ITALICS) - set(ITALICS "${DAWN_ASSETS_SOURCE_DIR}/${ITALICS}") - endif() - if(DEFINED BOLD_ITALICS) - set(BOLD_ITALICS "${DAWN_ASSETS_SOURCE_DIR}/${BOLD_ITALICS}") - endif() - add_custom_target(${target} COMMAND truetypetool --output="${DAWN_ASSETS_BUILD_DIR}/${target}.truetype" diff --git a/src/dawntools/util/generator/SceneAssetGenerator.cpp b/src/dawntools/util/generator/SceneAssetGenerator.cpp index f8b47005..35d40d5b 100644 --- a/src/dawntools/util/generator/SceneAssetGenerator.cpp +++ b/src/dawntools/util/generator/SceneAssetGenerator.cpp @@ -10,6 +10,7 @@ using namespace Dawn; void SceneAssetGenerator::generate( std::map &assetMap, int32_t &assetNumber, + std::vector *publicProperties, std::vector *initBody, std::vector *assetsBody, struct SceneAsset *asset, @@ -17,6 +18,7 @@ void SceneAssetGenerator::generate( ) { std::string assetType = ""; + bool_t componentInit = true; if(asset->ref.empty()) { asset->usageName = "asset" + std::to_string(assetNumber++); } else { @@ -40,6 +42,12 @@ void SceneAssetGenerator::generate( assertUnreachable(); } - line(initBody, "auto " + asset->usageName + " = man->get<" + assetType + ">(\"" + asset->fileName + "\");", ""); + if(!asset->ref.empty()) { + line(publicProperties, assetType + " *" + asset->usageName + " = nullptr;", ""); + line(initBody, asset->usageName + " = man->get<" + assetType + ">(\"" + asset->fileName + "\");", ""); + } else { + line(initBody, "auto " + asset->usageName + " = man->get<" + assetType + ">(\"" + asset->fileName + "\");", ""); + } + line(assetsBody, "assets.push_back(man->get<" + assetType + ">(\"" + asset->fileName + "\"));", ""); } \ No newline at end of file diff --git a/src/dawntools/util/generator/SceneAssetGenerator.hpp b/src/dawntools/util/generator/SceneAssetGenerator.hpp index 08eeb394..dbae2b27 100644 --- a/src/dawntools/util/generator/SceneAssetGenerator.hpp +++ b/src/dawntools/util/generator/SceneAssetGenerator.hpp @@ -13,6 +13,7 @@ namespace Dawn { static void generate( std::map &assetMap, int32_t &assetNumber, + std::vector *publicProperties, std::vector *initBody, std::vector *assetsBody, struct SceneAsset *asset, diff --git a/src/dawntools/util/generator/SceneItemGenerator.cpp b/src/dawntools/util/generator/SceneItemGenerator.cpp index 2679e5f6..54dce3fb 100644 --- a/src/dawntools/util/generator/SceneItemGenerator.cpp +++ b/src/dawntools/util/generator/SceneItemGenerator.cpp @@ -149,6 +149,7 @@ void SceneItemGenerator::generate( SceneAssetGenerator::generate( assetMap, assetNumber, + publicProperties, initBody, assetBody, &(*itAssets), diff --git a/src/dawntools/vnscenetool/CMakeLists.txt b/src/dawntools/vnscenetool/CMakeLists.txt index c0c43fe3..bf779c19 100644 --- a/src/dawntools/vnscenetool/CMakeLists.txt +++ b/src/dawntools/vnscenetool/CMakeLists.txt @@ -52,7 +52,7 @@ function(tool_vnscene in) STRING(REGEX REPLACE "[\.|\\|\/]" "-" scene_name ${in}) add_custom_target(scene_${scene_name} - COMMAND vnscenetool --input="${DAWN_ASSETS_SOURCE_DIR}/${in}" --output="${DAWN_GENERATED_DIR}/generatedscenes" + COMMAND vnscenetool --input="${in}" --output="${DAWN_GENERATED_DIR}/generatedscenes" COMMENT "Generating vnscene from ${in}" DEPENDS ${DEPS} )