mirror of https://github.com/OpenRCT2/OpenRCT2.git
Draw text notice if replay system is active.
This commit is contained in:
parent
3ea8ab4bb3
commit
624427259b
|
@ -12,6 +12,7 @@
|
|||
#include "../Game.h"
|
||||
#include "../Intro.h"
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../ReplayManager.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../drawing/Drawing.h"
|
||||
#include "../drawing/IDrawingEngine.h"
|
||||
|
@ -57,6 +58,15 @@ void Painter::Paint(IDrawingEngine& de)
|
|||
de.PaintRain();
|
||||
}
|
||||
|
||||
auto* replayManager = GetContext()->GetReplayManager();
|
||||
if (replayManager != nullptr)
|
||||
{
|
||||
if (replayManager->IsReplaying())
|
||||
PaintReplayNotice(dpi, false);
|
||||
else if (replayManager->IsRecording())
|
||||
PaintReplayNotice(dpi, true);
|
||||
}
|
||||
|
||||
if (gConfigGeneral.show_fps)
|
||||
{
|
||||
PaintFPS(dpi);
|
||||
|
@ -64,6 +74,33 @@ void Painter::Paint(IDrawingEngine& de)
|
|||
gCurrentDrawCount++;
|
||||
}
|
||||
|
||||
void OpenRCT2::Paint::Painter::PaintReplayNotice(rct_drawpixelinfo* dpi, bool isRecording)
|
||||
{
|
||||
int32_t x = _uiContext->GetWidth() / 2;
|
||||
int32_t y = _uiContext->GetHeight() - 24;
|
||||
|
||||
// Format string
|
||||
utf8 buffer[64] = { 0 };
|
||||
utf8* ch = buffer;
|
||||
ch = utf8_write_codepoint(ch, FORMAT_MEDIUMFONT);
|
||||
ch = utf8_write_codepoint(ch, FORMAT_OUTLINE);
|
||||
ch = utf8_write_codepoint(ch, FORMAT_RED);
|
||||
|
||||
if (isRecording)
|
||||
snprintf(ch, 64 - (ch - buffer), "Recording...");
|
||||
else
|
||||
snprintf(ch, 64 - (ch - buffer), "Replaying...");
|
||||
|
||||
int32_t stringWidth = gfx_get_string_width(buffer);
|
||||
x = x - stringWidth;
|
||||
|
||||
if (((gCurrentTicks >> 1) & 0xF) > 4)
|
||||
gfx_draw_string(dpi, buffer, COLOUR_SATURATED_RED, x, y);
|
||||
|
||||
// Make area dirty so the text doesn't get drawn over the last
|
||||
gfx_set_dirty_blocks(x, y, x + stringWidth, y + 16);
|
||||
}
|
||||
|
||||
void Painter::PaintFPS(rct_drawpixelinfo* dpi)
|
||||
{
|
||||
int32_t x = _uiContext->GetWidth() / 2;
|
||||
|
|
|
@ -44,6 +44,7 @@ namespace OpenRCT2
|
|||
void Paint(Drawing::IDrawingEngine& de);
|
||||
|
||||
private:
|
||||
void PaintReplayNotice(rct_drawpixelinfo* dpi, bool isRecording);
|
||||
void PaintFPS(rct_drawpixelinfo* dpi);
|
||||
void MeasureFPS();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue