- Timestamp:
- Apr 18, 2019, 4:02:06 PM (6 years ago)
- Location:
- code/branches/MouseAPI_FS19
- Files:
-
- 2 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/MouseAPI_FS19/data/levels/MouseAPIExample.oxw
r12306 r12309 42 42 </attached> 43 43 </MouseAPIExample> 44 44 <!--<MouseCursor></MouseCursor>--> 45 46 <OverlayGroup name = "cursor" scale = "1, 1"> 47 <GUIOverlay guiname="MouseAPICursor" visible=true position = "1, 1" 48 pickpoint = "0.0, 0.0"></GUIOverlay> 49 </OverlayGroup> 50 45 51 </Scene> 46 52 </Level> -
code/branches/MouseAPI_FS19/src/modules/MouseAPI/CMakeLists.txt
r12301 r12309 3 3 mouseapiexample.cc 4 4 mousegametype.cc 5 mousecursor.cc6 5 ) 7 6 -
code/branches/MouseAPI_FS19/src/modules/MouseAPI/mouseapi.cc
r12302 r12309 21 21 state->setMouseExclusive(false);//does this work 22 22 state->setMouseHandler(this); 23 state->setKeyHandler(KeyBinderManager::getInstance().getDefaultAsHandler()); 24 InputManager::getInstance().enterState("guiMouseOnly"); 23 25 InputManager::getInstance().enterState("MouseAPI"); 24 } 26 InputManager::getInstance().setMouseExclusive("game",false); 27 //InputManager::getInstance().setMouseExclusive("guiMouseOnly",false); 28 //InputManager::getInstance().getState("game")-> 29 } 30 //GUIManager::getInstance().showGUI("MouseAPICursor", true);//Display a mouse cursor by displaying a empty menu 25 31 } 26 32 … … 31 37 if(active) 32 38 { 39 GUIManager::getInstance().showGUI("MouseAPICursor", true); 33 40 active = false; 34 41 if(InputManager::exists()) … … 37 44 state->setMouseHandler(nullptr); 38 45 InputManager::getInstance().destroyState("MouseAPI"); 46 InputManager::getInstance().enterState("game"); 39 47 } 40 48 clickEvents.clear(); … … 59 67 for(auto wantedButton:event.buttons) 60 68 { 61 if(wantedButton == button && ray.intersects(Ogre::Sphere(event.position,event.radius)).first) 69 Ogre::Sphere sphere(event.position,event.radius); 70 if(wantedButton == button && ray.intersects(sphere).first && cam->isVisible(sphere)) 62 71 event.onClickedFunction(button); 63 72 } … … 68 77 { 69 78 //mousePos = abs; 79 InputManager::getInstance().leaveState("game");//hack: todo: crate 2nd input state with prioritz 98 for cegui(cursor) 80 GUIManager::getInstance().showGUI("MouseAPICursor", true);//hack todo: only if gui not shown & evt better if not in mouse mooved 70 81 } 71 82 … … 79 90 for(auto event:scrollEvents) 80 91 { 81 if(!event.considerPosition || ray.intersects(Ogre::Sphere(event.position,event.radius)).first)92 if(!event.considerPosition || (ray.intersects(Ogre::Sphere(event.position,event.radius)).first && cam->isVisible(Ogre::Sphere(event.position,event.radius)))) 82 93 event.onScrolledFunction(abs,rel,IntVector2(mouseposX,mouseposY)); 83 94 } … … 183 194 } 184 195 } 196 return 0; 185 197 } 186 198 … … 194 206 } 195 207 } 196 } 197 198 } 208 return 0; 209 } 210 211 //returns relative Position of the Mouse 212 Vector2 MouseAPI::getMousePosition() 213 { 214 Ogre::Viewport *vp = GraphicsManager::getInstance().getViewport(); 215 return Vector2(InputManager::getInstance().getMousePosition().first/((float)vp->getActualWidth()),InputManager::getInstance().getMousePosition().second/((float)vp->getActualHeight())); 216 } 217 218 } -
code/branches/MouseAPI_FS19/src/modules/MouseAPI/mouseapi.h
r12302 r12309 16 16 #include "CameraManager.h" 17 17 #include <functional> 18 #include "core/GUIManager.h" 19 #include "core/input/KeyBinderManager.h" 18 20 19 21 namespace orxonox … … 87 89 float getRadiusScroll(ScrollableElementID id); 88 90 91 Vector2 getMousePosition(); 92 89 93 void activate(); 90 94 static bool isActive(){return singletonPtr_s != nullptr && getInstance().active;} -
code/branches/MouseAPI_FS19/src/modules/MouseAPI/mousegametype.cc
r12301 r12309 9 9 10 10 } 11 11 12 void MouseGametype::start(){ 12 13 … … 19 20 // Reset the variable. 20 21 this->bForceSpawn_ = temp; 21 22 InputManager::getInstance().setMouseExclusive("game",false);//set show mouse, see guimanager23 22 } 24 23 -
code/branches/MouseAPI_FS19/src/modules/MouseAPI/mousegametype.h
r12301 r12309 5 5 #include "infos/PlayerInfo.h" 6 6 #include <core/input/InputState.h> 7 #include <CEGUI/MouseCursor.h> //todo: guimanager: fallunterscheidng cegui version7 #include "core/GUIManager.h" 8 8 9 9 namespace orxonox … … 19 19 private: 20 20 PlayerInfo* player_ ; 21 CEGUI::MouseCursor *cursor; 21 22 }; 22 23
Note: See TracChangeset
for help on using the changeset viewer.