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

kgoldrunner

  • sources
  • kde-4.14
  • kdegames
  • kgoldrunner
  • src
kgrtimer.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright 2009 Ian Wadham <iandw.au@gmail.com> *
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 <QTime>
22 #include <QTimer>
23 #include <QList>
24 
25 class KGrTimer : public QObject
26 {
27  Q_OBJECT
28 public:
29  explicit KGrTimer (QObject * parent, int pTick = 20, float pScale = 1.0);
30  ~KGrTimer();
31 
32  void pause();
33  void resume();
34  void step();
35  inline void setScale (const float pScale)
36  { scaledTime = (pScale * tickTime) + 0.5; }
37 
38 signals:
57  void tick (bool missed, int pScaledTime);
58 
59 private slots:
60  void internalSlot();
61 
62 private:
63  QTime t;
64  QTimer * ticker;
65  int tickTime;
66  int scaledTime;
67  int tickCount;
68  int halfTick;
69  int expectedTime;
70 };
71 
72 #endif // KGRTIMER_H
KGrTimer::setScale
void setScale(const float pScale)
Definition: kgrtimer.h:35
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:55
KGrTimer::resume
void resume()
Definition: kgrtimer.cpp:48
QTime
QTimer
QObject
KGrTimer::~KGrTimer
~KGrTimer()
Definition: kgrtimer.cpp:38
KGrTimer
Definition: kgrtimer.h:25
KGrTimer::pause
void pause()
Definition: kgrtimer.cpp:43
QObject::parent
QObject * parent() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:24 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