• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegames API Reference
  • KDE Home
  • Contact Us
 

kgoldrunner

  • kde-4.x
  • kdegames
  • kgoldrunner
  • src
kgrtimer.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright 2009 Ian Wadham <[email protected]> *
3  * *
4  * This program is free software; you can redistribute it and/or *
5  * modify it under the terms of the GNU General Public License as *
6  * published by the Free Software Foundation; either version 2 of *
7  * the License, or (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
16  ****************************************************************************/
17 
18 #ifndef KGRTIMER_H
19 #define KGRTIMER_H
20 
21 #include <QElapsedTimer>
22 #include <QTimer>
23 
24 class KGrTimer : public QObject
25 {
26  Q_OBJECT
27 public:
28  explicit KGrTimer (QObject * parent, int pTick = 20, float pScale = 1.0);
29  ~KGrTimer();
30 
31  void pause();
32  void resume();
33  void step();
34  inline void setScale (const float pScale)
35  { scaledTime = (pScale * tickTime) + 0.5; }
36 
37 Q_SIGNALS:
56  void tick (bool missed, int pScaledTime);
57 
58 private Q_SLOTS:
59  void internalSlot();
60 
61 private:
62  QElapsedTimer t;
63  QTimer * ticker;
64  int tickTime;
65  int scaledTime;
66  int tickCount;
67  int halfTick;
68  int expectedTime;
69 };
70 
71 #endif // KGRTIMER_H
KGrTimer::setScale
void setScale(const float pScale)
Definition: kgrtimer.h:34
KGrTimer::tick
void tick(bool missed, int pScaledTime)
This signal powers the whole game.
KGrTimer::KGrTimer
KGrTimer(QObject *parent, int pTick=20, float pScale=1.0)
Definition: kgrtimer.cpp:22
KGrTimer::step
void step()
Definition: kgrtimer.cpp:54
KGrTimer::resume
void resume()
Definition: kgrtimer.cpp:47
QTimer
QObject
KGrTimer::~KGrTimer
~KGrTimer()
Definition: kgrtimer.cpp:37
KGrTimer
Definition: kgrtimer.h:24
QElapsedTimer
KGrTimer::pause
void pause()
Definition: kgrtimer.cpp:42
QObject::parent
QObject * parent() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2019 The KDE developers.
Generated on Thu Dec 12 2019 01:59:52 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kgoldrunner

Skip menu "kgoldrunner"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal