mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 03:59:36 +00:00
Get scoreboard bar working
This commit is contained in:
@@ -129,6 +129,7 @@ namespace PortabilityLayer
|
||||
void MenuSelect(const Vec2i &initialPoint, int16_t *outMenu, uint16_t *outItem) override;
|
||||
|
||||
void DrawMenuBar() override;
|
||||
void SetMenuVisible(bool isVisible) override;
|
||||
|
||||
void RenderFrame(IGpDisplayDriver *displayDriver) override;
|
||||
|
||||
@@ -189,6 +190,7 @@ namespace PortabilityLayer
|
||||
Menu **m_lastMenu;
|
||||
bool m_haveMenuBarLayout;
|
||||
bool m_haveIcon;
|
||||
bool m_menuBarVisible;
|
||||
|
||||
uint8_t m_iconColors[16 * 16];
|
||||
uint8_t m_iconMask[32];
|
||||
@@ -207,6 +209,7 @@ namespace PortabilityLayer
|
||||
, m_haveMenuBarLayout(false)
|
||||
, m_haveIcon(false)
|
||||
, m_iconGraphic(nullptr)
|
||||
, m_menuBarVisible(true)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -707,8 +710,16 @@ namespace PortabilityLayer
|
||||
m_menuBarGraf->m_port.SetDirty(QDPortDirtyFlag_Contents);
|
||||
}
|
||||
|
||||
void MenuManagerImpl::SetMenuVisible(bool isVisible)
|
||||
{
|
||||
m_menuBarVisible = isVisible;
|
||||
}
|
||||
|
||||
void MenuManagerImpl::RenderFrame(IGpDisplayDriver *displayDriver)
|
||||
{
|
||||
if (!m_menuBarVisible)
|
||||
return;
|
||||
|
||||
if (m_menuBarGraf)
|
||||
{
|
||||
m_menuBarGraf->PushToDDSurface(displayDriver);
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace PortabilityLayer
|
||||
virtual void MenuSelect(const Vec2i &initialPoint, int16_t *outMenu, uint16_t *outItem) = 0;
|
||||
|
||||
virtual void DrawMenuBar() = 0;
|
||||
virtual void SetMenuVisible(bool isVisible) = 0;
|
||||
|
||||
virtual void RenderFrame(IGpDisplayDriver *displayDriver) = 0;
|
||||
|
||||
|
||||
@@ -897,7 +897,11 @@ short StringWidth(const PLPasStr &str)
|
||||
if (!rfont)
|
||||
return 0;
|
||||
|
||||
return rfont->MeasureString(str.UChars(), str.Length());
|
||||
const size_t width = rfont->MeasureString(str.UChars(), str.Length());
|
||||
if (width > SHRT_MAX)
|
||||
return SHRT_MAX;
|
||||
|
||||
return static_cast<short>(width);
|
||||
}
|
||||
|
||||
void GetMouse(Point *point)
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
#include "WindowDef.h"
|
||||
#include "IOStream.h"
|
||||
#include "CoreDefs.h"
|
||||
#include "PLPasStr.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
{
|
||||
bool WindowDef::Deserialize(IOStream *stream)
|
||||
{
|
||||
struct WindowDefPart1
|
||||
@@ -40,4 +43,21 @@ namespace PortabilityLayer
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
WindowDef WindowDef::Create(const Rect &initialRect, int16_t wdefID, bool isVisible, bool hasCloseBox, uint32_t refConstant, uint16_t positionSpec, const PLPasStr &title)
|
||||
{
|
||||
WindowDef wdef;
|
||||
wdef.m_initialRect = initialRect;
|
||||
wdef.m_wdefResID = wdefID;
|
||||
wdef.m_visibilityStatus = isVisible ? 1 : 0;
|
||||
wdef.m_hasCloseBox = hasCloseBox ? 1 : 0;
|
||||
wdef.m_referenceConstant = refConstant;
|
||||
wdef.m_positionSpec = positionSpec;
|
||||
|
||||
const uint8_t titleLength = static_cast<uint8_t>(std::max<size_t>(255, title.Length()));
|
||||
wdef.m_title[0] = titleLength;
|
||||
memcpy(wdef.m_title + 1, title.UChars(), titleLength);
|
||||
|
||||
return wdef;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include "SharedTypes.h"
|
||||
#include "PascalStr.h"
|
||||
|
||||
class PLPasStr;
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class IOStream;
|
||||
@@ -18,5 +20,7 @@ namespace PortabilityLayer
|
||||
uint8_t m_title[256];
|
||||
|
||||
bool Deserialize(IOStream *stream);
|
||||
|
||||
static WindowDef Create(const Rect &initialRect, int16_t wdefID, bool isVisible, bool hasCloseBox, uint32_t refConstant, uint16_t positionSpec, const PLPasStr &title);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user