1 | <html> |
---|
2 | <head> |
---|
3 | <title>OgreSDLInput.h Source File - OGRE Documentation</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
4 | <link type="text/css" rel="stylesheet" href="style.css"> |
---|
5 | </head> |
---|
6 | |
---|
7 | <body> |
---|
8 | <!-- Generated by Doxygen 1.3.6 --> |
---|
9 | <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div> |
---|
10 | <h1>OgreSDLInput.h</h1><a href="OgreSDLInput_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span> |
---|
11 | 00002 <span class="comment">-----------------------------------------------------------------------------</span> |
---|
12 | 00003 <span class="comment">This source file is part of OGRE</span> |
---|
13 | 00004 <span class="comment"> (Object-oriented Graphics Rendering Engine)</span> |
---|
14 | 00005 <span class="comment">For the latest info, see http://www.ogre3d.org/</span> |
---|
15 | 00006 <span class="comment"></span> |
---|
16 | 00007 <span class="comment">Copyright (c) 2000-2005 The OGRE Team</span> |
---|
17 | 00008 <span class="comment">Also see acknowledgements in Readme.html</span> |
---|
18 | 00009 <span class="comment"></span> |
---|
19 | 00010 <span class="comment">This program is free software; you can redistribute it and/or modify it under</span> |
---|
20 | 00011 <span class="comment">the terms of the GNU Lesser General Public License as published by the Free Software</span> |
---|
21 | 00012 <span class="comment">Foundation; either version 2 of the License, or (at your option) any later</span> |
---|
22 | 00013 <span class="comment">version.</span> |
---|
23 | 00014 <span class="comment"></span> |
---|
24 | 00015 <span class="comment">This program is distributed in the hope that it will be useful, but WITHOUT</span> |
---|
25 | 00016 <span class="comment">ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS</span> |
---|
26 | 00017 <span class="comment">FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.</span> |
---|
27 | 00018 <span class="comment"></span> |
---|
28 | 00019 <span class="comment">You should have received a copy of the GNU Lesser General Public License along with</span> |
---|
29 | 00020 <span class="comment">this program; if not, write to the Free Software Foundation, Inc., 59 Temple</span> |
---|
30 | 00021 <span class="comment">Place - Suite 330, Boston, MA 02111-1307, USA, or go to</span> |
---|
31 | 00022 <span class="comment">http://www.gnu.org/copyleft/lesser.txt.</span> |
---|
32 | 00023 <span class="comment">-----------------------------------------------------------------------------</span> |
---|
33 | 00024 <span class="comment">*/</span> |
---|
34 | 00025 |
---|
35 | 00026 |
---|
36 | 00027 <span class="preprocessor">#ifndef __SDLInputReader_H__</span> |
---|
37 | 00028 <span class="preprocessor"></span><span class="preprocessor">#define __SDLInputReader_H__</span> |
---|
38 | 00029 <span class="preprocessor"></span> |
---|
39 | 00030 <span class="preprocessor">#include "<a class="code" href="OgreInput_8h.html">OgreInput.h</a>"</span> |
---|
40 | 00031 <span class="preprocessor">#include "<a class="code" href="OgreInputEvent_8h.html">OgreInputEvent.h</a>"</span> |
---|
41 | 00032 <span class="preprocessor">#include "<a class="code" href="OgreRenderWindow_8h.html">OgreRenderWindow.h</a>"</span> |
---|
42 | 00033 |
---|
43 | 00034 <span class="preprocessor">#include <map></span> |
---|
44 | 00035 |
---|
45 | 00036 <span class="preprocessor">#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE</span> |
---|
46 | 00037 <span class="preprocessor"></span><span class="preprocessor"># include <SDL/sdl.h></span> |
---|
47 | 00038 <span class="preprocessor">#else</span> |
---|
48 | 00039 <span class="preprocessor"></span><span class="preprocessor"># include <SDL.h></span> |
---|
49 | 00040 <span class="preprocessor">#endif</span> |
---|
50 | 00041 <span class="preprocessor"></span> |
---|
51 | 00042 <span class="keyword">namespace </span>Ogre { |
---|
52 | <a name="l00043"></a><a class="code" href="namespaceOgre.html#a687">00043</a> <span class="keyword">enum</span> <a class="code" href="namespaceOgre.html#a687">GrabMode</a> |
---|
53 | 00044 { |
---|
54 | 00045 <a class="code" href="namespaceOgre.html#a687a599">GRAB_NONE</a>, |
---|
55 | 00046 <a class="code" href="namespaceOgre.html#a687a600">GRAB_MOUSE_OVER</a>, |
---|
56 | 00047 <a class="code" href="namespaceOgre.html#a687a601">GRAB_MOUSE_CLICK</a> <span class="comment">// this is the default</span> |
---|
57 | 00048 }; |
---|
58 | 00049 |
---|
59 | <a name="l00050"></a><a class="code" href="classOgre_1_1SDLInput.html">00050</a> <span class="keyword">class </span><a class="code" href="classOgre_1_1SDLInput.html">SDLInput</a> : <span class="keyword">public</span> <a class="code" href="classOgre_1_1InputReader.html">InputReader</a> |
---|
60 | 00051 { |
---|
61 | 00052 <span class="keyword">public</span>: |
---|
62 | 00053 <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputa0">SDLInput</a>(); |
---|
63 | 00054 <span class="keyword">virtual</span> <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputa1">~SDLInput</a>(); |
---|
64 | 00055 |
---|
65 | 00056 <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputa2">initialise</a>( <a class="code" href="classOgre_1_1RenderWindow.html">RenderWindow</a>* pWindow, <span class="keywordtype">bool</span> useKeyboard = <span class="keyword">true</span>, <span class="keywordtype">bool</span> useMouse = <span class="keyword">true</span>, <span class="keywordtype">bool</span> useGameController = <span class="keyword">false</span> ); |
---|
66 | 00057 <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputa3">capture</a>(); |
---|
67 | 00058 |
---|
68 | <a name="l00064"></a><a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputa4">00064</a> <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputa4">setGrabMode</a>( GrabMode mode ) { <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr13">mGrabMode</a> = mode; } |
---|
69 | 00065 |
---|
70 | 00066 <span class="comment">/*</span> |
---|
71 | 00067 <span class="comment"> * Mouse getters</span> |
---|
72 | 00068 <span class="comment"> */</span> |
---|
73 | 00069 <span class="keyword">virtual</span> <span class="keywordtype">long</span> <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputa5">getMouseRelX</a>() <span class="keyword">const</span>; |
---|
74 | 00070 <span class="keyword">virtual</span> <span class="keywordtype">long</span> <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputa6">getMouseRelY</a>() <span class="keyword">const</span>; |
---|
75 | 00071 <span class="keyword">virtual</span> <span class="keywordtype">long</span> <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputa7">getMouseRelZ</a>() <span class="keyword">const</span>; |
---|
76 | 00072 |
---|
77 | 00073 <span class="keyword">virtual</span> <span class="keywordtype">long</span> <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputa8">getMouseAbsX</a>() <span class="keyword">const</span>; |
---|
78 | 00074 <span class="keyword">virtual</span> <span class="keywordtype">long</span> <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputa9">getMouseAbsY</a>() <span class="keyword">const</span>; |
---|
79 | 00075 <span class="keyword">virtual</span> <span class="keywordtype">long</span> <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputa10">getMouseAbsZ</a>() <span class="keyword">const</span>; |
---|
80 | 00076 |
---|
81 | 00077 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputa11">getMouseState</a>( <a class="code" href="structOgre_1_1MouseState.html">MouseState</a>& state ) <span class="keyword">const</span>; |
---|
82 | 00078 |
---|
83 | 00079 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputa12">getMouseButton</a>( <a class="code" href="namespaceOgre.html#a466">uchar</a> button ) <span class="keyword">const</span>; |
---|
84 | 00080 |
---|
85 | 00081 <span class="keyword">private</span>: |
---|
86 | 00082 <span class="comment">// State at last 'capture' call</span> |
---|
87 | <a name="l00083"></a><a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr0">00083</a> Uint8* <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr0">mKeyboardBuffer</a>; |
---|
88 | <a name="l00084"></a><a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr1">00084</a> <span class="keywordtype">int</span> <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr1">mMaxKey</a>; |
---|
89 | <a name="l00085"></a><a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr3">00085</a> <span class="keywordtype">int</span> mMouseX, mMouseY; |
---|
90 | <a name="l00086"></a><a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr6">00086</a> <span class="keywordtype">int</span> <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr4">mMouseRelativeX</a>, <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr5">mMouseRelativeY</a>, <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr6">mMouseRelativeZ</a>; |
---|
91 | <a name="l00087"></a><a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr7">00087</a> Uint8 <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr7">mMouseKeys</a>; |
---|
92 | <a name="l00088"></a><a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr8">00088</a> <span class="keywordtype">bool</span> <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr8">_visible</a>; |
---|
93 | 00089 |
---|
94 | <a name="l00090"></a><a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr9">00090</a> <span class="keywordtype">bool</span> <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr9">mMouseGrabbed</a>; <span class="comment">// true if Ogre has control over the mouse input</span> |
---|
95 | <a name="l00091"></a><a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr10">00091</a> <span class="keywordtype">bool</span> <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr10">mUseMouse</a>; <span class="comment">// true if initialise() is called with useMouse == true</span> |
---|
96 | <a name="l00092"></a><a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr11">00092</a> <span class="keywordtype">bool</span> <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr11">mGrabMouse</a>; <span class="comment">// grab the mouse input if the situation specified by mGrabMode arises</span> |
---|
97 | <a name="l00093"></a><a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr12">00093</a> <span class="keywordtype">bool</span> <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr12">mMouseLeft</a>; <span class="comment">// true if the mouse pointer has left the window after calling releaseMouse(). Needed for</span> |
---|
98 | 00094 <span class="comment">// mGrabMode == GRAB_MOUSE_BUTTON.</span> |
---|
99 | <a name="l00095"></a><a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr13">00095</a> <span class="keywordtype">int</span> <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr13">mGrabMode</a>; <span class="comment">// when/how to grab the mouse</span> |
---|
100 | 00096 |
---|
101 | <a name="l00097"></a><a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputy0">00097</a> <span class="keyword">typedef</span> std::map<SDLKey, KeyCode> InputKeyMap; |
---|
102 | <a name="l00098"></a><a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr14">00098</a> InputKeyMap _key_map; |
---|
103 | <a name="l00099"></a><a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputr15">00099</a> <span class="keywordtype">bool</span> warpMouse; |
---|
104 | 00100 |
---|
105 | 00101 <span class="comment">// the value that is added to mMouseRelativeZ when the wheel</span> |
---|
106 | 00102 <span class="comment">// is moved one step (this value is actually added</span> |
---|
107 | 00103 <span class="comment">// twice per movement since a wheel movement triggers a</span> |
---|
108 | 00104 <span class="comment">// MOUSEBUTTONUP and a MOUSEBUTTONDOWN event).</span> |
---|
109 | 00105 <span class="comment">// The value is chosen according to the windoze value.</span> |
---|
110 | <a name="l00106"></a><a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputv0">00106</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> mWheelStep = 60; |
---|
111 | 00107 |
---|
112 | 00108 <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputd0">processBufferedKeyboard</a>(); |
---|
113 | 00109 <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputd1">processBufferedMouse</a>(); |
---|
114 | 00110 |
---|
115 | 00111 <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputd2">_grabMouse</a>(); |
---|
116 | 00112 <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputd3">_releaseMouse</a>(); |
---|
117 | 00113 <span class="keywordtype">bool</span> <a class="code" href="classOgre_1_1SDLInput.html#Ogre_1_1SDLInputd4">isKeyDownImmediate</a>( KeyCode kc ) <span class="keyword">const</span>; |
---|
118 | 00114 }; |
---|
119 | 00115 } |
---|
120 | 00116 |
---|
121 | 00117 <span class="preprocessor">#endif</span> |
---|
122 | 00118 <span class="preprocessor"></span> |
---|
123 | </pre></div><hr> |
---|
124 | <p> |
---|
125 | Copyright © 2000-2005 by The OGRE Team<br /> |
---|
126 | <!--Creative Commons License--><a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/"><img alt="Creative Commons License" border="0" src="http://creativecommons.org/images/public/somerights20.png"/></a><br/> |
---|
127 | This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/">Creative Commons Attribution-ShareAlike 2.5 License</a>.<br/> |
---|
128 | <!--/Creative Commons License--><!-- <rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> |
---|
129 | <Work rdf:about=""> |
---|
130 | <license rdf:resource="http://creativecommons.org/licenses/by-sa/2.5/" /> |
---|
131 | <dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" /> |
---|
132 | </Work> |
---|
133 | <License rdf:about="http://creativecommons.org/licenses/by-sa/2.5/"><permits rdf:resource="http://web.resource.org/cc/Reproduction"/><permits rdf:resource="http://web.resource.org/cc/Distribution"/><requires rdf:resource="http://web.resource.org/cc/Notice"/><requires rdf:resource="http://web.resource.org/cc/Attribution"/><permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/><requires rdf:resource="http://web.resource.org/cc/ShareAlike"/></License></rdf:RDF> --> |
---|
134 | |
---|
135 | Last modified Sun Mar 12 14:37:49 2006 |
---|
136 | </p> |
---|
137 | </body> |
---|
138 | </html> |
---|