Subdirize assets, add TSX support
This commit is contained in:
@@ -21,7 +21,7 @@ void uiConsoleRender(void) {
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
uiTextDraw(0, i * TILESET_FONT_MINOGRAM.tileHeight, line, COLOR_WHITE);
|
||||
uiTextDraw(0, i * TILESET_MINOGRAM.tileHeight, line, COLOR_WHITE);
|
||||
i--;
|
||||
} while(i > 0);
|
||||
}
|
@@ -17,7 +17,7 @@ errorret_t uiTextInit(void) {
|
||||
memoryZero(&UI_TEXT, sizeof(uitext_t));
|
||||
|
||||
errorChain(assetManagerLoadAsset(
|
||||
TILESET_FONT_MINOGRAM.image, &UI_TEXT.asset, &UI_TEXT.assetRef
|
||||
TILESET_MINOGRAM.image, &UI_TEXT.asset, &UI_TEXT.assetRef
|
||||
));
|
||||
errorOk();
|
||||
}
|
||||
@@ -35,23 +35,23 @@ void uiTextDrawChar(
|
||||
const color_t color
|
||||
) {
|
||||
int32_t tileIndex = (int32_t)(c) - UI_TEXT_CHAR_START;
|
||||
if(tileIndex < 0 || tileIndex >= TILESET_FONT_MINOGRAM.tileCount) {
|
||||
if(tileIndex < 0 || tileIndex >= TILESET_MINOGRAM.tileCount) {
|
||||
tileIndex = ((int32_t)'@') - UI_TEXT_CHAR_START;
|
||||
}
|
||||
|
||||
assertTrue(
|
||||
tileIndex >= 0 && tileIndex <= TILESET_FONT_MINOGRAM.tileCount,
|
||||
tileIndex >= 0 && tileIndex <= TILESET_MINOGRAM.tileCount,
|
||||
"Character is out of bounds for font tiles"
|
||||
);
|
||||
|
||||
vec4 uv;
|
||||
tilesetTileGetUV(&TILESET_FONT_MINOGRAM, tileIndex, uv);
|
||||
tilesetTileGetUV(&TILESET_MINOGRAM, tileIndex, uv);
|
||||
|
||||
spriteBatchPush(
|
||||
&UI_TEXT.asset->alphaImage.texture,
|
||||
x, y,
|
||||
x + TILESET_FONT_MINOGRAM.tileWidth,
|
||||
y + TILESET_FONT_MINOGRAM.tileHeight,
|
||||
x + TILESET_MINOGRAM.tileWidth,
|
||||
y + TILESET_MINOGRAM.tileHeight,
|
||||
color,
|
||||
uv[0], uv[1], uv[2], uv[3]
|
||||
);
|
||||
@@ -73,17 +73,17 @@ void uiTextDraw(
|
||||
while((c = text[i++]) != '\0') {
|
||||
if(c == '\n') {
|
||||
posX = x;
|
||||
posY += TILESET_FONT_MINOGRAM.tileHeight;
|
||||
posY += TILESET_MINOGRAM.tileHeight;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(c == ' ') {
|
||||
posX += TILESET_FONT_MINOGRAM.tileWidth;
|
||||
posX += TILESET_MINOGRAM.tileWidth;
|
||||
continue;
|
||||
}
|
||||
|
||||
uiTextDrawChar(posX, posY, c, color);
|
||||
posX += TILESET_FONT_MINOGRAM.tileWidth;
|
||||
posX += TILESET_MINOGRAM.tileWidth;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ void uiTextMeasure(
|
||||
assertNotNull(outHeight, "Output height pointer cannot be NULL");
|
||||
|
||||
int32_t width = 0;
|
||||
int32_t height = TILESET_FONT_MINOGRAM.tileHeight;
|
||||
int32_t height = TILESET_MINOGRAM.tileHeight;
|
||||
int32_t lineWidth = 0;
|
||||
|
||||
char_t c;
|
||||
@@ -108,11 +108,11 @@ void uiTextMeasure(
|
||||
width = lineWidth;
|
||||
}
|
||||
lineWidth = 0;
|
||||
height += TILESET_FONT_MINOGRAM.tileHeight;
|
||||
height += TILESET_MINOGRAM.tileHeight;
|
||||
continue;
|
||||
}
|
||||
|
||||
lineWidth += TILESET_FONT_MINOGRAM.tileWidth;
|
||||
lineWidth += TILESET_MINOGRAM.tileWidth;
|
||||
}
|
||||
|
||||
if(lineWidth > width) {
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
#include "asset/assetmanager.h"
|
||||
#include "display/tileset/tileset_font_minogram.h"
|
||||
#include "display/tileset/tileset_minogram.h"
|
||||
|
||||
#define UI_TEXT_CHAR_START '!'
|
||||
|
||||
|
Reference in New Issue
Block a user