00001 /* 00002 SagaEngine library 00003 Copyright (c) 2002-2006 Skalden Studio AS 00004 00005 This software is provided 'as-is', without any express or implied 00006 warranty. In no event will the authors be held liable for any 00007 damages arising from the use of this software. 00008 00009 Permission is granted to distribute the library under the terms of the 00010 Q Public License version 1.0. Be sure to read and understand the license 00011 before using the library. It should be included here, or you may read it 00012 at http://www.trolltech.com/products/qt/licenses/licensing/qpl 00013 00014 The original version of this library can be located at: 00015 http://www.sagaengine.com/ 00016 00017 Rune Myrland 00018 rune@skalden.com 00019 */ 00020 00021 00022 #ifndef o3d_input_InputManager_hpp 00023 #define o3d_input_InputManager_hpp 00024 00025 #include "o3d_input.hpp" 00026 00027 namespace se_ogre { 00028 class _SeOgreExport InputManager { 00029 public: 00030 InputManager(); 00031 ~InputManager(); 00032 00033 InputHandler* active(); 00034 InputHandler* below(); 00035 00036 enum ShiftKeys { LSHIFT, RSHIFT, LCTRL, RCTRL, ALT, ALT_GR, WIN, MODIFIER_COUNT }; 00037 void setModifier(ShiftKeys key, bool state) { 00038 isModifierDown_[ key ] = state; 00039 } 00040 protected: 00041 friend class InputHandler; 00042 void add(InputHandler* h); 00043 void remove(InputHandler* h); 00044 00045 void push(const char* name); 00046 void pop(); 00047 InputHandler* handler(const char* name); 00048 void push(InputHandler* h); 00049 00050 bool hasHandler(const char* name); 00051 int count() { return handlerCount_; } 00052 InputHandler* handler(int index) { return handlers_[ index ]; } 00053 00054 bool isShiftDown() const { return isModifierDown_[ LSHIFT ] || isModifierDown_[ RSHIFT ]; } 00055 bool isAltDown() const { return isModifierDown_[ ALT ] || isModifierDown_[ ALT_GR ]; } 00056 bool isControlDown() const { return isModifierDown_[ LCTRL ] || isModifierDown_[ RCTRL ]; } 00057 bool isWinDown() const { return isModifierDown_[ WIN ]; } 00058 00059 static const int MAX_STACK_SIZE = 64; 00060 static const int MAX_HANDLER_COUNT = 32; 00061 int handlerCount_; 00062 int handlerStackPos_; 00063 InputHandler* handlerStack_[ MAX_STACK_SIZE ]; 00064 InputHandler* handlers_[ MAX_HANDLER_COUNT ]; 00065 bool isModifierDown_[ MODIFIER_COUNT ]; 00066 }; 00067 } 00068 00069 #endif
Home Page | SagaEngine trunk (updated nightly) reference generated Sun Dec 2 20:06:05 2007 by Doxygen version 1.3.9.1.