diff --git a/mods/assets/examples/ComicFansFont/fonts/game_fonts/ComicFans.meta.json b/mods/assets/examples/ComicFansFont/fonts/game_fonts/ComicFans.meta.json index 23225576..d31c2aa1 100644 --- a/mods/assets/examples/ComicFansFont/fonts/game_fonts/ComicFans.meta.json +++ b/mods/assets/examples/ComicFansFont/fonts/game_fonts/ComicFans.meta.json @@ -1,6 +1,210 @@ { "characters": { - "A": { + " ": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 0, + "v": 0 + } + }, + "!": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 8, + "v": 0 + } + }, + "\"": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 16, + "v": 0 + } + }, + "#": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 24, + "v": 0 + } + }, + "$": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 32, + "v": 0 + } + }, + "%": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 40, + "v": 0 + } + }, + "&": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 48, + "v": 0 + } + }, + "'": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 56, + "v": 0 + } + }, + "(": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 64, + "v": 0 + } + }, + ")": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 72, + "v": 0 + } + }, + "*": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 80, + "v": 0 + } + }, + "+": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 88, + "v": 0 + } + }, + ",": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 96, + "v": 0 + } + }, + "-": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 104, + "v": 0 + } + }, + ".": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 112, + "v": 0 + } + }, + "/": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 120, + "v": 0 + } + }, + "0": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 0, + "v": 8 + } + }, + "1": { "char-width": 8, "tex-index": 0, "tex-size": { @@ -11,10 +215,935 @@ "u": 8, "v": 8 } + }, + "2": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 16, + "v": 8 + } + }, + "3": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 24, + "v": 8 + } + }, + "4": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 32, + "v": 8 + } + }, + "5": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 40, + "v": 8 + } + }, + "6": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 48, + "v": 8 + } + }, + "7": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 56, + "v": 8 + } + }, + "8": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 64, + "v": 8 + } + }, + "9": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 72, + "v": 8 + } + }, + ":": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 80, + "v": 8 + } + }, + ";": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 88, + "v": 8 + } + }, + "<": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 96, + "v": 8 + } + }, + "=": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 104, + "v": 8 + } + }, + ">": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 112, + "v": 8 + } + }, + "?": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 120, + "v": 8 + } + }, + "@": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 0, + "v": 16 + } + }, + "A": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 8, + "v": 16 + } + }, + "B": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 16, + "v": 16 + } + }, + "C": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 24, + "v": 16 + } + }, + "D": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 32, + "v": 16 + } + }, + "E": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 40, + "v": 16 + } + }, + "F": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 48, + "v": 16 + } + }, + "G": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 56, + "v": 16 + } + }, + "H": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 64, + "v": 16 + } + }, + "I": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 72, + "v": 16 + } + }, + "J": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 80, + "v": 16 + } + }, + "K": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 88, + "v": 16 + } + }, + "L": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 96, + "v": 16 + } + }, + "M": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 104, + "v": 16 + } + }, + "N": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 112, + "v": 16 + } + }, + "O": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 120, + "v": 16 + } + }, + "P": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 0, + "v": 24 + } + }, + "Q": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 8, + "v": 24 + } + }, + "R": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 16, + "v": 24 + } + }, + "S": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 24, + "v": 24 + } + }, + "T": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 32, + "v": 24 + } + }, + "U": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 40, + "v": 24 + } + }, + "V": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 48, + "v": 24 + } + }, + "W": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 56, + "v": 24 + } + }, + "X": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 64, + "v": 24 + } + }, + "Y": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 72, + "v": 24 + } + }, + "Z": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 80, + "v": 24 + } + }, + "[": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 88, + "v": 24 + } + }, + "\\": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 96, + "v": 24 + } + }, + "]": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 104, + "v": 24 + } + }, + "^": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 112, + "v": 24 + } + }, + "_": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 120, + "v": 24 + } + }, + "`": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 0, + "v": 32 + } + }, + "a": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 8, + "v": 32 + } + }, + "b": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 16, + "v": 32 + } + }, + "c": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 24, + "v": 32 + } + }, + "d": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 32, + "v": 32 + } + }, + "e": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 40, + "v": 32 + } + }, + "f": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 48, + "v": 32 + } + }, + "g": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 56, + "v": 32 + } + }, + "h": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 64, + "v": 32 + } + }, + "i": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 72, + "v": 32 + } + }, + "j": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 80, + "v": 32 + } + }, + "k": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 88, + "v": 32 + } + }, + "l": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 96, + "v": 32 + } + }, + "m": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 104, + "v": 32 + } + }, + "n": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 112, + "v": 32 + } + }, + "o": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 120, + "v": 32 + } + }, + "p": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 0, + "v": 40 + } + }, + "q": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 8, + "v": 40 + } + }, + "r": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 16, + "v": 40 + } + }, + "s": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 24, + "v": 40 + } + }, + "t": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 32, + "v": 40 + } + }, + "u": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 40, + "v": 40 + } + }, + "v": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 48, + "v": 40 + } + }, + "w": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 56, + "v": 40 + } + }, + "x": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 64, + "v": 40 + } + }, + "y": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 72, + "v": 40 + } + }, + "z": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 80, + "v": 40 + } + }, + "{": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 88, + "v": 40 + } + }, + "|": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 96, + "v": 40 + } + }, + "}": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 104, + "v": 40 + } + }, + "~": { + "char-width": 8, + "tex-index": 0, + "tex-size": { + "height": 8, + "width": 8 + }, + "uv": { + "u": 112, + "v": 40 + } } }, + "fixed-width": 0, "name": "ComicFans", - "special-character-width": 3, + "special-character-width": 8, "tab-width": 32, "textures": [ "ASSET_TEX2D_COMICFANS" diff --git a/mods/assets/examples/ComicFansFont/meta.json b/mods/assets/examples/ComicFansFont/meta.json index 485e18c9..034bd83b 100644 --- a/mods/assets/examples/ComicFansFont/meta.json +++ b/mods/assets/examples/ComicFansFont/meta.json @@ -1,6 +1,5 @@ { "name": "Comic Fans Font", - "author" : "Example", - "revision": 3, - "description": "Font that was made by damieng. See: https://damieng.com/typography/zx-origins/comic-fans/" + "authors" : ["Example", "Damien Guard"], + "description": "A fun 8x8 font that was created by Damien Guard. See: https://damieng.com/typography/zx-origins/comic-fans/" } \ No newline at end of file diff --git a/mods/assets/examples/ComicFansFont/textures/2d/font/comicfans/comicfans.json b/mods/assets/examples/ComicFansFont/textures/2d/font/comicfans/comicfans.json index 34bcce5d..69e54338 100644 --- a/mods/assets/examples/ComicFansFont/textures/2d/font/comicfans/comicfans.json +++ b/mods/assets/examples/ComicFansFont/textures/2d/font/comicfans/comicfans.json @@ -1,8 +1,8 @@ { "compressed": true, "flags": { - "wrap-s": "Wrap", - "wrap-t": "Wrap" + "wrap-s": "CLAMP", + "wrap-t": "CLAMP" }, "format": "IA4", "images": [ diff --git a/mods/assets/examples/ComicFansFont/textures/2d/font/comicfans/comicfans.png b/mods/assets/examples/ComicFansFont/textures/2d/font/comicfans/comicfans.png index 323b98c1..caa743aa 100644 Binary files a/mods/assets/examples/ComicFansFont/textures/2d/font/comicfans/comicfans.png and b/mods/assets/examples/ComicFansFont/textures/2d/font/comicfans/comicfans.png differ diff --git a/tools/dkr_assets_tool_src/builder/buildTypes/buildFonts.cpp b/tools/dkr_assets_tool_src/builder/buildTypes/buildFonts.cpp index d3b40993..f1b94554 100644 --- a/tools/dkr_assets_tool_src/builder/buildTypes/buildFonts.cpp +++ b/tools/dkr_assets_tool_src/builder/buildTypes/buildFonts.cpp @@ -10,7 +10,7 @@ BuildFonts::BuildFonts(DkrAssetsSettings &settings, BuildInfo &info) : _settings // "rawDataSize" is the size of the FontData structure with the correct number of fonts. // Have to do this, since the number of fonts is dynamic. - size_t rawDataSize = FileHelper::align16(4 + numberOfFonts * sizeof(FontFile)); + size_t rawDataSize = FileHelper::align16(sizeof(be_uint32_t) + (numberOfFonts * sizeof(FontFile))); uint8_t *rawData = new uint8_t[rawDataSize]; std::memset(rawData, 0, rawDataSize); // zero out rawData bytes. @@ -56,9 +56,16 @@ BuildFonts::BuildFonts(DkrAssetsSettings &settings, BuildInfo &info) : _settings int fontTextureIndex = AssetsHelper::get_asset_index(settings, "ASSET_TEXTURES_2D", texBuildId); + DebugHelper::info(texBuildId, " = ", fontTextureIndex); + outFontFile->textureIndices[texIndex] = fontTextureIndex; } + // Fills in the rest with nulls + for(size_t texIndex = numTextures; texIndex < FONTS_NUMBER_OF_TEXTURE_INDICES; texIndex++) { + outFontFile->textureIndices[texIndex] = -1; + } + // Assume ASCII by default. std::string encodingType = fontJson->get_string("/encoding/type", "ASCII"); diff --git a/tools/dkr_assets_tool_src/builder/buildTypes/buildTexture.cpp b/tools/dkr_assets_tool_src/builder/buildTypes/buildTexture.cpp index 05d9e079..ee1220a9 100644 --- a/tools/dkr_assets_tool_src/builder/buildTypes/buildTexture.cpp +++ b/tools/dkr_assets_tool_src/builder/buildTypes/buildTexture.cpp @@ -69,6 +69,8 @@ BuildTexture::BuildTexture(DkrAssetsSettings &settings, BuildInfo &info) : _sett header->width = imgWidth; header->height = imgHeight; + // TODO: Check if width and/or height is greater than 255, and error if it is! + if(writeSize) { header->textureSize = DataHelper::align16(sizeof(TextureHeader) + ImageHelper::image_size(imgWidth, imgHeight, format)); } else { diff --git a/tools/dkr_assets_tool_src/helpers/fileHelper.cpp b/tools/dkr_assets_tool_src/helpers/fileHelper.cpp index ebb3969c..e3efeeab 100644 --- a/tools/dkr_assets_tool_src/helpers/fileHelper.cpp +++ b/tools/dkr_assets_tool_src/helpers/fileHelper.cpp @@ -305,6 +305,12 @@ fs::path FileHelper::get_directory(const fs::path &path) { return path.parent_path(); } +void FileHelper::delete_directory(const fs::path &path) { + if(fs::exists(path)) { + fs::remove_all(path); + } +} + void FileHelper::rename(const fs::path &oldPath, const fs::path &newPath) { fs::rename(oldPath, newPath); } diff --git a/tools/dkr_assets_tool_src/helpers/fileHelper.h b/tools/dkr_assets_tool_src/helpers/fileHelper.h index d21bf31a..2c75cb1b 100644 --- a/tools/dkr_assets_tool_src/helpers/fileHelper.h +++ b/tools/dkr_assets_tool_src/helpers/fileHelper.h @@ -46,6 +46,8 @@ public: static fs::path get_directory(const fs::path &path); + static void delete_directory(const fs::path &path); + static void rename(const fs::path &oldPath, const fs::path &newPath); static void copy(const fs::path &oldPath, const fs::path &newPath, bool recursive = false); diff --git a/tools/dkr_assets_tool_src/prebuild/compileAssets/compile.cpp b/tools/dkr_assets_tool_src/prebuild/compileAssets/compile.cpp index 260cec49..3ddef8df 100644 --- a/tools/dkr_assets_tool_src/prebuild/compileAssets/compile.cpp +++ b/tools/dkr_assets_tool_src/prebuild/compileAssets/compile.cpp @@ -127,8 +127,10 @@ void CompileAssets::_compile_assets() { _statFile->set_value("/last-order-size", _modOrderCount); - // First copy the vanilla path to the out path. - // This seems to be the slowest part, mainly limited by IO speed (copying thousands of small files). + // First clear the output directory (if it exists) + FileHelper::delete_directory(_outAssetsPath); + + // Copy all the vanilla files over to the output directory FileHelper::copy(_vanillaAssetsPath, _outAssetsPath, true); if(_modOrderCount == 0) {