0 font page used instead of missing one

This commit is contained in:
MihailRis 2022-07-15 16:40:12 +03:00 committed by GitHub
parent bdd3fbf7d4
commit 889b2a62b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,7 +55,11 @@ void Font::draw(Batch2D* batch, std::wstring text, int x, int y) {
void Font::drawWithShadow(Batch2D* batch, std::wstring text, int x, int y) {
for (unsigned c : text){
if (isPrintableChar(c)){
batch->texture(pages[c >> 8]);
Texture* texture = pages[c >> 8];
if (texture == nullptr){
texture = pages[0];
}
batch->texture(texture);
batch->sprite(x+1, y+1, RES, RES, 16, c, vec4(0.0f, 0.0f, 0.0f, 1.0f));
batch->sprite(x+1, y-1, RES, RES, 16, c, vec4(0.0f, 0.0f, 0.0f, 1.0f));
batch->sprite(x-1, y, RES, RES, 16, c, vec4(0.0f, 0.0f, 0.0f, 1.0f));