mirror of https://github.com/stella-emu/stella.git
Make sure long messages overlaid on framebuffer don't overflow display surface.
This commit is contained in:
parent
fcff01df3c
commit
eafa29a520
|
@ -513,7 +513,8 @@ void FrameBuffer::showMessage(const string& message, MessagePosition position,
|
|||
myMsg.text = message;
|
||||
myMsg.color = kBtnTextColor;
|
||||
myMsg.showGauge = false;
|
||||
myMsg.w = font().getStringWidth(myMsg.text) + HBORDER * 2;
|
||||
myMsg.w = std::min(fontWidth * (MESSAGE_WIDTH) - HBORDER * 2,
|
||||
font().getStringWidth(myMsg.text) + HBORDER * 2);
|
||||
myMsg.h = fontHeight + VBORDER * 2;
|
||||
myMsg.position = position;
|
||||
myMsg.enabled = true;
|
||||
|
@ -565,7 +566,7 @@ void FrameBuffer::showMessage(const string& message, const string& valueText,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool FrameBuffer::messageShown()
|
||||
bool FrameBuffer::messageShown() const
|
||||
{
|
||||
#ifdef GUI_SUPPORT
|
||||
return myMsg.enabled;
|
||||
|
|
|
@ -166,7 +166,7 @@ class FrameBuffer
|
|||
void showMessage(const string& message, const string& valueText,
|
||||
float value, float minValue = 0.F, float maxValue = 100.F);
|
||||
|
||||
bool messageShown();
|
||||
bool messageShown() const;
|
||||
|
||||
/**
|
||||
Toggles showing or hiding framerate statistics.
|
||||
|
|
Loading…
Reference in New Issue