OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
FpsCounter.h
1 /*
2  * Copyright 2010-2014 OpenXcom Developers.
3  *
4  * This file is part of OpenXcom.
5  *
6  * OpenXcom is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * OpenXcom is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef OPENXCOM_FPSCOUNTER_H
21 #define OPENXCOM_FPSCOUNTER_H
22 
23 #include "../Engine/Surface.h"
24 
25 namespace OpenXcom
26 {
27 
28 class NumberText;
29 class Timer;
30 class Action;
31 
36 class FpsCounter : public Surface
37 {
38 private:
39  NumberText *_text;
40  Timer *_timer;
41  int _frames;
42 public:
44  FpsCounter(int width, int height, int x, int y);
46  ~FpsCounter();
48  void setPalette(SDL_Color *colors, int firstcolor = 0, int ncolors = 256);
50  void setColor(Uint8 color);
52  void handle(Action *action);
54  void think();
55  // Updates FPS counter.
56  void update();
58  void draw();
59  void addFrame();
60 };
61 
62 }
63 
64 #endif
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:34
void setColor(Uint8 color)
Sets the FpsCounter's color.
Definition: FpsCounter.cpp:75
~FpsCounter()
Cleans up all the FPS counter resources.
Definition: FpsCounter.cpp:53
Timer used to run code in fixed intervals.
Definition: Timer.h:37
void draw()
Draws the FPS counter.
Definition: FpsCounter.cpp:115
void setPalette(SDL_Color *colors, int firstcolor=0, int ncolors=256)
Sets the FPS counter's palette.
Definition: FpsCounter.cpp:65
void handle(Action *action)
Handles keyboard events.
Definition: FpsCounter.cpp:84
void think()
Advances frame counter.
Definition: FpsCounter.cpp:96
Element that is blit (rendered) onto the screen.
Definition: Surface.h:39
void update()
Updates the amount of Frames per Second.
Definition: FpsCounter.cpp:104
Counts the amount of frames each second and displays them in a NumberText surface.
Definition: FpsCounter.h:36
Number digits displayed on the screen.
Definition: NumberText.h:31
FpsCounter(int width, int height, int x, int y)
Creates a new FPS counter linked to a game.
Definition: FpsCounter.cpp:38