Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
in_main.cpp
Go to the documentation of this file.
1 /*
2  * Vega Strike
3  * Copyright (C) 2001-2002 Daniel Horn
4  *
5  * http://vegastrike.sourceforge.net/
6  *
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.
11  *
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.
16  *
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.
20  */
21 #include <queue>
22 #include <list>
23 using std::queue;
24 using std::list;
25 
26 #include "in_kb.h"
27 #include "in_mouse.h"
28 #include "in_joystick.h"
29 #include "in_handler.h"
30 
32 
33 queue< InputListener* >activationreqqueue;
34 list< InputListener* > listeners;
36 
38 {
39  il->keystate = keyState;
40  il->mousex = &mousex;
41  il->mousey = &mousey;
42  listeners.push_back( il );
43 }
44 
46 {
47  activationreqqueue.push( il );
48 }
49 
51 {
52  listeners.remove( il );
53 }
54 
55 void ProcessInput( size_t whichplayer )
56 {
57  ProcessKB( whichplayer );
58  ProcessMouse();
59  for (int i = 0; i < MAX_JOYSTICKS; i++)
60  if (joystick[i]->player == whichplayer)
61  ProcessJoystick( i );
62 }
63 
64 void InitInput()
65 {
66  InitKB();
67  InitMouse();
68  InitJoystick();
69 }
71 {
73 }
74