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.
37 #include "Controller.h"
38 #include "MetaState.h"
42 #include "Displayer.h"
47 int Controller::state
;
49 void Controller::gameStart ( )
54 void Controller::keyboardPlay ( unsigned char key
, int x
, int y
)
57 case GC_LEFT_KEY
: case (GC_LEFT_KEY
- 32):
60 case GC_RIGHT_KEY
: case (GC_RIGHT_KEY
- 32):
63 case GC_UP_KEY
: case (GC_UP_KEY
- 32):
66 case GC_DOWN_KEY
: case (GC_DOWN_KEY
- 32):
69 case GC_SWAP_KEY
: case (GC_SWAP_KEY
- 32): case ' ':
72 case GC_ADVANCE_KEY
: case (GC_ADVANCE_KEY
- 32): case '\r':
75 case GC_PAUSE_KEY
: case (GC_PAUSE_KEY
- 32):
85 Displayer::screenShot();
94 void Controller::keyboardUpPlay ( unsigned char key
, int x
, int y
)
97 case GC_LEFT_KEY
: case (GC_LEFT_KEY
- 32):
100 case GC_RIGHT_KEY
: case (GC_RIGHT_KEY
- 32):
103 case GC_UP_KEY
: case (GC_UP_KEY
- 32):
106 case GC_DOWN_KEY
: case (GC_DOWN_KEY
- 32):
109 case GC_SWAP_KEY
: case (GC_SWAP_KEY
- 32): case ' ':
112 case GC_ADVANCE_KEY
: case (GC_ADVANCE_KEY
- 32): case '\r':
113 state
&= ~CC_ADVANCE
;
115 case GC_PAUSE_KEY
: case (GC_PAUSE_KEY
- 32):
121 void Controller::specialPlay ( int key
, int x
, int y
)
139 void Controller::specialUpPlay ( int key
, int x
, int y
)
157 void Controller::keyboardMeta ( unsigned char key
, int x
, int y
)
160 if (key
== '.') Displayer::screenShot();
162 MetaState::localKeyPressed(key
== 27);
165 void Controller::keyboardUpMeta ( unsigned char key
, int x
, int y
)
169 void Controller::specialMeta ( int key
, int x
, int y
)
171 if (MetaState::mode
* CM_SOLO
)
180 MetaState::localKeyPressed(false);
184 MetaState::localKeyPressed(false);
187 void Controller::specialUpMeta ( int key
, int x
, int y
)
189 assert(MetaState::mode
& CM_SOLO
);
201 void Controller::entry ( int mouse_state
)
203 if (mouse_state
== GLUT_LEFT
)