1 /*      _______   __   __   __   ______   __   __   _______   __   __
2  *     / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___  /\ /  |\/ /\
3  *    / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
4  *   / / /__   / / // / // / // / /    / ___  / // ___  / // /| ' / /
5  *  / /_// /\ / /_// / // / // /_/_   / / // / // /\_/ / // / |  / /
6  * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
7  * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
8  *
9  * Copyright (c) 2004, 2005, 2006, 2007 Olof Naess�n and Per Larsson
10  *
11  *                                                         Js_./
12  * Per Larsson a.k.a finalman                          _RqZ{a<^_aa
13  * Olof Naess�n a.k.a jansem/yakslem                _asww7!uY`>  )\a//
14  *                                                 _Qhm`] _f "'c  1!5m
15  * Visit: http://guichan.darkbits.org             )Qk<P ` _: :+' .'  "{[
16  *                                               .)j(] .d_/ '-(  P .   S
17  * License: (BSD)                                <Td/Z <fP"5(\"??"\a.  .L
18  * Redistribution and use in source and          _dV>ws?a-?'      ._/L  #'
19  * binary forms, with or without                 )4d[#7r, .   '     )d`)[
20  * modification, are permitted provided         _Q-5'5W..j/?'   -?!\)cam'
21  * that the following conditions are met:       j<<WP+k/);.        _W=j f
22  * 1. Redistributions of source code must       .$%w\/]Q  . ."'  .  mj$
23  *    retain the above copyright notice,        ]E.pYY(Q]>.   a     J@\
24  *    this list of conditions and the           j(]1u<sE"L,. .   ./^ ]{a
25  *    following disclaimer.                     4'_uomm\.  )L);-4     (3=
26  * 2. Redistributions in binary form must        )_]X{Z('a_"a7'<a"a,  ]"[
27  *    reproduce the above copyright notice,       #}<]m7`Za??4,P-"'7. ).m
28  *    this list of conditions and the            ]d2e)Q(<Q(  ?94   b-  LQ/
29  *    following disclaimer in the                <B!</]C)d_, '(<' .f. =C+m
30  *    documentation and/or other materials      .Z!=J ]e []('-4f _ ) -.)m]'
31  *    provided with the distribution.          .w[5]' _[ /.)_-"+?   _/ <W"
32  * 3. Neither the name of Guichan nor the      :$we` _! + _/ .        j?
33  *    names of its contributors may be used     =3)= _f  (_yQmWW$#(    "
34  *    to endorse or promote products derived     -   W,  sQQQQmZQ#Wwa]..
35  *    from this software without specific        (js, \[QQW$QWW#?!V"".
36  *    prior written permission.                    ]y:.<\..          .
37  *                                                 -]n w/ '         [.
38  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT       )/ )/           !
39  * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY         <  (; sac    ,    '
40  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING,               ]^ .-  %
41  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF            c <   r
42  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR            aga<  <La
43  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE          5%  )P'-3L
44  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR        _bQf` y`..)a
45  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,          ,J?4P'.P"_(\?d'.,
46  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES               _Pa,)!f/<[]/  ?"
47  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT      _2-..:. .r+_,.. .
48  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,     ?a.<%"'  " -'.a_ _,
49  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION)                     ^
50  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
51  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
52  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
53  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
54  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55  */
56 
57 /*
58  * For comments regarding functions please see the header file.
59  */
60 
61 #include "guichan/keyinput.hpp"
62 
63 namespace gcn
64 {
KeyInput(const Key & key,int type)65     KeyInput::KeyInput(const Key& key, int type)
66             :mKey(key),
67              mType(type),
68              mShiftPressed(false),
69              mControlPressed(false),
70              mAltPressed(false),
71              mMetaPressed(false),
72              mNumericPad(false)
73     {
74 
75     }
76 
setType(int type)77     void KeyInput::setType(int type)
78     {
79         mType = type;
80     }
81 
getType() const82     int KeyInput::getType() const
83     {
84         return mType;
85     }
86 
setKey(const Key & key)87     void KeyInput::setKey(const Key& key)
88     {
89         mKey = key;
90     }
91 
getKey() const92     const Key& KeyInput::getKey() const
93     {
94         return mKey;
95     }
96 
isShiftPressed() const97     bool KeyInput::isShiftPressed() const
98     {
99         return mShiftPressed;
100     }
101 
setShiftPressed(bool pressed)102     void KeyInput::setShiftPressed(bool pressed)
103     {
104         mShiftPressed = pressed;
105     }
106 
isControlPressed() const107     bool KeyInput::isControlPressed() const
108     {
109         return mControlPressed;
110     }
111 
setControlPressed(bool pressed)112     void KeyInput::setControlPressed(bool pressed)
113     {
114         mControlPressed = pressed;
115     }
116 
isAltPressed() const117     bool KeyInput::isAltPressed() const
118     {
119         return mAltPressed;
120     }
121 
setAltPressed(bool pressed)122     void KeyInput::setAltPressed(bool pressed)
123     {
124         mAltPressed = pressed;
125     }
126 
isMetaPressed() const127     bool KeyInput::isMetaPressed() const
128     {
129         return mMetaPressed;
130     }
131 
setMetaPressed(bool pressed)132     void KeyInput::setMetaPressed(bool pressed)
133     {
134         mMetaPressed = pressed;
135     }
136 
isNumericPad() const137     bool KeyInput::isNumericPad() const
138     {
139         return mNumericPad;
140     }
141 
setNumericPad(bool numpad)142     void KeyInput::setNumericPad(bool numpad)
143     {
144         mNumericPad = numpad;
145     }
146 }
147 
148