OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4UpperBoard Class Reference

#include <C4UpperBoard.h>

Collaboration diagram for C4UpperBoard:
[legend]

Public Member Functions

 C4UpperBoard ()
 
 ~C4UpperBoard ()
 
void Init (C4Facet &cgo)
 
void Execute ()
 

Protected Member Functions

void Draw (C4Facet &cgo)
 

Protected Attributes

C4Facet Output
 
char cTimeString [64]
 
char cTimeString2 [64]
 
int TextWidth
 
int TextYPosition
 

Friends

class C4GraphicsSystem
 

Detailed Description

Definition at line 21 of file C4UpperBoard.h.

Constructor & Destructor Documentation

C4UpperBoard::C4UpperBoard ( )
default
C4UpperBoard::~C4UpperBoard ( )
default

Member Function Documentation

void C4UpperBoard::Draw ( C4Facet cgo)
protected

Definition at line 35 of file C4UpperBoard.cpp.

References C4Draw::BlitSurfaceTile(), Config, cTimeString, cTimeString2, C4Facet::Draw(), C4GraphicsResource::fctLogo, C4GraphicsResource::fctUpperBoard, C4GraphicsResource::FontRegular, C4ConfigGeneral::FPS, C4Game::FPS, Game, C4Config::General, StdStrBuf::getData(), CStdFont::GetLineHeight(), C4GUI::GetScreenWdt(), C4Config::Graphics, GraphicsResource, C4Facet::Hgt, Output, pDraw, C4Game::ScenarioTitle, C4Facet::Set(), C4ConfigGraphics::ShowClock, sprintf, C4Facet::Surface, C4Draw::TextOut(), TextWidth, TextYPosition, and C4Facet::Wdt.

Referenced by Execute().

36 {
37  if (!cgo.Surface) return;
38  // Background
40  // Logo
41  C4Facet cgo2;
42  float fLogoZoom = 1.0f;
43  cgo2.Set(cgo.Surface, (int32_t)(cgo.Wdt/2-(::GraphicsResource.fctLogo.Wdt/2)*fLogoZoom), 0,
44  (int32_t)(::GraphicsResource.fctLogo.Wdt*fLogoZoom), (int32_t)(::GraphicsResource.fctLogo.Hgt*fLogoZoom));
46  // Right text sections
47  int32_t iRightOff = 1;
48  // Playing time
49  pDraw->TextOut(cTimeString, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, C4GUI::GetScreenWdt() - (iRightOff++) * TextWidth - 10, TextYPosition, 0xFFFFFFFF);
50  // Clock
52  pDraw->TextOut(cTimeString2, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, C4GUI::GetScreenWdt() - (iRightOff++) * TextWidth - 30, TextYPosition, 0xFFFFFFFF);
53  // FPS
54  if (Config.General.FPS)
55  {
56  sprintf(cTimeString, "%d FPS", Game.FPS);
57  pDraw->TextOut(cTimeString, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, C4GUI::GetScreenWdt() - (iRightOff++) * TextWidth - 30, TextYPosition, 0xFFFFFFFF);
58  }
59  // Scenario title
61 }
const char * getData() const
Definition: StdBuf.h:442
C4Config Config
Definition: C4Config.cpp:833
int GetLineHeight() const
Definition: C4FontLoader.h:125
C4Game Game
Definition: C4Globals.cpp:52
int32_t FPS
Definition: C4Config.h:46
C4ConfigGeneral General
Definition: C4Config.h:251
#define sprintf
Definition: Standard.h:164
StdCopyStrBuf ScenarioTitle
Definition: C4Game.h:103
bool TextOut(const char *szText, CStdFont &rFont, float fZoom, C4Surface *sfcDest, float iTx, float iTy, DWORD dwFCol=0xffffffff, BYTE byForm=ALeft, bool fDoMarkup=true)
Definition: C4Draw.cpp:567
char cTimeString[64]
Definition: C4UpperBoard.h:32
int32_t GetScreenWdt()
Definition: C4Gui.h:2821
void Set(C4Surface &rSfc)
Definition: C4Facet.cpp:459
C4GraphicsResource GraphicsResource
C4ConfigGraphics Graphics
Definition: C4Config.h:253
bool BlitSurfaceTile(C4Surface *sfcSurface, C4Surface *sfcTarget, float iToX, float iToY, float iToWdt, float iToHgt, float iOffsetX, float iOffsetY, C4ShaderCall *shader_call)
Definition: C4Draw.cpp:535
int32_t FPS
Definition: C4Game.h:111
void Draw(C4Facet &cgo, bool fAspect=true, int32_t iPhaseX=0, int32_t iPhaseY=0, bool fTransparent=true)
Definition: C4Facet.cpp:154
C4Draw * pDraw
Definition: C4Draw.cpp:42
C4Facet Output
Definition: C4UpperBoard.h:31
float Hgt
Definition: C4Facet.h:118
C4Surface * Surface
Definition: C4Facet.h:117
float Wdt
Definition: C4Facet.h:118
char cTimeString2[64]
Definition: C4UpperBoard.h:33
int32_t ShowClock
Definition: C4Config.h:102

Here is the call graph for this function:

Here is the caller graph for this function:

void C4UpperBoard::Execute ( )

Definition at line 26 of file C4UpperBoard.cpp.

References Config, cTimeString, cTimeString2, Draw(), Game, C4Config::Graphics, Output, sprintf, C4Game::Time, and C4ConfigGraphics::UpperBoard.

Referenced by C4GraphicsSystem::Execute().

27 {
28  if (!Config.Graphics.UpperBoard) return;
29  // Make the time strings
30  sprintf(cTimeString,"%02d:%02d:%02d", Game.Time/3600,(Game.Time%3600)/60,Game.Time%60);
31  time_t t = time(nullptr); strftime(cTimeString2, sizeof(cTimeString2), "[%H:%M:%S]", localtime(&t));
32  Draw(Output);
33 }
C4Config Config
Definition: C4Config.cpp:833
C4Game Game
Definition: C4Globals.cpp:52
#define sprintf
Definition: Standard.h:164
char cTimeString[64]
Definition: C4UpperBoard.h:32
int32_t UpperBoard
Definition: C4Config.h:101
C4ConfigGraphics Graphics
Definition: C4Config.h:253
int32_t Time
Definition: C4Game.h:131
C4Facet Output
Definition: C4UpperBoard.h:31
void Draw(C4Facet &cgo)
char cTimeString2[64]
Definition: C4UpperBoard.h:33

Here is the call graph for this function:

Here is the caller graph for this function:

void C4UpperBoard::Init ( C4Facet cgo)

Definition at line 63 of file C4UpperBoard.cpp.

References cTimeString, C4GraphicsResource::fctUpperBoard, C4GraphicsResource::FontRegular, Game, CStdFont::GetLineHeight(), CStdFont::GetTextWidth(), GraphicsResource, C4Facet::Hgt, Output, sprintf, C4Facet::Surface, TextWidth, TextYPosition, and C4Game::Time.

Referenced by C4Game::InitFullscreenComponents().

64 {
65  // Save facet
66  Output = cgo;
67  if (!::GraphicsResource.fctUpperBoard.Surface) return;
68  // in newgfx, the upperboard may be larger and overlap the scene
70  // Generate textposition
71  sprintf(cTimeString,"%02d:%02d:%02d", Game.Time/3600,(Game.Time%3600)/60,Game.Time%60);
74 }
int GetLineHeight() const
Definition: C4FontLoader.h:125
C4Game Game
Definition: C4Globals.cpp:52
#define sprintf
Definition: Standard.h:164
char cTimeString[64]
Definition: C4UpperBoard.h:32
int32_t GetTextWidth(const char *szText, bool fCheckMarkup=true)
Definition: C4FontLoader.h:140
C4GraphicsResource GraphicsResource
int32_t Time
Definition: C4Game.h:131
C4Facet Output
Definition: C4UpperBoard.h:31
float Hgt
Definition: C4Facet.h:118
C4Surface * Surface
Definition: C4Facet.h:117

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class C4GraphicsSystem
friend

Definition at line 23 of file C4UpperBoard.h.

Member Data Documentation

char C4UpperBoard::cTimeString[64]
protected

Definition at line 32 of file C4UpperBoard.h.

Referenced by Draw(), Execute(), and Init().

char C4UpperBoard::cTimeString2[64]
protected

Definition at line 33 of file C4UpperBoard.h.

Referenced by Draw(), and Execute().

C4Facet C4UpperBoard::Output
protected

Definition at line 31 of file C4UpperBoard.h.

Referenced by Draw(), Execute(), and Init().

int C4UpperBoard::TextWidth
protected

Definition at line 34 of file C4UpperBoard.h.

Referenced by Draw(), and Init().

int C4UpperBoard::TextYPosition
protected

Definition at line 35 of file C4UpperBoard.h.

Referenced by Draw(), and Init().


The documentation for this class was generated from the following files: