00001 00002 // 00003 // SFML - Simple and Fast Multimedia Library 00004 // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com) 00005 // 00006 // This software is provided 'as-is', without any express or implied warranty. 00007 // In no event will the authors be held liable for any damages arising from the use of this software. 00008 // 00009 // Permission is granted to anyone to use this software for any purpose, 00010 // including commercial applications, and to alter it and redistribute it freely, 00011 // subject to the following restrictions: 00012 // 00013 // 1. The origin of this software must not be misrepresented; 00014 // you must not claim that you wrote the original software. 00015 // If you use this software in a product, an acknowledgment 00016 // in the product documentation would be appreciated but is not required. 00017 // 00018 // 2. Altered source versions must be plainly marked as such, 00019 // and must not be misrepresented as being the original software. 00020 // 00021 // 3. This notice may not be removed or altered from any source distribution. 00022 // 00024 00025 #ifndef SFML_EVENT_HPP 00026 #define SFML_EVENT_HPP 00027 00029 // Headers 00031 #include <SFML/Config.hpp> 00032 00033 00034 namespace sf 00035 { 00036 namespace Key 00037 { 00042 enum Code 00043 { 00044 A = 'a', 00045 B = 'b', 00046 C = 'c', 00047 D = 'd', 00048 E = 'e', 00049 F = 'f', 00050 G = 'g', 00051 H = 'h', 00052 I = 'i', 00053 J = 'j', 00054 K = 'k', 00055 L = 'l', 00056 M = 'm', 00057 N = 'n', 00058 O = 'o', 00059 P = 'p', 00060 Q = 'q', 00061 R = 'r', 00062 S = 's', 00063 T = 't', 00064 U = 'u', 00065 V = 'v', 00066 W = 'w', 00067 X = 'x', 00068 Y = 'y', 00069 Z = 'z', 00070 Num0 = '0', 00071 Num1 = '1', 00072 Num2 = '2', 00073 Num3 = '3', 00074 Num4 = '4', 00075 Num5 = '5', 00076 Num6 = '6', 00077 Num7 = '7', 00078 Num8 = '8', 00079 Num9 = '9', 00080 Escape = 256, 00081 LControl, 00082 LShift, 00083 LAlt, 00084 LSystem, 00085 RControl, 00086 RShift, 00087 RAlt, 00088 RSystem, 00089 Menu, 00090 LBracket, 00091 RBracket, 00092 SemiColon, 00093 Comma, 00094 Period, 00095 Quote, 00096 Slash, 00097 BackSlash, 00098 Tilde, 00099 Equal, 00100 Dash, 00101 Space, 00102 Return, 00103 Back, 00104 Tab, 00105 PageUp, 00106 PageDown, 00107 End, 00108 Home, 00109 Insert, 00110 Delete, 00111 Add, 00112 Subtract, 00113 Multiply, 00114 Divide, 00115 Left, 00116 Right, 00117 Up, 00118 Down, 00119 Numpad0, 00120 Numpad1, 00121 Numpad2, 00122 Numpad3, 00123 Numpad4, 00124 Numpad5, 00125 Numpad6, 00126 Numpad7, 00127 Numpad8, 00128 Numpad9, 00129 F1, 00130 F2, 00131 F3, 00132 F4, 00133 F5, 00134 F6, 00135 F7, 00136 F8, 00137 F9, 00138 F10, 00139 F11, 00140 F12, 00141 F13, 00142 F14, 00143 F15, 00144 Pause, 00145 00146 Count 00147 }; 00148 } 00149 00150 00151 namespace Mouse 00152 { 00157 enum Button 00158 { 00159 Left, 00160 Right, 00161 Middle, 00162 XButton1, 00163 XButton2, 00164 00165 ButtonCount 00166 }; 00167 } 00168 00169 00170 namespace Joy 00171 { 00176 enum Axis 00177 { 00178 AxisX, 00179 AxisY, 00180 AxisZ, 00181 AxisR, 00182 AxisU, 00183 AxisV, 00184 AxisPOV, 00185 00186 AxisCount // Keep last -- total number of joystick axis 00187 }; 00188 00189 enum 00190 { 00191 Count = 4, 00192 ButtonCount = 32 00193 }; 00194 } 00195 00196 00201 class Event 00202 { 00203 public : 00204 00209 struct KeyEvent 00210 { 00211 Key::Code Code; 00212 bool Alt; 00213 bool Control; 00214 bool Shift; 00215 }; 00216 00221 struct TextEvent 00222 { 00223 Uint32 Unicode; 00224 }; 00225 00230 struct MouseMoveEvent 00231 { 00232 int X; 00233 int Y; 00234 }; 00235 00241 struct MouseButtonEvent 00242 { 00243 Mouse::Button Button; 00244 int X; 00245 int Y; 00246 }; 00247 00252 struct MouseWheelEvent 00253 { 00254 int Delta; 00255 int X; 00256 int Y; 00257 }; 00258 00263 struct JoyMoveEvent 00264 { 00265 unsigned int JoystickId; 00266 Joy::Axis Axis; 00267 float Position; 00268 }; 00269 00275 struct JoyButtonEvent 00276 { 00277 unsigned int JoystickId; 00278 unsigned int Button; 00279 }; 00280 00285 struct SizeEvent 00286 { 00287 unsigned int Width; 00288 unsigned int Height; 00289 }; 00290 00295 enum EventType 00296 { 00297 Closed, 00298 Resized, 00299 LostFocus, 00300 GainedFocus, 00301 TextEntered, 00302 KeyPressed, 00303 KeyReleased, 00304 MouseWheelMoved, 00305 MouseButtonPressed, 00306 MouseButtonReleased, 00307 MouseMoved, 00308 MouseEntered, 00309 MouseLeft, 00310 JoyButtonPressed, 00311 JoyButtonReleased, 00312 JoyMoved, 00313 00314 Count 00315 }; 00316 00318 // Member data 00320 EventType Type; 00321 00322 union 00323 { 00324 KeyEvent Key; 00325 TextEvent Text; 00326 MouseMoveEvent MouseMove; 00327 MouseButtonEvent MouseButton; 00328 MouseWheelEvent MouseWheel; 00329 JoyMoveEvent JoyMove; 00330 JoyButtonEvent JoyButton; 00331 SizeEvent Size; 00332 }; 00333 }; 00334 00335 } // namespace sf 00336 00337 00338 #endif // SFML_EVENT_HPP 00339 00340
:: Copyright © 2007-2008 Laurent Gomila, all rights reserved :: Documentation generated by doxygen 1.5.2 ::