OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4UpperBoard.cpp
Go to the documentation of this file.
1 /*
2  * OpenClonk, http://www.openclonk.org
3  *
4  * Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/
5  * Copyright (c) 2009-2016, The OpenClonk Team and contributors
6  *
7  * Distributed under the terms of the ISC license; see accompanying file
8  * "COPYING" for details.
9  *
10  * "Clonk" is a registered trademark of Matthes Bender, used with permission.
11  * See accompanying file "TRADEMARK" for details.
12  *
13  * To redistribute this file separately, substitute the full license texts
14  * for the above references.
15  */
16 #include "C4Include.h"
17 #include "gui/C4UpperBoard.h"
18 
19 #include "game/C4Game.h"
20 #include "config/C4Config.h"
22 #include "graphics/C4Draw.h"
23 
25 {
26 }
27 
29 {
30 }
31 
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 }
40 
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 }
68 
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 }
const char * getData() const
Definition: StdBuf.h:450
C4Config Config
Definition: C4Config.cpp:831
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
int32_t GetTextWidth(const char *szText, bool fCheckMarkup=true)
Definition: C4FontLoader.h:147
void Set(C4Surface &rSfc)
Definition: C4Facet.cpp:459
C4GraphicsResource GraphicsResource
int32_t UpperBoard
Definition: C4Config.h:102
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
int32_t Time
Definition: C4Game.h:133
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
void Init(C4Facet &cgo)
C4Facet Output
Definition: C4UpperBoard.h:31
float Hgt
Definition: C4Facet.h:120
void Draw(C4Facet &cgo)
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