KDEGames

kgamedifficulty.h
1 /*
2 Copyright (c) 2007, Nicolas Roffet, <[email protected]>
3 Copyright (c) 2007, Pino Toscano, <[email protected]>
4 
5 This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
6 
7 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.
8 
9 You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
10 */
11 
12 #ifndef KGAMEDIFFICULTY_H
13 #define KGAMEDIFFICULTY_H
14 
15 
16 
17 class QObject;
18 
19 
20 class KGameDifficultyPrivate;
21 class KXmlGuiWindow;
22 #include <QMap>
23 #include <QPair>
24 #include "libkdegamesprivate_export.h"
25 
26 
27 
78 class KDEGAMESPRIVATE_EXPORT KGameDifficulty
79 {
80  public:
86  enum onChange {
88  NoRestartOnChange
89  };
90 
97  RidiculouslyEasy = 10,
98  VeryEasy = 20,
99  Easy = 30,
100  Medium = 40,
101  Hard = 50,
102  VeryHard = 60,
103  ExtremelyHard = 70,
104  Impossible = 80,
105  Configurable = 90,
106  Custom = 100,
107  NoLevel = 110
108  };
109 
110 
114  virtual ~KGameDifficulty();
115 
126  static void init(KXmlGuiWindow* window, const QObject *recvr, const char* slotStandard, const char* slotCustom = nullptr);
127 
134  static void setRestartOnChange(onChange restart);
135 
143  static void addStandardLevel(standardLevel level);
144 
150  static void removeStandardLevel(standardLevel level);
151 
160  static void addCustomLevel(int key, const QString& appellation);
161 
167  static void removeCustomLevel(int key);
168 
176  static void setEnabled(bool enabled);
177 
183  static void setLevel(standardLevel level);
184 
190  static standardLevel level();
194  static QString levelString();
198  static QPair<QByteArray, QString> localizedLevelString();
202  static QMap<QByteArray, QString> localizedLevelStrings();
207  static QMap<int, QByteArray> levelWeights();
214  static void setLevelCustom(int key);
215 
222  static int levelCustom();
223 
231  static void setRunning(bool running);
232 
233 
234  private:
238  KGameDifficulty();
245  static KGameDifficulty* self();
246 
247  static KGameDifficulty* instance;
248  friend class KGameDifficultyPrivate;
249  KGameDifficultyPrivate* const d;
250 
251  Q_DISABLE_COPY(KGameDifficulty)
252 };
253 
254 #endif //KGAMEDIFFICULTY_H
KGameDifficuty manages the game difficulty levels in a standard way.
onChange
Behavior on change.
QCA_EXPORT void init()
standardLevel
Standard difficulty levels.
The current game has to be canceled and a new game will be started on change.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Nov 30 2020 22:37:54 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.