Commit | Line | Data |
---|---|---|
8f8b6693 PG |
1 | /* |
2 | * Copyright (C) 2008 Patrik Gornicz, Gornicz_P (at) hotmail (dot) com. | |
3 | * | |
4 | * This program 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 | * | |
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 | ||
b1d92c2f | 18 | #include "config.h" |
f32a9b7c PG |
19 | |
20 | #include <pg/debug.h> | |
87c9b12f | 21 | |
b552aa3b PG |
22 | #include <SDL/SDL.h> |
23 | #include "keys.h" | |
24 | ||
87c9b12f | 25 | #include "reader.h" |
3d1f0813 | 26 | #include "input/inputManager.h" |
8f8b6693 PG |
27 | |
28 | /// ***** Private Method Headers ***** | |
29 | /// ***** Private Variables ***** | |
30 | ||
2b8199e7 PG |
31 | bool fPaused = false; |
32 | ||
33 | bool fEndGame = false; | |
34 | ||
35 | bool fWellFollow= false; | |
36 | bool fWellOn = false; | |
37 | bool fWellOff = false; | |
38 | ||
39 | bool fShowFPS = true; | |
40 | bool fShowUPS = true; | |
c46074c1 | 41 | |
8f8b6693 PG |
42 | /// ***** Initializers/Cleaners ***** |
43 | ||
b1d92c2f PG |
44 | void cfg::init() |
45 | { | |
338e728a PG |
46 | key::init(); |
47 | readConfigs(); | |
b552aa3b | 48 | |
b1d92c2f PG |
49 | // TODO read in config files |
50 | } | |
51 | void cfg::clean() | |
52 | { | |
53 | // TODO save to config files? | |
54 | } | |
55 | ||
8f8b6693 PG |
56 | /// ***** Public Methods ***** |
57 | ||
2b8199e7 PG |
58 | void cfg::handleInput() |
59 | { | |
60 | fPaused = input::wasPressed (key::pause) ? !fPaused : fPaused; | |
61 | ||
62 | fEndGame = input::wasReleased(key::end); | |
63 | ||
64 | fWellFollow = input::isPressed (key::follow); | |
65 | fWellOn = input::wasPressed (key::well); | |
66 | fWellOff = input::wasReleased(key::well); | |
67 | } | |
68 | ||
c46074c1 | 69 | bool cfg::paused() |
8f8b6693 | 70 | { |
c46074c1 | 71 | return fPaused; |
8f8b6693 PG |
72 | } |
73 | ||
b1d92c2f PG |
74 | bool cfg::endGame() |
75 | { | |
2b8199e7 | 76 | return fEndGame; |
b1d92c2f PG |
77 | } |
78 | ||
f103ba70 PG |
79 | bool cfg::mouseWellFollow() |
80 | { | |
2b8199e7 | 81 | return fWellFollow; |
f103ba70 | 82 | } |
a860c0c7 PG |
83 | bool cfg::mouseWellOn() |
84 | { | |
2b8199e7 | 85 | return fWellOn; |
f103ba70 PG |
86 | } |
87 | bool cfg::mouseWellOff() | |
88 | { | |
2b8199e7 | 89 | return fWellOff; |
a860c0c7 PG |
90 | } |
91 | ||
c46074c1 PG |
92 | bool cfg::showFPS() |
93 | { | |
2b8199e7 | 94 | return fShowFPS; |
c46074c1 PG |
95 | } |
96 | bool cfg::showUPS() | |
97 | { | |
2b8199e7 | 98 | return fShowUPS; |
c46074c1 PG |
99 | } |
100 | ||
8f8b6693 | 101 | /// ***** Private Methods ***** |