Finish removing QDState

This commit is contained in:
elasota
2020-05-21 05:01:16 -04:00
parent 432cdbcc3a
commit 5869571747
35 changed files with 253 additions and 407 deletions

View File

@@ -14,6 +14,8 @@
#include "FontManager.h"
#include "MainWindow.h"
#include "RectUtils.h"
#include "RenderedFont.h"
#include "RenderedFontMetrics.h"
#include "ResolveCachingColor.h"
#include "Room.h"
#include "Utilities.h"
@@ -120,16 +122,15 @@ void DrawBannerMessage (Point topLeft)
PasStringCopy((*thisHouse)->banner, bannerStr);
workSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
count = 0;
do
{
GetLineOfText(bannerStr, count, subStr);
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 32 + (count * 20)), subStr, true, blackColor);
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 32 + (count * 20)), subStr, blackColor, appFont);
count++;
}
while (subStr[0] > 0);
@@ -151,10 +152,10 @@ void DrawBannerMessage (Point topLeft)
PasStringConcat(bannerStr, subStr);
PortabilityLayer::ResolveCachingColor redColor = StdColors::Red();
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 164), bannerStr, true, redColor);
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 164), bannerStr, redColor, appFont);
GetLocalizedString(5, subStr);
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 180), subStr, true, redColor);
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 180), subStr, redColor, appFont);
}
SetGraphicsPort(wasGWorld);
@@ -226,7 +227,7 @@ void DisplayStarsRemaining(void)
DrawSurface *surface = starsWindow->GetDrawSurface();
surface->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
NumToString((long)numStarsRemaining, theStr);
@@ -235,8 +236,8 @@ void DisplayStarsRemaining(void)
else
{
LoadScaledGraphic(surface, kStarsRemainingPICT, &bounds);
const Point textPoint = Point::Create(bounds.left + 102 - (surface->MeasureString(theStr) / 2), bounds.top + 23);
ColorText(surface, textPoint, theStr, 4L);
const Point textPoint = Point::Create(bounds.left + 102 - (appFont->MeasurePStr(theStr) / 2), bounds.top + 23);
ColorText(surface, textPoint, theStr, 4L, appFont);
}
if (doZooms)

View File

@@ -20,11 +20,11 @@
// this function draws text in that color. It assumes the current port,<2C>
// the current font, the current pen location, etc.
void ColorText (DrawSurface *surface, const Point &point, StringPtr theStr, long color)
void ColorText (DrawSurface *surface, const Point &point, StringPtr theStr, long color, PortabilityLayer::RenderedFont *font)
{
PortabilityLayer::ResolveCachingColor rColor = PortabilityLayer::ResolveCachingColor::FromStandardColor(color);
surface->DrawString(point, theStr, true, rColor);
surface->DrawString(point, theStr, rColor, font);
}
//-------------------------------------------------------------- ColorRect

View File

@@ -71,11 +71,12 @@ void UpdateCoordWindow (void)
if (coordWindow == nil)
return;
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
PortabilityLayer::ResolveCachingColor blueColor = StdColors::Blue();
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(9, 0, true);
DrawSurface *surface = coordWindow->GetDrawSurface();
surface->FillRect(coordWindowRect, whiteColor);
@@ -89,7 +90,7 @@ void UpdateCoordWindow (void)
else
PasStringConcat(tempStr, PSTR("-"));
surface->DrawString(Point::Create(5, 12), tempStr, true, blackColor);
surface->DrawString(Point::Create(5, 12), tempStr, blackColor, appFont);
PasStringCopy(PSTR("v: "), tempStr);
if (coordV != -1)
@@ -100,7 +101,7 @@ void UpdateCoordWindow (void)
else
PasStringConcat(tempStr, PSTR("-"));
surface->DrawString(Point::Create(4, 22), tempStr, true, blackColor);
surface->DrawString(Point::Create(4, 22), tempStr, blackColor, appFont);
PasStringCopy(PSTR("d: "), tempStr);
if (coordD != -1)
@@ -111,7 +112,7 @@ void UpdateCoordWindow (void)
else
PasStringConcat(tempStr, PSTR("-"));
surface->DrawString(Point::Create(5, 32), tempStr, true, blueColor);
surface->DrawString(Point::Create(5, 32), tempStr, blueColor, appFont);
#endif
}
@@ -157,8 +158,6 @@ void OpenCoordWindow (void)
coordV = -1;
coordD = -1;
coordWindow->GetDrawSurface()->SetApplicationFont(9, 0);
if (objActive != kNoObjectSelected)
{
if (ObjectHasHandle(&direction, &dist))

View File

@@ -18,6 +18,8 @@
#include "FontFamily.h"
#include "ResourceManager.h"
#include "ResolveCachingColor.h"
#include "RenderedFont.h"
#include "RenderedFontMetrics.h"
#include <algorithm>
@@ -573,26 +575,26 @@ void DrawDialogUserText (Dialog *dial, short item, StringPtr text, Boolean inver
DrawSurface *surface = dial->GetWindow()->GetDrawSurface();
surface->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_None);
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(9, PortabilityLayer::FontFamilyFlag_None, true);
PasStringCopy(text, stringCopy);
Rect iRect = dial->GetItems()[item - 1].GetWidget()->GetRect();
if ((surface->MeasureString(stringCopy) + 2) > (iRect.right - iRect.left))
CollapseStringToWidth(surface, stringCopy, iRect.right - iRect.left - 2);
if ((appFont->MeasurePStr(stringCopy) + 2) > (iRect.right - iRect.left))
CollapseStringToWidth(appFont, stringCopy, iRect.right - iRect.left - 2);
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
surface->FillRect(iRect, whiteColor);
short strWidth = surface->MeasureString(stringCopy);
short strWidth = appFont->MeasurePStr(stringCopy);
inset = ((iRect.right - iRect.left) - (strWidth + 2)) / 2;
iRect.left += inset;
iRect.right -= inset;
// Draw centered
const int32_t ascender = surface->MeasureFontAscender();
const int32_t ascender = appFont->GetMetrics().m_ascent;
PortabilityLayer::ResolveCachingColor backgroundColor;
PortabilityLayer::ResolveCachingColor textColor;
@@ -611,7 +613,7 @@ void DrawDialogUserText (Dialog *dial, short item, StringPtr text, Boolean inver
surface->FillRect(iRect, backgroundColor);
const Point centeredDrawPoint = Point::Create((iRect.left + iRect.right - strWidth) / 2, (iRect.top + iRect.bottom + ascender) / 2);
surface->DrawString(centeredDrawPoint, stringCopy, true, textColor);
surface->DrawString(centeredDrawPoint, stringCopy, textColor, appFont);
}
//-------------------------------------------------------------- DrawDialogUserText
@@ -626,16 +628,16 @@ void DrawDialogUserText2 (Dialog *dial, short item, StringPtr text)
short iType;
DrawSurface *surface = dial->GetWindow()->GetDrawSurface();
surface->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_None);
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(9, PortabilityLayer::FontFamilyFlag_None, true);
PasStringCopy(text, stringCopy);
const Rect iRect = dial->GetItems()[item - 1].GetWidget()->GetRect();
if ((surface->MeasureString(stringCopy) + 2) > (iRect.right - iRect.left))
CollapseStringToWidth(surface, stringCopy, iRect.right - iRect.left - 2);
if ((appFont->MeasurePStr(stringCopy) + 2) > (iRect.right - iRect.left))
CollapseStringToWidth(appFont, stringCopy, iRect.right - iRect.left - 2);
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
surface->DrawString(Point::Create(iRect.left, iRect.bottom), stringCopy, true, blackColor);
surface->DrawString(Point::Create(iRect.left, iRect.bottom), stringCopy, blackColor, appFont);
}
//-------------------------------------------------------------- LoadDialogPICT

View File

@@ -18,6 +18,7 @@ namespace PortabilityLayer
class ScanlineMask;
class ResTypeID;
struct RGBAColor;
class RenderedFont;
}
#define kPreferredDepth 8
@@ -134,7 +135,7 @@ void DecrementCursor (void);
void SpinCursor (short);
void BackSpinCursor (short);
void ColorText (DrawSurface *surface, const Point &, StringPtr, long); // --- ColorUtils.c
void ColorText (DrawSurface *surface, const Point &, StringPtr, long, PortabilityLayer::RenderedFont *font); // --- ColorUtils.c
void ColorRect (DrawSurface *surface, const Rect &, long);
void ColorOval (DrawSurface *surface, const Rect &, long);
void ColorOvalMaskPattern (DrawSurface *surface, const Rect &, long, const uint8_t *);
@@ -189,7 +190,7 @@ void PasStringConcat (StringPtr, const PLPasStr &);
void GetLineOfText (StringPtr, short, StringPtr);
void WrapText (StringPtr, short);
void GetFirstWordOfString (StringPtr, StringPtr);
void CollapseStringToWidth (DrawSurface *, StringPtr, short);
void CollapseStringToWidth (PortabilityLayer::RenderedFont *, StringPtr, short);
void GetChooserName (StringPtr);
StringPtr GetLocalizedString (short, StringPtr);

View File

@@ -19,6 +19,7 @@
#include "Objects.h"
#include "PLStandardColors.h"
#include "RectUtils.h"
#include "RenderedFont.h"
#include "ResolveCachingColor.h"
#include "Utilities.h"
@@ -108,16 +109,16 @@ void SetUpFinalScreen (void)
{
GetLineOfText(tempStr, count, subStr);
surface->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
offset = ((thisMac.constrainedScreen.right - thisMac.constrainedScreen.left) -
surface->MeasureString(subStr)) / 2;
appFont->MeasurePStr(subStr)) / 2;
const Point textShadowPos = Point::Create(offset + 1, textDown + 33 + (count * 20));
surface->DrawString(textShadowPos, subStr, true, blackColor);
surface->DrawString(textShadowPos, subStr, blackColor, appFont);
const Point textPos = Point::Create(offset, textDown + 32 + (count * 20));
surface->DrawString(textPos, subStr, true, whiteColor);
surface->DrawString(textPos, subStr, whiteColor, appFont);
count++;
}
while (subStr[0] > 0);

View File

@@ -25,6 +25,7 @@
#include "PLStandardColors.h"
#include "PLTimeTaggedVOSEvent.h"
#include "RectUtils.h"
#include "RenderedFont.h"
#include "ResolveCachingColor.h"
#include "Utilities.h"
#include "WindowManager.h"
@@ -148,29 +149,29 @@ void DrawHighScores (DrawSurface *surface)
DisposeGWorld(tempMap);
DisposeGWorld(tempMask);
surface->SetApplicationFont(14, PortabilityLayer::FontFamilyFlag_Bold);
PortabilityLayer::RenderedFont *appFont14 = GetApplicationFont(14, PortabilityLayer::FontFamilyFlag_Bold, true);
PasStringCopy(PSTR("<EFBFBD> "), tempStr);
PasStringConcat(tempStr, thisHouseName);
PasStringConcat(tempStr, PSTR(" <20>"));
const Point scoreShadowPoint = Point::Create(scoreLeft + ((kScoreWide - surface->MeasureString(tempStr)) / 2) - 1, dropIt - 66);
surface->DrawString(scoreShadowPoint, tempStr, true, blackColor);
const Point scoreShadowPoint = Point::Create(scoreLeft + ((kScoreWide - appFont14->MeasurePStr(tempStr)) / 2) - 1, dropIt - 66);
surface->DrawString(scoreShadowPoint, tempStr, blackColor, appFont14);
const Point scoreTextPoint = Point::Create(scoreLeft + ((kScoreWide - surface->MeasureString(tempStr)) / 2), dropIt - 65);
surface->DrawString(scoreTextPoint, tempStr, true, cyanColor);
const Point scoreTextPoint = Point::Create(scoreLeft + ((kScoreWide - appFont14->MeasurePStr(tempStr)) / 2), dropIt - 65);
surface->DrawString(scoreTextPoint, tempStr, cyanColor, appFont14);
surface->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
PortabilityLayer::RenderedFont *appFont12 = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
thisHousePtr = *thisHouse;
// message for score #1
PasStringCopy(thisHousePtr->highScores.banner, tempStr);
bannerWidth = surface->MeasureString(tempStr);
bannerWidth = appFont12->MeasurePStr(tempStr);
const Point topScoreShadowPoint = Point::Create(scoreLeft + (kScoreWide - bannerWidth) / 2, dropIt - kKimsLifted);
surface->DrawString(topScoreShadowPoint, tempStr, true, blackColor);
surface->DrawString(topScoreShadowPoint, tempStr, blackColor, appFont12);
const Point topScoreTextPoint = Point::Create(scoreLeft + (kScoreWide - bannerWidth) / 2, dropIt - kKimsLifted - 1);
surface->DrawString(topScoreTextPoint, tempStr, true, yellowColor);
surface->DrawString(topScoreTextPoint, tempStr, yellowColor, appFont12);
QSetRect(&tempRect, 0, 0, bannerWidth + 8, kScoreSpacing);
QOffsetRect(&tempRect, scoreLeft - 3 + (kScoreWide - bannerWidth) / 2,
@@ -192,7 +193,7 @@ void DrawHighScores (DrawSurface *surface)
strPos = Point::Create(scoreLeft + 1, dropIt - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 1, dropIt + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr, true, blackColor);
surface->DrawString(strPos, tempStr, blackColor, appFont12);
PortabilityLayer::ResolveCachingColor *scoreColor = (i == lastHighScore) ? &whiteColor : &cyanColor;
@@ -200,7 +201,7 @@ void DrawHighScores (DrawSurface *surface)
strPos = Point::Create(scoreLeft + 0, dropIt - 1 - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 0, dropIt - 1 + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr, true, *scoreColor);
surface->DrawString(strPos, tempStr, *scoreColor, appFont12);
// draw high score name
PasStringCopy(thisHousePtr->highScores.names[i], tempStr);
@@ -208,7 +209,7 @@ void DrawHighScores (DrawSurface *surface)
strPos = Point::Create(scoreLeft + 31, dropIt - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 31, dropIt + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr, true, blackColor);
surface->DrawString(strPos, tempStr, blackColor, appFont12);
PortabilityLayer::ResolveCachingColor *nameColor = (i == lastHighScore) ? &whiteColor : &yellowColor;
@@ -217,7 +218,7 @@ void DrawHighScores (DrawSurface *surface)
strPos = Point::Create(scoreLeft + 30, dropIt - 1 - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 30, dropIt - 1 + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr, true, *nameColor);
surface->DrawString(strPos, tempStr, *nameColor, appFont12);
// draw level number
NumToString(thisHousePtr->highScores.levels[i], tempStr);
@@ -225,14 +226,14 @@ void DrawHighScores (DrawSurface *surface)
strPos = Point::Create(scoreLeft + 161, dropIt - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 161, dropIt + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr, true, blackColor);
surface->DrawString(strPos, tempStr, blackColor, appFont12);
PortabilityLayer::ResolveCachingColor *levelColor = (i == lastHighScore) ? &whiteColor : &yellowColor;
if (i == 0)
strPos = Point::Create(scoreLeft + 160, dropIt - 1 - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 160, dropIt - 1 + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr, true, *levelColor);
surface->DrawString(strPos, tempStr, *levelColor, appFont12);
// draw word "rooms"
if (thisHousePtr->highScores.levels[i] == 1)
GetLocalizedString(6, tempStr);
@@ -243,19 +244,19 @@ void DrawHighScores (DrawSurface *surface)
strPos = Point::Create(scoreLeft + 193, dropIt - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 193, dropIt + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr, true, blackColor);
surface->DrawString(strPos, tempStr, blackColor, appFont12);
if (i == 0)
strPos = Point::Create(scoreLeft + 192, dropIt - 1 - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 192, dropIt - 1 + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr, true, cyanColor);
surface->DrawString(strPos, tempStr, cyanColor, appFont12);
// draw high score points
NumToString(thisHousePtr->highScores.scores[i], tempStr);
if (i == 0)
strPos = Point::Create(scoreLeft + 291, dropIt - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 291, dropIt + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr, true, blackColor);
surface->DrawString(strPos, tempStr, blackColor, appFont12);
PortabilityLayer::ResolveCachingColor *pointsColor = (i == lastHighScore) ? &whiteColor : &yellowColor;
@@ -263,15 +264,15 @@ void DrawHighScores (DrawSurface *surface)
strPos = Point::Create(scoreLeft + 290, dropIt - 1 - kScoreSpacing - kKimsLifted);
else
strPos = Point::Create(scoreLeft + 290, dropIt - 1 + (i * kScoreSpacing));
surface->DrawString(strPos, tempStr, true, *pointsColor);
surface->DrawString(strPos, tempStr, *pointsColor, appFont12);
}
}
surface->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold);
PortabilityLayer::RenderedFont *appFont9 = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
const Point textPos = Point::Create(scoreLeft + 80, dropIt - 1 + (10 * kScoreSpacing));
GetLocalizedString(8, tempStr);
surface->DrawString(textPos, tempStr, true, blueColor);
surface->DrawString(textPos, tempStr, blueColor, appFont9);
}
//-------------------------------------------------------------- SortHighScores

View File

@@ -70,20 +70,20 @@ void DrawOnSplash(DrawSurface *surface)
if ((thisMac.hasQT) && (hasMovie))
PasStringConcat(houseLoadedStr, PSTR(" (TV)"));
surface->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold);
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold, true);
const Point textPoint = Point::Create(splashOriginH + 436, splashOriginV + 314);
if (thisMac.isDepth == 4)
{
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
surface->DrawString(textPoint, houseLoadedStr, true, whiteColor);
surface->DrawString(textPoint, houseLoadedStr, whiteColor, appFont);
}
else
{
if (houseIsReadOnly)
ColorText(surface, textPoint, houseLoadedStr, 5L);
ColorText(surface, textPoint, houseLoadedStr, 5L, appFont);
else
ColorText(surface, textPoint, houseLoadedStr, 28L);
ColorText(surface, textPoint, houseLoadedStr, 28L, appFont);
}
#if defined(powerc) || defined(__powerc)

View File

@@ -15,6 +15,7 @@
#include "Environ.h"
#include "Objects.h"
#include "RectUtils.h"
#include "RenderedFont.h"
#include "ResolveCachingColor.h"
#include "ResourceManager.h"
#include "Room.h"
@@ -1061,13 +1062,13 @@ void DrawCalendar (Rect *theRect)
backSrcMap->DrawPicture(thePicture, bounds);
thePicture.Dispose();
backSrcMap->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold);
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold, true);
GetTime(&timeRec);
GetIndString(monthStr, kMonthStringID, timeRec.month);
const Point textPos = Point::Create(theRect->left + ((64 - backSrcMap->MeasureString(monthStr)) / 2), theRect->top + 55);
ColorText(backSrcMap, textPos, monthStr, kDarkFleshColor);
const Point textPos = Point::Create(theRect->left + ((64 - appFont->MeasurePStr(monthStr)) / 2), theRect->top + 55);
ColorText(backSrcMap, textPos, monthStr, kDarkFleshColor, appFont);
}
//-------------------------------------------------------------- DrawBulletin

View File

@@ -252,13 +252,13 @@ void ReadyBackground (short theID, short *theTiles)
workSrcMap->FillRect(workSrcRect, ltGrayColor);
workSrcMap->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_None);
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(9, PortabilityLayer::FontFamilyFlag_None, true);
const Point textPoint = Point::Create(10, 20);
if (houseUnlocked)
workSrcMap->DrawString(textPoint, PSTR("No rooms"), true, blackColor);
workSrcMap->DrawString(textPoint, PSTR("No rooms"), blackColor, appFont);
else
workSrcMap->DrawString(textPoint, PSTR("Nothing to show"), true, blackColor);
workSrcMap->DrawString(textPoint, PSTR("Nothing to show"), blackColor, appFont);
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
(BitMap *)*GetGWorldPixMap(backSrcMap),

View File

@@ -10,11 +10,13 @@
#include "PLPasStr.h"
#include "Externs.h"
#include "Environ.h"
#include "FontFamily.h"
#include "MenuManager.h"
#include "PLStandardColors.h"
#include "QDPixMap.h"
#include "QDStandardPalette.h"
#include "RectUtils.h"
#include "RenderedFont.h"
#include "ResolveCachingColor.h"
@@ -164,33 +166,35 @@ void RefreshRoomTitle (short mode)
const Point strShadowPoint = Point::Create(1, 10);
const Point strPoint = Point::Create(0, 9);
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
switch (mode)
{
case kEscapedTitleMode:
surface->DrawString(strShadowPoint, PSTR("Hit Delete key if unable to Follow"), true, blackColor);
surface->DrawString(strShadowPoint, PSTR("Hit Delete key if unable to Follow"), blackColor, appFont);
break;
case kSavingTitleMode:
surface->DrawString(strShadowPoint, PSTR("Saving Game<6D>"), true, blackColor);
surface->DrawString(strShadowPoint, PSTR("Saving Game<6D>"), blackColor, appFont);
break;
default:
surface->DrawString(strShadowPoint, thisRoom->name, true, blackColor);
surface->DrawString(strShadowPoint, thisRoom->name, blackColor, appFont);
break;
}
switch (mode)
{
case kEscapedTitleMode:
surface->DrawString(strPoint, PSTR("Hit Delete key if unable to Follow"), true, whiteColor);
surface->DrawString(strPoint, PSTR("Hit Delete key if unable to Follow"), whiteColor, appFont);
break;
case kSavingTitleMode:
surface->DrawString(strPoint, PSTR("Saving Game<6D>"), true, whiteColor);
surface->DrawString(strPoint, PSTR("Saving Game<6D>"), whiteColor, appFont);
break;
default:
surface->DrawString(strPoint, thisRoom->name, true, whiteColor);
surface->DrawString(strPoint, thisRoom->name, whiteColor, appFont);
break;
}
@@ -207,6 +211,8 @@ void RefreshNumGliders (void)
long displayMortals;
DrawSurface *surface = boardGSrcMap;
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
PortabilityLayer::ResolveCachingColor theRGBColor = PortabilityLayer::ResolveCachingColor::FromStandardColor(kGrayBackgroundColor);
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
@@ -221,8 +227,8 @@ void RefreshNumGliders (void)
const Point shadowPoint = Point::Create(1, 10);
const Point textPoint = Point::Create(0, 9);
surface->DrawString(shadowPoint, nGlidersStr, true, blackColor);
surface->DrawString(textPoint, nGlidersStr, true, whiteColor);
surface->DrawString(shadowPoint, nGlidersStr, blackColor, appFont);
surface->DrawString(textPoint, nGlidersStr, whiteColor, appFont);
CopyBits((BitMap *)*GetGWorldPixMap(boardGSrcMap),
(BitMap *)*GetGWorldPixMap(boardSrcMap),
@@ -240,6 +246,8 @@ void RefreshPoints (void)
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
surface->FillRect(boardPSrcRect, theRGBColor);
NumToString(theScore, scoreStr);
@@ -247,8 +255,8 @@ void RefreshPoints (void)
const Point shadowPoint = Point::Create(1, 10);
const Point textPoint = Point::Create(0, 9);
surface->DrawString(shadowPoint, scoreStr, true, blackColor);
surface->DrawString(textPoint, scoreStr, true, whiteColor);
surface->DrawString(shadowPoint, scoreStr, blackColor, appFont);
surface->DrawString(textPoint, scoreStr, whiteColor, appFont);
CopyBits((BitMap *)*GetGWorldPixMap(boardPSrcMap),
(BitMap *)*GetGWorldPixMap(boardSrcMap),
@@ -268,6 +276,8 @@ void QuickGlidersRefresh (void)
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
surface->FillRect(boardGSrcRect, theRGBColor);
NumToString((long)mortals, nGlidersStr);
@@ -275,8 +285,8 @@ void QuickGlidersRefresh (void)
const Point shadowPoint = Point::Create(1, 10);
const Point textPoint = Point::Create(0, 9);
surface->DrawString(shadowPoint, nGlidersStr, true, blackColor);
surface->DrawString(textPoint, nGlidersStr, true, whiteColor);
surface->DrawString(shadowPoint, nGlidersStr, blackColor, appFont);
surface->DrawString(textPoint, nGlidersStr, whiteColor, appFont);
CopyBits((BitMap *)*GetGWorldPixMap(boardGSrcMap),
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),
@@ -296,6 +306,8 @@ void QuickScoreRefresh (void)
PortabilityLayer::ResolveCachingColor blackColor = StdColors::Black();
PortabilityLayer::ResolveCachingColor whiteColor = StdColors::White();
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold, true);
surface->FillRect(boardPSrcRect, theRGBColor);
NumToString(displayedScore, scoreStr);
@@ -303,8 +315,8 @@ void QuickScoreRefresh (void)
const Point shadowPoint = Point::Create(1, 10);
const Point textPoint = Point::Create(0, 9);
surface->DrawString(shadowPoint, scoreStr, true, blackColor);
surface->DrawString(textPoint, scoreStr, true, whiteColor);
surface->DrawString(shadowPoint, scoreStr, blackColor, appFont);
surface->DrawString(textPoint, scoreStr, whiteColor, appFont);
CopyBits((BitMap *)*GetGWorldPixMap(boardPSrcMap),
GetPortBitMapForCopyBits(boardWindow->GetDrawSurface()),

View File

@@ -7,6 +7,7 @@
#include "PLPasStr.h"
#include "Externs.h"
#include "RenderedFont.h"
#include <string.h>
@@ -275,17 +276,17 @@ void GetFirstWordOfString (StringPtr stringIn, StringPtr stringOut)
// font. If the text would exceed our width limit, characters<72>
// are dropped off the end of the string and "<22>" appended.
void CollapseStringToWidth (DrawSurface *surface, StringPtr theStr, short wide)
void CollapseStringToWidth (PortabilityLayer::RenderedFont *font, StringPtr theStr, short wide)
{
short dotsWide;
Boolean tooWide;
dotsWide = surface->MeasureString(PSTR("<EFBFBD>"));
tooWide = surface->MeasureString(theStr) > wide;
while (tooWide)
dotsWide = font->MeasurePStr(PSTR("<EFBFBD>"));
tooWide = font->MeasurePStr(theStr) > wide;
while (tooWide && theStr[0] > 0)
{
theStr[0]--;
tooWide = ((surface->MeasureString(theStr) + dotsWide) > wide);
tooWide = ((font->MeasurePStr(theStr) + dotsWide) > wide);
if (!tooWide)
PasStringConcat(theStr, PSTR("<EFBFBD>"));
}

View File

@@ -105,7 +105,6 @@ void InitScoreboardMap(void)
if (!boardTSrcMap)
{
theErr = CreateOffScreenGWorld(&boardTSrcMap, &boardTSrcRect, kPreferredPixelFormat);
boardTSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
}
boardTDestRect = boardTSrcRect;
QOffsetRect(&boardTDestRect, 137 + hOffset, 5);
@@ -114,7 +113,6 @@ void InitScoreboardMap(void)
if (!boardGSrcMap)
{
theErr = CreateOffScreenGWorld(&boardGSrcMap, &boardGSrcRect, kPreferredPixelFormat);
boardGSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
}
boardGDestRect = boardGSrcRect;
QOffsetRect(&boardGDestRect, 526 + hOffset, 5);
@@ -124,7 +122,6 @@ void InitScoreboardMap(void)
if (!boardPSrcMap)
{
theErr = CreateOffScreenGWorld(&boardPSrcMap, &boardPSrcRect, kPreferredPixelFormat);
boardPSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
}
boardPDestRect = boardPSrcRect;
QOffsetRect(&boardPDestRect, 570 + hOffset, 5); // total = 6396 pixels

View File

@@ -157,8 +157,8 @@ void DrawToolName (DrawSurface *surface)
const Point textPoint = Point::Create(toolTextRect.left + 3, toolTextRect.bottom - 6);
surface->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold);
ColorText(surface, textPoint, theString, 171L);
PortabilityLayer::RenderedFont *appFont = GetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold, true);
ColorText(surface, textPoint, theString, 171L, appFont);
}
#endif

View File

@@ -8,6 +8,7 @@
#include "PLPasStr.h"
#include "Externs.h"
#include "Environ.h"
#include "FontFamily.h"
#include "PLStandardColors.h"
#include "RectUtils.h"
#include "ResolveCachingColor.h"
@@ -125,8 +126,6 @@ void OpenMessageWindow (const PLPasStr &title)
ShowWindow(mssgWindow);
DrawSurface *surface = mssgWindow->GetDrawSurface();
surface->SetSystemFont(12, 0);
}
mssgWindowExclusiveStack = mssgWindow;
@@ -150,6 +149,8 @@ void SetMessageWindowMessage (StringPtr message, const PortabilityLayer::RGBACol
{
DrawSurface *surface = mssgWindow->GetDrawSurface();
PortabilityLayer::RenderedFont *sysFont = GetSystemFont(12, PortabilityLayer::FontFamilyFlag_None, true);
SetRect(&mssgWindowRect, 0, 0, 256, kMessageWindowTall);
InsetRect(&mssgWindowRect, 16, 16);
@@ -159,7 +160,7 @@ void SetMessageWindowMessage (StringPtr message, const PortabilityLayer::RGBACol
const Point textPoint = Point::Create(mssgWindowRect.left, mssgWindowRect.bottom - 6);
PortabilityLayer::ResolveCachingColor specifiedColor = color;
surface->DrawString(textPoint, message, true, specifiedColor);
surface->DrawString(textPoint, message, specifiedColor, sysFont);
}
}