mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 14:53:52 +00:00
Add license browser, improve touchscreen UI
This commit is contained in:
@@ -25,6 +25,8 @@ namespace PortabilityLayer
|
||||
|
||||
FontFamily *GetSystemFont(int textSize, int variationFlags) const override;
|
||||
FontFamily *GetApplicationFont(int textSize, int variationFlags) const override;
|
||||
FontFamily *GetHandwritingFont(int textSize, int variationFlags) const override;
|
||||
FontFamily *GetMonospaceFont(int textSize, int variationFlags) const override;
|
||||
|
||||
RenderedFont *GetRenderedFont(IGpFont *font, int size, bool aa, FontHacks fontHacks) override;
|
||||
RenderedFont *GetRenderedFontFromFamily(FontFamily *font, int size, bool aa, int flags) override;
|
||||
@@ -38,6 +40,8 @@ namespace PortabilityLayer
|
||||
static const unsigned int kNumCachedRenderedFonts = 32;
|
||||
static const int kSystemFontCacheID = 1;
|
||||
static const int kApplicationFontCacheID = 2;
|
||||
static const int kHandwritingFontCacheID = 3;
|
||||
static const int kMonospaceFontCacheID = 3;
|
||||
static const int kFontCacheVersion = 1;
|
||||
static const int kFontCacheNameSize = 64;
|
||||
|
||||
@@ -59,6 +63,8 @@ namespace PortabilityLayer
|
||||
|
||||
FontFamily *m_systemFont;
|
||||
FontFamily *m_applicationFont;
|
||||
FontFamily *m_handwritingFont;
|
||||
FontFamily *m_monospaceFont;
|
||||
uint32_t m_usageCounter;
|
||||
|
||||
CachedRenderedFont m_cachedRenderedFonts[kNumCachedRenderedFonts];
|
||||
@@ -70,6 +76,8 @@ namespace PortabilityLayer
|
||||
{
|
||||
m_systemFont = FontFamily::Create(kSystemFontCacheID);
|
||||
m_applicationFont = FontFamily::Create(kApplicationFontCacheID);
|
||||
m_handwritingFont = FontFamily::Create(kHandwritingFontCacheID);
|
||||
m_monospaceFont = FontFamily::Create(kMonospaceFontCacheID);
|
||||
|
||||
if (m_systemFont)
|
||||
m_systemFont->AddFont(FontFamilyFlag_None, "Fonts/OpenSans/OpenSans-ExtraBold.ttf", FontHacks_None);
|
||||
@@ -80,6 +88,12 @@ namespace PortabilityLayer
|
||||
m_applicationFont->AddFont(FontFamilyFlag_Bold, "Fonts/OpenSans/OpenSans-Bold.ttf", FontHacks_None);
|
||||
}
|
||||
|
||||
if (m_handwritingFont)
|
||||
m_handwritingFont->AddFont(FontFamilyFlag_None, "Fonts/GochiHand/GochiHand-Regular.ttf", FontHacks_None);
|
||||
|
||||
if (m_monospaceFont)
|
||||
m_monospaceFont->AddFont(FontFamilyFlag_None, "Fonts/Roboto/RobotoMono-Regular.ttf", FontHacks_None);
|
||||
|
||||
memset(m_cachedRenderedFonts, 0, sizeof(m_cachedRenderedFonts));
|
||||
}
|
||||
|
||||
@@ -91,13 +105,13 @@ namespace PortabilityLayer
|
||||
if (m_applicationFont)
|
||||
m_applicationFont->Destroy();
|
||||
|
||||
IGpFontHandler *hfh = HostFontHandler::GetInstance();
|
||||
if (m_handwritingFont)
|
||||
m_handwritingFont->Destroy();
|
||||
|
||||
if (m_systemFont)
|
||||
{
|
||||
m_systemFont->Destroy();
|
||||
m_systemFont = nullptr;
|
||||
}
|
||||
if (m_monospaceFont)
|
||||
m_monospaceFont->Destroy();
|
||||
|
||||
IGpFontHandler *hfh = HostFontHandler::GetInstance();
|
||||
|
||||
for (int i = 0; i < sizeof(m_cachedRenderedFonts) / sizeof(m_cachedRenderedFonts[0]); i++)
|
||||
{
|
||||
@@ -109,7 +123,6 @@ namespace PortabilityLayer
|
||||
|
||||
FontFamily *FontManagerImpl::GetSystemFont(int textSize, int variationFlags) const
|
||||
{
|
||||
(void)textSize;
|
||||
return m_systemFont;
|
||||
}
|
||||
|
||||
@@ -121,6 +134,16 @@ namespace PortabilityLayer
|
||||
return m_applicationFont;
|
||||
}
|
||||
|
||||
FontFamily *FontManagerImpl::GetHandwritingFont(int textSize, int variationFlags) const
|
||||
{
|
||||
return m_handwritingFont;
|
||||
}
|
||||
|
||||
FontFamily *FontManagerImpl::GetMonospaceFont(int textSize, int variationFlags) const
|
||||
{
|
||||
return m_monospaceFont;
|
||||
}
|
||||
|
||||
RenderedFont *FontManagerImpl::GetRenderedFont(IGpFont *font, int size, bool aa, FontHacks fontHacks)
|
||||
{
|
||||
CachedRenderedFont *newCacheSlot = &m_cachedRenderedFonts[0];
|
||||
|
@@ -17,6 +17,8 @@ namespace PortabilityLayer
|
||||
|
||||
virtual FontFamily *GetSystemFont(int fontSize, int variationFlags) const = 0;
|
||||
virtual FontFamily *GetApplicationFont(int fontSize, int variationFlags) const = 0;
|
||||
virtual FontFamily *GetHandwritingFont(int fontSize, int variationFlags) const = 0;
|
||||
virtual FontFamily *GetMonospaceFont(int fontSize, int variationFlags) const = 0;
|
||||
|
||||
virtual RenderedFont *GetRenderedFont(IGpFont *font, int size, bool aa, FontHacks fontHacks) = 0;
|
||||
virtual RenderedFont *GetRenderedFontFromFamily(FontFamily *fontFamily, int fontSize, bool aa, int flags) = 0;
|
||||
|
@@ -208,12 +208,12 @@ namespace PortabilityLayer
|
||||
|
||||
static const unsigned int kIconResID = 128;
|
||||
static const unsigned int kMenuFontSize = 12;
|
||||
static const unsigned int kTouchScreenMenuFontSize = 24;
|
||||
static const unsigned int kTouchScreenMenuFontSize = 40;
|
||||
static const unsigned int kMenuBarIconYOffset = 2;
|
||||
static const unsigned int kMenuBarTextYOffset = 14;
|
||||
static const unsigned int kTouchScreenMenuBarTextYOffset = 26;
|
||||
static const unsigned int kTouchScreenMenuBarTextYOffset = 40;
|
||||
static const unsigned int kMenuBarHeight = 20;
|
||||
static const unsigned int kTouchscreenMenuBarHeight = 38;
|
||||
static const unsigned int kTouchscreenMenuBarHeight = 54;
|
||||
static const unsigned int kMenuBarItemPadding = 6;
|
||||
static const unsigned int kMenuBarInitialPadding = 16;
|
||||
|
||||
@@ -645,6 +645,9 @@ namespace PortabilityLayer
|
||||
|
||||
bool MenuManagerImpl::IsPointInMenuBar(const Vec2i &point) const
|
||||
{
|
||||
if (!m_menuBarVisible)
|
||||
return false;
|
||||
|
||||
return IsYInMenuBarRange(point.m_y);
|
||||
}
|
||||
|
||||
|
@@ -647,6 +647,9 @@ bool WaitForEvent(TimeTaggedVOSEvent *eventOut, uint32_t ticks)
|
||||
Delay(1, nullptr);
|
||||
|
||||
ticks--;
|
||||
|
||||
if (ticks == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@@ -2026,6 +2026,24 @@ PortabilityLayer::RenderedFont *GetSystemFont(int size, int variationFlags, bool
|
||||
return PortabilityLayer::FontManager::GetInstance()->GetRenderedFontFromFamily(fontFamily, size, aa, variationFlags);
|
||||
}
|
||||
|
||||
PortabilityLayer::RenderedFont *GetHandwritingFont(int size, int variationFlags, bool aa)
|
||||
{
|
||||
PortabilityLayer::FontFamily *fontFamily = PortabilityLayer::FontManager::GetInstance()->GetHandwritingFont(size, variationFlags);
|
||||
if (!fontFamily)
|
||||
return nullptr;
|
||||
|
||||
return PortabilityLayer::FontManager::GetInstance()->GetRenderedFontFromFamily(fontFamily, size, aa, variationFlags);
|
||||
}
|
||||
|
||||
PortabilityLayer::RenderedFont *GetMonospaceFont(int size, int variationFlags, bool aa)
|
||||
{
|
||||
PortabilityLayer::FontFamily *fontFamily = PortabilityLayer::FontManager::GetInstance()->GetMonospaceFont(size, variationFlags);
|
||||
if (!fontFamily)
|
||||
return nullptr;
|
||||
|
||||
return PortabilityLayer::FontManager::GetInstance()->GetRenderedFontFromFamily(fontFamily, size, aa, variationFlags);
|
||||
}
|
||||
|
||||
#include "stb_image_write.h"
|
||||
|
||||
void DebugPixMap(PixMap **pixMapH, const char *outName)
|
||||
|
@@ -93,6 +93,8 @@ Boolean SectRect(const Rect *rectA, const Rect *rectB, Rect *outIntersection);
|
||||
|
||||
PortabilityLayer::RenderedFont *GetApplicationFont(int size, int variationFlags, bool aa);
|
||||
PortabilityLayer::RenderedFont *GetSystemFont(int size, int variationFlags, bool aa);
|
||||
PortabilityLayer::RenderedFont *GetHandwritingFont(int size, int variationFlags, bool aa);
|
||||
PortabilityLayer::RenderedFont *GetMonospaceFont(int size, int variationFlags, bool aa);
|
||||
|
||||
|
||||
inline RGBColor::RGBColor(uint8_t r, uint8_t g, uint8_t b)
|
||||
|
@@ -276,7 +276,7 @@ namespace PortabilityLayer
|
||||
extension = kPICTExtension;
|
||||
outValidationRule = ResourceValidationRules::kBMP;
|
||||
}
|
||||
else if (resTypeID == ResTypeID('STR#'))
|
||||
else if (resTypeID == ResTypeID('STR#') || resTypeID == ResTypeID('LICS'))
|
||||
extension = ".txt";
|
||||
else if (resTypeID == ResTypeID('DITL') || resTypeID == ResTypeID('muvi'))
|
||||
extension = ".json";
|
||||
|
@@ -1108,7 +1108,8 @@ namespace PortabilityLayer
|
||||
|
||||
void WindowManagerImpl::FindWindow(const Point &point, Window **outWindow, short *outRegion) const
|
||||
{
|
||||
if (PortabilityLayer::MenuManager::GetInstance()->IsPointInMenuBar(PortabilityLayer::Vec2i(point.h, point.v)))
|
||||
PortabilityLayer::MenuManager *menuManager = PortabilityLayer::MenuManager::GetInstance();
|
||||
if (menuManager->IsPointInMenuBar(PortabilityLayer::Vec2i(point.h, point.v)))
|
||||
{
|
||||
if (outWindow)
|
||||
*outWindow = nullptr;
|
||||
|
Reference in New Issue
Block a user