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 ( )

Definition at line 24 of file C4UpperBoard.cpp.

25 {
26 }
C4UpperBoard::~C4UpperBoard ( )

Definition at line 28 of file C4UpperBoard.cpp.

29 {
30 }

Member Function Documentation

void C4UpperBoard::Draw ( C4Facet cgo)
protected

Definition at line 41 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().

42 {
43  if (!cgo.Surface) return;
44  // Background
46  // Logo
47  C4Facet cgo2;
48  float fLogoZoom = 1.0f;
49  cgo2.Set(cgo.Surface, (int32_t)(cgo.Wdt/2-(::GraphicsResource.fctLogo.Wdt/2)*fLogoZoom), 0,
50  (int32_t)(::GraphicsResource.fctLogo.Wdt*fLogoZoom), (int32_t)(::GraphicsResource.fctLogo.Hgt*fLogoZoom));
52  // Right text sections
53  int32_t iRightOff = 1;
54  // Playing time
55  pDraw->TextOut(cTimeString, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, C4GUI::GetScreenWdt() - (iRightOff++) * TextWidth - 10, TextYPosition, 0xFFFFFFFF);
56  // Clock
58  pDraw->TextOut(cTimeString2, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, C4GUI::GetScreenWdt() - (iRightOff++) * TextWidth - 30, TextYPosition, 0xFFFFFFFF);
59  // FPS
60  if (Config.General.FPS)
61  {
62  sprintf(cTimeString, "%d FPS", Game.FPS);
63  pDraw->TextOut(cTimeString, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, C4GUI::GetScreenWdt() - (iRightOff++) * TextWidth - 30, TextYPosition, 0xFFFFFFFF);
64  }
65  // Scenario title
67 }
const char * getData() const
Definition: StdBuf.h:450
C4Config Config
Definition: C4Config.cpp:837
int GetLineHeight() const
Definition: C4FontLoader.h:132
C4Game Game
Definition: C4Globals.cpp:52
int32_t FPS
Definition: C4Config.h:47
C4ConfigGeneral General
Definition: C4Config.h:252
#define sprintf
Definition: Standard.h:171
StdCopyStrBuf ScenarioTitle
Definition: C4Game.h:105
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:570
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:254
bool BlitSurfaceTile(C4Surface *sfcSurface, C4Surface *sfcTarget, float iToX, float iToY, float iToWdt, float iToHgt, float iOffsetX, float iOffsetY, C4ShaderCall *shader_call)
Definition: C4Draw.cpp:538
int32_t FPS
Definition: C4Game.h:113
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:45
C4Facet Output
Definition: C4UpperBoard.h:31
float Hgt
Definition: C4Facet.h:120
C4Surface * Surface
Definition: C4Facet.h:119
float Wdt
Definition: C4Facet.h:120
char cTimeString2[64]
Definition: C4UpperBoard.h:33
int32_t ShowClock
Definition: C4Config.h:103

Here is the call graph for this function:

Here is the caller graph for this function:

void C4UpperBoard::Execute ( )

Definition at line 32 of file C4UpperBoard.cpp.

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

Referenced by C4GraphicsSystem::Execute().

33 {
34  if (!Config.Graphics.UpperBoard) return;
35  // Make the time strings
36  sprintf(cTimeString,"%02d:%02d:%02d", Game.Time/3600,(Game.Time%3600)/60,Game.Time%60);
37  time_t t = time(0); strftime(cTimeString2, sizeof(cTimeString2), "[%H:%M:%S]", localtime(&t));
38  Draw(Output);
39 }
C4Config Config
Definition: C4Config.cpp:837
C4Game Game
Definition: C4Globals.cpp:52
#define sprintf
Definition: Standard.h:171
char cTimeString[64]
Definition: C4UpperBoard.h:32
int32_t UpperBoard
Definition: C4Config.h:102
C4ConfigGraphics Graphics
Definition: C4Config.h:254
int32_t Time
Definition: C4Game.h:133
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 69 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().

70 {
71  // Save facet
72  Output = cgo;
73  if (!::GraphicsResource.fctUpperBoard.Surface) return;
74  // in newgfx, the upperboard may be larger and overlap the scene
76  // Generate textposition
77  sprintf(cTimeString,"%02d:%02d:%02d", Game.Time/3600,(Game.Time%3600)/60,Game.Time%60);
80 }
int GetLineHeight() const
Definition: C4FontLoader.h:132
C4Game Game
Definition: C4Globals.cpp:52
#define sprintf
Definition: Standard.h:171
char cTimeString[64]
Definition: C4UpperBoard.h:32
int32_t GetTextWidth(const char *szText, bool fCheckMarkup=true)
Definition: C4FontLoader.h:147
C4GraphicsResource GraphicsResource
int32_t Time
Definition: C4Game.h:133
C4Facet Output
Definition: C4UpperBoard.h:31
float Hgt
Definition: C4Facet.h:120
C4Surface * Surface
Definition: C4Facet.h:119

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: