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