Changeset 12287
- Timestamp:
- Apr 11, 2019, 1:16:08 PM (6 years ago)
- Location:
- code/branches/MouseAPI_FS19/src/modules/MouseAPI
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/MouseAPI_FS19/src/modules/MouseAPI/mouseapi.cc
r12279 r12287 52 52 cam = CameraManager::getInstance().getActiveCamera()->getOgreCamera();//todo: trycatch 53 53 Ogre::Viewport *vp = GraphicsManager::getInstance().getViewport(); 54 Ogre::Ray ray = cam->getCameraToViewportRay(mousePos.x/((float)vp->getActualWidth()),mousePos.y/((float)vp->getActualHeight())); 54 int mouseposX = InputManager::getInstance().getMousePosition().first; 55 int mouseposY = InputManager::getInstance().getMousePosition().second; 56 Ogre::Ray ray = cam->getCameraToViewportRay(mouseposX/((float)vp->getActualWidth()),mouseposY/((float)vp->getActualHeight())); 55 57 for(auto event: clickEvents) 56 58 { … … 65 67 void MouseAPI::mouseMoved(IntVector2 abs, IntVector2 rel, IntVector2 clippingSize) 66 68 { 67 mousePos = abs;69 //mousePos = abs; 68 70 } 69 71 … … 72 74 cam = CameraManager::getInstance().getActiveCamera()->getOgreCamera(); 73 75 Ogre::Viewport *vp = GraphicsManager::getInstance().getViewport(); 74 Ogre::Ray ray = cam->getCameraToViewportRay(mousePos.x/((float)vp->getActualWidth()),mousePos.y/((float)vp->getActualHeight())); 76 int mouseposX = InputManager::getInstance().getMousePosition().first; 77 int mouseposY = InputManager::getInstance().getMousePosition().second; 78 Ogre::Ray ray = cam->getCameraToViewportRay(mouseposX/((float)vp->getActualWidth()),mouseposY/((float)vp->getActualHeight())); 75 79 for(auto event:scrollEvents) 76 80 { 77 81 if(!event.considerPosition || ray.intersects(Ogre::Sphere(event.position,event.radius)).first) 78 event.onScrolledFunction(abs,rel, mousePos);82 event.onScrolledFunction(abs,rel,IntVector2(mouseposX,mouseposY)); 79 83 } 80 84 } -
code/branches/MouseAPI_FS19/src/modules/MouseAPI/mouseapi.h
r12275 r12287 56 56 std::list<scrollElement> scrollEvents; 57 57 Ogre::Camera *cam ; 58 IntVector2 mousePos;58 //IntVector2 mousePos; 59 59 InputState* state; 60 60 bool active = false; -
code/branches/MouseAPI_FS19/src/modules/MouseAPI/mouseapiexample.cc
r12285 r12287 1 1 #include "mouseapiexample.h" 2 #include "gametypes/Gametype.h" 2 3 3 4 namespace orxonox … … 9 10 { 10 11 RegisterObject(MouseAPIExample); 12 //this->getGametype()->getPlayers().begin()->first->getControllableEntity()... 13 11 14 12 15 } … … 16 19 if(MouseAPI::isActive()) 17 20 MouseAPI::getInstance().deactivate(); 21 18 22 } 19 23
Note: See TracChangeset
for help on using the changeset viewer.