_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

sdlinput.h
Go to the documentation of this file.
1 /* _______ __ __ __ ______ __ __ _______ __ __
2  * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
3  * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
4  * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
5  * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
6  * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
7  * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
8  *
9  * Copyright (c) 2004, 2005 darkbits Js_./
10  * Per Larsson a.k.a finalman _RqZ{a<^_aa
11  * Olof Naess�n a.k.a jansem/yakslem _asww7!uY`> )\a//
12  * _Qhm`] _f "'c 1!5m
13  * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[
14  * .)j(] .d_/ '-( P . S
15  * License: (BSD) <Td/Z <fP"5(\"??"\a. .L
16  * Redistribution and use in source and _dV>ws?a-?' ._/L #'
17  * binary forms, with or without )4d[#7r, . ' )d`)[
18  * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam'
19  * that the following conditions are met: j<<WP+k/);. _W=j f
20  * 1. Redistributions of source code must .$%w\/]Q . ."' . mj$
21  * retain the above copyright notice, ]E.pYY(Q]>. a J@\
22  * this list of conditions and the j(]1u<sE"L,. . ./^ ]{a
23  * following disclaimer. 4'_uomm\. )L);-4 (3=
24  * 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[
25  * reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m
26  * this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/
27  * following disclaimer in the <B!</]C)d_, '(<' .f. =C+m
28  * documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]'
29  * provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W"
30  * 3. Neither the name of Guichan nor the :$we` _! + _/ . j?
31  * names of its contributors may be used =3)= _f (_yQmWW$#( "
32  * to endorse or promote products derived - W, sQQQQmZQ#Wwa]..
33  * from this software without specific (js, \[QQW$QWW#?!V"".
34  * prior written permission. ]y:.<\.. .
35  * -]n w/ ' [.
36  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ !
37  * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , '
38  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- %
39  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r
40  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
41  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
42  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
43  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
44  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
45  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
46  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
47  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ^
48  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
49  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
50  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
51  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
52  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53  */
54 
55 #ifndef GCN_SDLINPUT_HPP
56 #define GCN_SDLINPUT_HPP
57 
58 #include <queue>
59 
60 #include "SDL.h"
61 
62 #include "guichan/input.h"
63 #include "guichan/key.h"
64 #include "guichan/keyinput.h"
65 #include "guichan/mouseinput.h"
66 #include "guichan/platform.h"
67 
68 namespace gcn
69 {
74  {
75  public:
76 
80  SDLInput();
81 
88  virtual void pushInput(SDL_Event event);
89 
95  virtual void _pollInput() { }
96 
97 
98  // Inherited from Input
99 
100  virtual bool isKeyQueueEmpty();
101 
102  virtual KeyInput dequeueKeyInput();
103 
104  virtual bool isMouseQueueEmpty();
105 
106  virtual MouseInput dequeueMouseInput();
107 
108  virtual void processKeyRepeat();
109 
116  static Key convertKeyCharacter(SDL_Keysym key);
117 
118  protected:
126  int convertMouseButton(int button);
127 
128  std::queue<KeyInput> mKeyInputQueue;
129  std::queue<MouseInput> mMouseInputQueue;
130 
135  };
136 }
137 
138 #endif // end GCN_SDLINPUT_HPP
mouseinput.h
keyinput.h
GCN_EXTENSION_DECLSPEC
#define GCN_EXTENSION_DECLSPEC
Definition: platform.h:63
event
HANDLE event
Definition: midiplayer.c:31
gcn::KeyInput
Definition: keyinput.h:67
gcn::SDLInput::_pollInput
virtual void _pollInput()
Definition: sdlinput.h:95
gcn
Definition: cliprectangle.cpp:61
gcn::SDLInput::mIsRepeating
bool mIsRepeating
Definition: sdlinput.h:134
gcn::SDLInput::mKeyInputQueue
std::queue< KeyInput > mKeyInputQueue
Definition: sdlinput.h:128
gcn::Input
Definition: input.h:71
platform.h
gcn::SDLInput::mMouseInWindow
bool mMouseInWindow
Definition: sdlinput.h:132
key.h
gcn::Key
Definition: key.h:67
gcn::SDLInput::mMouseInputQueue
std::queue< MouseInput > mMouseInputQueue
Definition: sdlinput.h:129
gcn::SDLInput::mLastKey
Key mLastKey
Definition: sdlinput.h:133
gcn::SDLInput
Definition: sdlinput.h:73
gcn::SDLInput::mMouseDown
bool mMouseDown
Definition: sdlinput.h:131
gcn::MouseInput
Definition: mouseinput.h:67
input.h
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.