Skip to content

Commit

Permalink
Scale save slot indicator (oops), make text outlines look smoother, use
Browse files Browse the repository at this point in the history
larger font when not scaling
  • Loading branch information
thesourcehim committed Feb 1, 2024
1 parent ef6eb5f commit ddd8004
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
14 changes: 7 additions & 7 deletions desmume/src/frontend/modules/osd/agg/agg_osd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,24 +561,24 @@ static void DrawStateSlots(){

if(alpha!=0)
{
aggDraw.hud->lineWidth(1.0);
aggDraw.hud->lineWidth(osd->scale);
aggDraw.hud->lineColor(0, 0, 0, alpha);
aggDraw.hud->fillColor(255, 255, 255, alpha);

for ( int i = 0, xpos=0; i < 10; xpos=xpos+24) {
for ( int i = 0, xpos=0; i < 10; xpos=xpos+24*osd->scale) {

int yheight=0;

aggDraw.hud->fillLinearGradient(xloc + xpos, yloc - yheight, xloc + 22 + xpos, yloc + 20 + yheight+20, agg::rgba8(100,200,255,alpha), agg::rgba8(255,255,255,0));
aggDraw.hud->fillLinearGradient(xloc + xpos, yloc - yheight, xloc + 22*osd->scale + xpos, yloc + 20*osd->scale + yheight+20*osd->scale, agg::rgba8(100,200,255,alpha), agg::rgba8(255,255,255,0));

if(lastSaveState == i) {
yheight = 5;
aggDraw.hud->fillLinearGradient(xloc + xpos, yloc - yheight, 22 + xloc + xpos, yloc + 20 + yheight+20, agg::rgba8(100,255,255,alpha), agg::rgba8(255,255,255,0));
yheight = 5*osd->scale;
aggDraw.hud->fillLinearGradient(xloc + xpos, yloc - yheight, 22*osd->scale + xloc + xpos, yloc + 20*osd->scale + yheight+20*osd->scale, agg::rgba8(100,255,255,alpha), agg::rgba8(255,255,255,0));
}

aggDraw.hud->rectangle(xloc + xpos , yloc - yheight, xloc + 22 + xpos , yloc + 20 + yheight);
aggDraw.hud->rectangle(xloc + xpos , yloc - yheight, xloc + 22*osd->scale + xpos , yloc + 20*osd->scale + yheight);
snprintf(number, 10, "%d", i);
RenderTextAutoVector(xloc + 1 + xpos + 4, yloc+4, std::string(number), true, osd ? osd->scale : 1);
RenderTextAutoVector(xloc + osd->scale + xpos + 4*osd->scale, yloc+4*osd->scale, std::string(number), true, osd->scale);
i++;
}
}
Expand Down
3 changes: 2 additions & 1 deletion desmume/src/frontend/modules/osd/agg/aggdraw.h
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,9 @@ class AggDrawTarget
}
#ifdef AGG2D_USE_VECTORFONTS
virtual void renderVectorFontText(double dstX, double dstY, const std::string& str) = 0;
virtual void renderVectorFontTextDropshadowed(double dstX, double dstY, const std::string& str, int shadowOffset = 1)
virtual void renderVectorFontTextDropshadowed(double dstX, double dstY, const std::string& str, double shadowOffset = 1.0)
{
shadowOffset*=0.5;
AggColor lineColorOld = lineColor();
if(lineColorOld.r+lineColorOld.g+lineColorOld.b<192)
lineColor(255-lineColorOld.r,255-lineColorOld.g,255-lineColorOld.b);
Expand Down
4 changes: 2 additions & 2 deletions desmume/src/frontend/posix/gtk/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2124,7 +2124,7 @@ static void GraphicsSettingsDialog(GSimpleAction *action, GVariant *parameter, g
#ifdef AGG2D_USE_VECTORFONTS
if(vectorFontFile.size() > 0)
{
aggDraw.hud->setVectorFont(vectorFontFile, VECTOR_FONT_BASE_SIZE * gpu_scale_factor, true);
aggDraw.hud->setVectorFont(vectorFontFile, std::max(10.0f, VECTOR_FONT_BASE_SIZE * gpu_scale_factor), true);
osd->useVectorFonts=true;
}
else
Expand Down Expand Up @@ -3096,7 +3096,7 @@ common_gtk_main(GApplication *app, gpointer user_data)
#ifdef AGG2D_USE_VECTORFONTS
if(vectorFontFile.size() > 0)
{
aggDraw.hud->setVectorFont(vectorFontFile, VECTOR_FONT_BASE_SIZE * gpu_scale_factor, true);
aggDraw.hud->setVectorFont(vectorFontFile, std::max(10.0f, VECTOR_FONT_BASE_SIZE * gpu_scale_factor), true);
osd->useVectorFonts=true;
}
else
Expand Down

0 comments on commit ddd8004

Please sign in to comment.