Finally got text rendering again.

This commit is contained in:
2026-02-16 13:12:12 -06:00
parent 9c9d2d548e
commit 342ddb19f8
6 changed files with 17 additions and 5 deletions

View File

@@ -199,7 +199,7 @@ function sceneRender()
1, 1 1, 1
) )
textDraw(10, 10, "A") textDraw(10, 10, "Hello World")
-- centerX = math.floor(screenGetWidth() / 2) -- centerX = math.floor(screenGetWidth() / 2)
-- centerY = math.floor(screenGetHeight() / 2) -- centerY = math.floor(screenGetHeight() / 2)

Binary file not shown.

Binary file not shown.

View File

@@ -8,8 +8,8 @@
#pragma once #pragma once
#include "error/error.h" #include "error/error.h"
#define ASSET_TEXTURE_WIDTH_MAX 256 #define ASSET_TEXTURE_WIDTH_MAX 2048
#define ASSET_TEXTURE_HEIGHT_MAX 256 #define ASSET_TEXTURE_HEIGHT_MAX 2048
#define ASSET_TEXTURE_SIZE_MAX ( \ #define ASSET_TEXTURE_SIZE_MAX ( \
ASSET_TEXTURE_WIDTH_MAX * ASSET_TEXTURE_HEIGHT_MAX \ ASSET_TEXTURE_WIDTH_MAX * ASSET_TEXTURE_HEIGHT_MAX \
) )

View File

@@ -21,7 +21,7 @@ errorret_t textInit(void) {
} }
void textDispose(void) { void textDispose(void) {
// textureDispose(&DEFAULT_FONT_TEXTURE); textureDispose(&DEFAULT_FONT_TEXTURE);
} }
void textDrawChar( void textDrawChar(

View File

@@ -94,6 +94,9 @@
return onBadImages('Please select 2 or more image images.'); return onBadImages('Please select 2 or more image images.');
} }
// Sort images by name to ensure consistent output
images = Object.fromEntries(Object.entries(images).sort(([nameA], [nameB]) => nameA.localeCompare(nameB)));
elFileError.style.display = 'none'; elFileError.style.display = 'none';
let strInfo = `Selected ${Object.keys(images).length} images:\n`; let strInfo = `Selected ${Object.keys(images).length} images:\n`;
@@ -119,7 +122,16 @@
outputHeight = firstHeight; outputHeight = firstHeight;
outputWidth = nextPowerOfTwo(Object.values(images).reduce((sum, img) => sum + img.width, 0)); outputWidth = nextPowerOfTwo(Object.values(images).reduce((sum, img) => sum + img.width, 0));
} else { } else {
onBadImages('All images must share the same width or height, and that dimension must be a power of two.'); if(allImagesShareWidth) {
outputWidth = nextPowerOfTwo(firstWidth);
outputHeight = nextPowerOfTwo(Object.values(images).reduce((sum, img) => sum + img.height, 0));
} else if(allImagesShareHeight) {
outputHeight = nextPowerOfTwo(firstHeight);
outputWidth = nextPowerOfTwo(Object.values(images).reduce((sum, img) => sum + img.width, 0));
} else {
onBadImages('All images must share the same width or height to be joined together.');
return;
}
} }
// Update preview // Update preview