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