3 * Daniel Nelson - 8/25/0
5 * Copyright (C) 2000 Daniel Nelson
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 * Daniel Nelson - aluminumangel.org
25 * Keeps track of the button pressing.
34 #include "Controller.h"
35 #include "MetaState.h"
39 #include "Displayer.h"
44 int Controller::state
;
46 void Controller::gameStart ( )
51 void Controller::keyboardPlay ( unsigned char key
, int x
, int y
)
54 case GC_LEFT_KEY
: case (GC_LEFT_KEY
- 32):
57 case GC_RIGHT_KEY
: case (GC_RIGHT_KEY
- 32):
60 case GC_UP_KEY
: case (GC_UP_KEY
- 32):
63 case GC_DOWN_KEY
: case (GC_DOWN_KEY
- 32):
66 case GC_SWAP_KEY
: case (GC_SWAP_KEY
- 32): case ' ':
69 case GC_ADVANCE_KEY
: case (GC_ADVANCE_KEY
- 32): case '\r':
72 case GC_PAUSE_KEY
: case (GC_PAUSE_KEY
- 32):
82 Displayer::screenShot();
91 void Controller::keyboardUpPlay ( unsigned char key
, int x
, int y
)
94 case GC_LEFT_KEY
: case (GC_LEFT_KEY
- 32):
97 case GC_RIGHT_KEY
: case (GC_RIGHT_KEY
- 32):
100 case GC_UP_KEY
: case (GC_UP_KEY
- 32):
103 case GC_DOWN_KEY
: case (GC_DOWN_KEY
- 32):
106 case GC_SWAP_KEY
: case (GC_SWAP_KEY
- 32): case ' ':
109 case GC_ADVANCE_KEY
: case (GC_ADVANCE_KEY
- 32): case '\r':
110 state
&= ~CC_ADVANCE
;
112 case GC_PAUSE_KEY
: case (GC_PAUSE_KEY
- 32):
118 void Controller::specialPlay ( int key
, int x
, int y
)
136 void Controller::specialUpPlay ( int key
, int x
, int y
)
154 void Controller::keyboardMeta ( unsigned char key
, int x
, int y
)
157 if (key
== '.') Displayer::screenShot();
159 MetaState::localKeyPressed(key
== 27);
162 void Controller::keyboardUpMeta ( unsigned char key
, int x
, int y
)
166 void Controller::specialMeta ( int key
, int x
, int y
)
168 if (MetaState::mode
* CM_SOLO
)
177 MetaState::localKeyPressed(false);
181 MetaState::localKeyPressed(false);
184 void Controller::specialUpMeta ( int key
, int x
, int y
)
186 assert(MetaState::mode
& CM_SOLO
);
198 void Controller::entry ( int mouse_state
)
200 if (mouse_state
== GLUT_LEFT
)