Merge pull request #518 from Wryyyong/patch-1

Very minor fix for libctru 1.6.0 compatibility
This commit is contained in:
Steven Smith 2019-10-23 15:08:11 -07:00 committed by GitHub
commit c6d92d86b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -137,7 +137,7 @@ void screen_init() {
return; return;
} }
TGLP_s* glyphInfo = fontGetGlyphInfo(); TGLP_s* glyphInfo = fontGetGlyphInfo(NULL);
glyph_count = glyphInfo->nSheets; glyph_count = glyphInfo->nSheets;
glyph_sheets = calloc(glyph_count, sizeof(C3D_Tex)); glyph_sheets = calloc(glyph_count, sizeof(C3D_Tex));
@ -148,7 +148,7 @@ void screen_init() {
for(int i = 0; i < glyph_count; i++) { for(int i = 0; i < glyph_count; i++) {
C3D_Tex* tex = &glyph_sheets[i]; C3D_Tex* tex = &glyph_sheets[i];
tex->data = fontGetGlyphSheetTex(i); tex->data = fontGetGlyphSheetTex(NULL, i);
tex->fmt = (GPU_TEXCOLOR) glyphInfo->sheetFmt; tex->fmt = (GPU_TEXCOLOR) glyphInfo->sheetFmt;
tex->size = glyphInfo->sheetSize; tex->size = glyphInfo->sheetSize;
tex->width = glyphInfo->sheetWidth; tex->width = glyphInfo->sheetWidth;
@ -491,7 +491,7 @@ void screen_draw_texture_crop(u32 id, float x, float y, float width, float heigh
} }
float screen_get_font_height(float scaleY) { float screen_get_font_height(float scaleY) {
return scaleY * fontGetInfo()->lineFeed; return scaleY * fontGetInfo(NULL)->lineFeed;
} }
#define MAX_LINES 64 #define MAX_LINES 64
@ -558,12 +558,12 @@ static void screen_wrap_string(u32* lines, float* lineWidths, float* lineHeights
lastAlignPos = linePos; lastAlignPos = linePos;
} }
charWidth *= scaleX * fontGetCharWidthInfo(fontGlyphIndexFromCodePoint(code))->charWidth; charWidth *= scaleX * fontGetCharWidthInfo(NULL, fontGlyphIndexFromCodePoint(NULL, code))->charWidth;
if(code == '\n' || (wordWrap && lw + charWidth >= maxWidth)) { if(code == '\n' || (wordWrap && lw + charWidth >= maxWidth)) {
if(code == '\n') { if(code == '\n') {
linePos++; linePos++;
lh = scaleY * fontGetInfo()->lineFeed; lh = scaleY * fontGetInfo(NULL)->lineFeed;
} }
u32 oldLinePos = linePos; u32 oldLinePos = linePos;
@ -600,7 +600,7 @@ static void screen_wrap_string(u32* lines, float* lineWidths, float* lineHeights
} }
lw += charWidth; lw += charWidth;
lh = scaleY * fontGetInfo()->lineFeed; lh = scaleY * fontGetInfo(NULL)->lineFeed;
linePos++; linePos++;
} }
@ -692,10 +692,10 @@ static void screen_draw_string_internal(const char* text, float x, float y, floa
} }
fontGlyphPos_s data; fontGlyphPos_s data;
fontCalcGlyphPos(&data, fontGlyphIndexFromCodePoint(code), GLYPH_POS_CALC_VTXCOORD, scaleX * font_scale, scaleY * font_scale); fontCalcGlyphPos(&data, NULL, fontGlyphIndexFromCodePoint(NULL, code), GLYPH_POS_CALC_VTXCOORD, scaleX * font_scale, scaleY * font_scale);
if(data.sheetIndex >= glyph_count) { if(data.sheetIndex >= glyph_count) {
fontCalcGlyphPos(&data, fontGlyphIndexFromCodePoint(0xFFFD), GLYPH_POS_CALC_VTXCOORD, scaleX * font_scale, scaleY * font_scale); fontCalcGlyphPos(&data, NULL, fontGlyphIndexFromCodePoint(NULL, 0xFFFD), GLYPH_POS_CALC_VTXCOORD, scaleX * font_scale, scaleY * font_scale);
} }
if(data.sheetIndex < glyph_count && data.sheetIndex != lastSheet) { if(data.sheetIndex < glyph_count && data.sheetIndex != lastSheet) {