Debian Codegraph @

src/game/difficultyprofile.hpp

raw symbols SCIP
1 // This file is part of Dust Racing 2D.
2 // Copyright (C) 2015 Jussi Lind <[email protected]>
3 //
4 // Dust Racing 2D is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 // Dust Racing 2D is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with Dust Racing 2D. If not, see <http://www.gnu.org/licenses/>.
15
16 #ifndef DIFFICULTYPROFILE_HPP
17 #define DIFFICULTYPROFILE_HPP
18
19 #include <QObject>
20
21 /** A singleton class that stores configurations
22 * for different difficulty levels. */
23 class DifficultyProfile : public QObject
24 {
25 Q_OBJECT
26
27 public:
28 enum class Difficulty
29 {
30 Easy = 0,
31 Medium,
32 Hard
33 };
34
35 /*! Constructor.
36 * \param difficulty The active difficulty setting. */
37 DifficultyProfile(Difficulty difficulty);
38
39 //! Destructor.
40 ~DifficultyProfile();
41
42 //! \return The singleton.
43 static DifficultyProfile & instance();
44
45 //! Set the active difficulty.
46 void setDifficulty(Difficulty difficulty);
47
48 //! \return the active difficulty.
49 Difficulty difficulty() const;
50
51 //! \return if tires are allowed to wear out.
52 bool hasTireWearOut() const;
53
54 //! \return if body damage is allowed.
55 bool hasBodyDamage() const;
56
57 float accelerationFrictionMultiplier(bool isHuman) const;
58
59 signals:
60
61 void difficultyChanged();
62
63 private:
64 DifficultyProfile(DifficultyProfile & other) = delete;
65
66 DifficultyProfile & operator=(DifficultyProfile & other) = delete;
67
68 static DifficultyProfile * m_instance;
69
70 Difficulty m_difficulty;
71 };
72
73 #endif // DIFFICULTYPROFILE_HPP