changed src so the libpg headers are now used
[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
22 #include <SDL/SDL.h>
23 #include "keys.h"
24
25 #include "reader.h"
26 #include "input/inputManager.h"
27
28 /// ***** Private Method Headers *****
29 /// ***** Private Variables *****
30
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;
41
42 /// ***** Initializers/Cleaners *****
43
44 void cfg::init()
45 {
46     key::init();
47     readConfigs();
48
49     // TODO read in config files
50 }
51 void cfg::clean()
52 {
53     // TODO save to config files?
54 }
55
56 /// ***** Public Methods *****
57
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
69 bool cfg::paused()
70 {
71     return fPaused;
72 }
73
74 bool cfg::endGame()
75 {
76     return fEndGame;
77 }
78
79 bool cfg::mouseWellFollow()
80 {
81     return fWellFollow;
82 }
83 bool cfg::mouseWellOn()
84 {
85     return fWellOn;
86 }
87 bool cfg::mouseWellOff()
88 {
89     return fWellOff;
90 }
91
92 bool cfg::showFPS()
93 {
94     return fShowFPS;
95 }
96 bool cfg::showUPS()
97 {
98     return fShowUPS;
99 }
100
101 /// ***** Private Methods *****