]> git.mxchange.org Git - flightgear.git/commitdiff
Update the camera properties after a resize event.
authortimoore <timoore>
Tue, 18 Nov 2008 22:46:19 +0000 (22:46 +0000)
committertimoore <timoore>
Tue, 18 Nov 2008 22:46:19 +0000 (22:46 +0000)
src/Main/CameraGroup.cxx
src/Main/CameraGroup.hxx
src/Main/FGEventHandler.cxx

index f218466bb4d2729b70792f30b888cd64f407cea3..46ae0faeacca9fd7612996280fc0d72d3f089062 100644 (file)
@@ -446,6 +446,18 @@ void CameraGroup::setCameraCullMasks(Node::NodeMask nm)
     }
 }
 
+void CameraGroup::resized()
+{
+    for (CameraIterator i = camerasBegin(), e = camerasEnd(); i != e; ++i) {
+        CameraInfo *info = i->get();
+        const Viewport* viewport = info->camera->getViewport();
+        info->x = viewport->x();
+        info->y = viewport->y();
+        info->width = viewport->width();
+        info->height = viewport->height();
+    }
+}
+
 Camera* getGUICamera(CameraGroup* cgroup)
 {
     CameraGroup::CameraIterator end = cgroup->camerasEnd();
index 19b8a9920655571c3341b0b2903d7fda9ac35a67..a9e9b6973481126fdb6f98f828a6f42f9dcb8235 100644 (file)
@@ -171,7 +171,9 @@ public:
     /** Set the cull mask on all non-GUI cameras
      */
     void setCameraCullMasks(osg::Node::NodeMask nm);
-
+    /** Update camera properties after a resize event.
+     */
+    void resized();
 protected:
     CameraList _cameras;
     osg::ref_ptr<osgViewer::Viewer> _viewer;
index 56dcb564cf51eb5f023a7a4a2077b2d1fe2ef515..16babdeada1ff98ce6949fc2ccfef12292708c39 100644 (file)
@@ -217,6 +217,7 @@ bool FGEventHandler::handle(const osgGA::GUIEventAdapter& ea,
             (*mouseMotionHandler)(x, y);
         return true;
     case osgGA::GUIEventAdapter::RESIZE:
+        CameraGroup::getDefault()->resized();
         if (resizable && windowResizeHandler)
             (*windowResizeHandler)(ea.getWindowWidth(), ea.getWindowHeight());
         return true;