38 static const int MAX_BACKGROUND_FPS = 5;
111 bool did_draw_background =
false;
123 ClearFullscreenBackground();
131 did_draw_background =
true;
141 ClearFullscreenBackground();
204 FlashMessageText[0] = 0;
205 FlashMessageTime = 0;
211 void C4GraphicsSystem::ClearFullscreenBackground()
222 if (!loader->
Init(image_name))
250 static int32_t screenshot_index = 1;
251 const char *filepath =
nullptr;
254 sprintf(filename,
"Screenshot%03i.png", screenshot_index++);
292 float zoom = zoom_factor_all;
302 std::unique_ptr<CPNGFile> png(
new CPNGFile());
305 if (!png->Create(lWdt, lHgt,
false))
313 if (!bkWdt || !bkHgt)
335 int32_t viewport_player = viewport->
Player;
339 for (int32_t iY = 0; iY < lHgt; iY += bkHgt)
341 for (int32_t iX = 0; iX < lWdt; iX += bkWdt)
344 int32_t bkWdt2 = bkWdt;
345 int32_t bkHgt2 = bkHgt;
346 if (iX + bkWdt2 > lWdt)
348 bkWdt2 -= iX + bkWdt2 - lWdt;
350 if (iY + bkHgt2 > lHgt)
352 bkHgt2 -= iY + bkHgt2 - lHgt;
355 bkFct.
Set(
FullScreen.
pSurface, 0, 0, ceil(
float(bkWdt2)/zoom), ceil(
float(bkHgt2)/zoom), iX/zoom, iY/zoom, zoom, 0, 0);
357 viewport->
Draw(bkFct,
true,
false);
366 for (int32_t iY2 = 0; iY2 < bkHgt2; ++iY2)
369 glReadPixels(0,
FullScreen.
pSurface->
Hgt - iY2 - 1, bkWdt2, 1, GL_BGR, GL_UNSIGNED_BYTE,
reinterpret_cast<BYTE *
>(png->GetRow(iY + iY2)) + iX * 3);
371 for (int32_t iX2 = 0; iX2 < bkWdt2; ++iX2)
388 viewport->
Player = viewport_player;
423 void C4GraphicsSystem::DrawHoldMessages()
440 FlashMessageTime =
SLen(FlashMessageText) * 2;
461 message.
Format(
"%s: %s", description,
LoadResStr(switch_on ?
"IDS_CTL_ON" :
"IDS_CTL_OFF"));
465 void C4GraphicsSystem::DrawFlashMessage()
478 if (!FlashMessageTime)
484 void C4GraphicsSystem::DrawHelp()
495 text.AppendFormat(
"[%s]\n\n",
LoadResStr(
"IDS_CTL_GAMEFUNCTIONS"));
521 text.AppendFormat(
"\n\n[%s]\n\n",
"Debug");
523 text.AppendFormat(
"<c ffff00>%s</c> - %s\n",
GetKeyboardInputName(
"DbgShowVtxToggle").getData(),
"Entrance+Vertices");
524 text.AppendFormat(
"<c ffff00>%s</c> - %s\n",
GetKeyboardInputName(
"DbgShowActionToggle").getData(),
"Actions/Commands/Pathfinder/Lights/Menus");
525 text.AppendFormat(
"<c ffff00>%s</c> - %s\n",
GetKeyboardInputName(
"DbgShow8BitSurface").getData(),
"8-bit surfaces");
const int C4UpperBoardHeight
StdStrBuf GetKeyboardInputName(const char *key_name, bool abbreviated=false, int32_t index=0)
C4Application Application
C4GraphicsSystem GraphicsSystem
C4GraphicsResource GraphicsResource
const char * LoadResStr(const char *id)
bool Log(const char *szMessage)
bool LogF(const char *strMessage,...)
void SCopy(const char *szSource, char *sTarget, size_t iMaxL)
size_t SLen(const char *sptr)
bool FileExists(const char *szFileName)
C4MusicSystem MusicSystem
const char * AtScreenshotPath(const char *filename)
const char * AtUserDataRelativePath(const char *filename)
C4ConfigGraphics Graphics
virtual void FillBG(DWORD dwClr=0)=0
bool TextOut(const char *szText, CStdFont &rFont, float fZoom, C4Surface *sfcDest, float iTx, float iTy, DWORD dwFCol=0xffffffff, BYTE byForm=ALeft, bool fDoMarkup=true)
void SetMouseInGUI(bool fInGUI, bool fByMouse)
bool HasFullscreenDialog(bool fIncludeFading)
bool SaveScreenshot(bool save_all, float zoom_factor_all)
void DeactivateDebugOutput()
bool ToggleShowNetStatus()
bool DoSaveScreenshot(bool save_all, const char *filename, float zoom_factor_all)
bool ToggleShowVertices()
bool InitLoaderScreen(const char *image_name)
std::unique_ptr< C4MessageBoard > MessageBoard
void FlashMessage(const char *message)
void EnableLoaderDrawing()
int32_t iRedrawBackground
C4LoaderScreen * pLoaderScreen
bool ToggleShow8BitSurface()
void FlashMessageOnOff(const char *description, bool switch_on)
int32_t GetHeight() const
void SetBlackScreen(bool fIsBlack)
bool Init(std::string szLoaderSpec)
void Execute(bool force_buffer_checks=false)
bool isLobbyActive() const
DWORD GetPixDw(int iX, int iY, bool fApplyModulation)
bool PageFlip(C4Rect *pSrcRt=nullptr, C4Rect *pDstRt=nullptr)
bool SavePNG(C4Group &hGroup, const char *szFilename, bool fSaveAlpha=true, bool fSaveOverlayOnly=false)
void Set(const C4Facet &cpy)
static C4TimeMilliseconds Now()
void SetOutputSize(int32_t draw_x, int32_t draw_y, int32_t out_x, int32_t out_y, int32_t out_wdt, int32_t out_hgt)
void Draw(C4TargetFacet &cgo, bool draw_game, bool draw_overlay)
int32_t GetViewportCount()
C4Viewport * GetFirstViewport()
void RecalculateViewports()
void Execute(bool DrawBackground)
static void ScheduleSaving(CPNGFile *png, const char *filename)
int GetLineHeight() const
const char * getData() const
void Format(const char *szFmt,...) GNUC_FORMAT_ATTRIBUTE_O