added using namespace pg to relavent files ... will remove at some point
[physics.git] / src / config / config.cpp
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
18 #include "config.h"
19
20 #include <pg/debug.h>
21 using namespace pg;
22
23 #include <SDL/SDL.h>
24 #include "keys.h"
25
26 #include "reader.h"
27 #include "input/inputManager.h"
28
29 /// ***** Private Method Headers *****
30 /// ***** Private Variables *****
31
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;
42
43 /// ***** Initializers/Cleaners *****
44
45 void cfg::init()
46 {
47     key::init();
48     readConfigs();
49
50     // TODO read in config files
51 }
52 void cfg::clean()
53 {
54     // TODO save to config files?
55 }
56
57 /// ***** Public Methods *****
58
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
70 bool cfg::paused()
71 {
72     return fPaused;
73 }
74
75 bool cfg::endGame()
76 {
77     return fEndGame;
78 }
79
80 bool cfg::mouseWellFollow()
81 {
82     return fWellFollow;
83 }
84 bool cfg::mouseWellOn()
85 {
86     return fWellOn;
87 }
88 bool cfg::mouseWellOff()
89 {
90     return fWellOff;
91 }
92
93 bool cfg::showFPS()
94 {
95     return fShowFPS;
96 }
97 bool cfg::showUPS()
98 {
99     return fShowUPS;
100 }
101
102 /// ***** Private Methods *****