Correct a bug on displaying caddy content when using 8bit height font

(like CBM font)
This commit is contained in:
gbouille 2018-12-30 17:43:14 +01:00
parent 2979c69791
commit 39e737e935

View file

@ -32,8 +32,6 @@ static char buffer[256] = { 0 };
static u32 white = RGBA(0xff, 0xff, 0xff, 0xff); static u32 white = RGBA(0xff, 0xff, 0xff, 0xff);
static u32 red = RGBA(0xff, 0, 0, 0xff); static u32 red = RGBA(0xff, 0, 0, 0xff);
#define LCDFONTHEIGHT 16
bool DiskCaddy::Empty() bool DiskCaddy::Empty()
{ {
int x; int x;
@ -64,7 +62,7 @@ bool DiskCaddy::Empty()
snprintf(buffer, 256, "Saving"); snprintf(buffer, 256, "Saving");
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), BkColour); screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), BkColour);
y += LCDFONTHEIGHT; y += screenLCD->GetFontHeight();
snprintf(buffer, 256, "%s ", disks[index].GetName()); snprintf(buffer, 256, "%s ", disks[index].GetName());
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red); screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red);
screenLCD->SwapBuffers(); screenLCD->SwapBuffers();
@ -93,7 +91,7 @@ bool DiskCaddy::Empty()
snprintf(buffer, 256, "Saving"); snprintf(buffer, 256, "Saving");
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), BkColour); screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), BkColour);
y += LCDFONTHEIGHT; y += screenLCD->GetFontHeight();
snprintf(buffer, 256, "Complete "); snprintf(buffer, 256, "Complete ");
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red); screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red);
screenLCD->SwapBuffers(); screenLCD->SwapBuffers();
@ -132,7 +130,7 @@ bool DiskCaddy::Insert(const FILINFO* fileInfo, bool readOnly)
snprintf(buffer, 256, "Loading"); snprintf(buffer, 256, "Loading");
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), BkColour); screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), BkColour);
y += LCDFONTHEIGHT; y += screenLCD->GetFontHeight();
snprintf(buffer, 256, "%s ", fileInfo->fname); snprintf(buffer, 256, "%s ", fileInfo->fname);
screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red); screenLCD->PrintText(false, x, y, buffer, RGBA(0xff, 0xff, 0xff, 0xff), red);
screenLCD->SwapBuffers(); screenLCD->SwapBuffers();
@ -300,7 +298,7 @@ void DiskCaddy::ShowSelectedImage(u32 index)
if (screenLCD) if (screenLCD)
{ {
unsigned numberOfImages = GetNumberOfImages(); unsigned numberOfImages = GetNumberOfImages();
unsigned numberOfDisplayedImages = screenLCD->Height()/LCDFONTHEIGHT-1; unsigned numberOfDisplayedImages = screenLCD->Height()/screenLCD->GetFontHeight()-1;
unsigned caddyIndex; unsigned caddyIndex;
RGBA BkColour = RGBA(0, 0, 0, 0xFF); RGBA BkColour = RGBA(0, 0, 0, 0xFF);
@ -314,7 +312,7 @@ void DiskCaddy::ShowSelectedImage(u32 index)
, GetImage(index)->GetReadOnly() ? 'R' : ' ' , GetImage(index)->GetReadOnly() ? 'R' : ' '
); );
screenLCD->PrintText(false, x, y, buffer, 0, RGBA(0xff, 0xff, 0xff, 0xff)); screenLCD->PrintText(false, x, y, buffer, 0, RGBA(0xff, 0xff, 0xff, 0xff));
y += LCDFONTHEIGHT; y += screenLCD->GetFontHeight();
if (numberOfImages > numberOfDisplayedImages && index > numberOfDisplayedImages-1) if (numberOfImages > numberOfDisplayedImages && index > numberOfDisplayedImages-1)
{ {
@ -338,7 +336,7 @@ void DiskCaddy::ShowSelectedImage(u32 index)
screenLCD->PrintText(false, x, y, buffer, BkColour, BkColour); screenLCD->PrintText(false, x, y, buffer, BkColour, BkColour);
snprintf(buffer, 256, "%d %s", caddyIndex + 1, name); snprintf(buffer, 256, "%d %s", caddyIndex + 1, name);
screenLCD->PrintText(false, x, y, buffer, 0, caddyIndex == index ? RGBA(0xff, 0xff, 0xff, 0xff) : BkColour); screenLCD->PrintText(false, x, y, buffer, 0, caddyIndex == index ? RGBA(0xff, 0xff, 0xff, 0xff) : BkColour);
y += LCDFONTHEIGHT; y += screenLCD->GetFontHeight();
} }
if (y >= screenLCD->Height()) if (y >= screenLCD->Height())
break; break;