]> git.mxchange.org Git - flightgear.git/blobdiff - src/Input/input.cxx
Don't restore initial screen geometry because there is nothing in fg_os* to resize...
[flightgear.git] / src / Input / input.cxx
index fa5552c883b59f74d1a075d6acefd79380cd1295..be5d83071db9176adb0394c18a2eed6e33098be2 100644 (file)
@@ -16,7 +16,7 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 // $Id$
 
@@ -316,22 +316,21 @@ FGInput::doMouseClick (int b, int updown, int x, int y)
     else {
       // pui and the panel didn't want the click event so compute a
       // terrain intersection point corresponding to the mouse click
-      // and be happy.  This should eventually get written into a set
-      // of properties so that some other [future] subsystems can do
-      // something useful with the information.
+      // and be happy.
       FGScenery* scenery = globals->get_scenery();
       sgdVec3 start, dir, hit;
-      if (FGRenderer::getPickInfo(start, dir, x, y) &&
-          scenery->get_cart_ground_intersection(start, dir, hit)) {
-        
+      if (!b && updown == MOUSE_BUTTON_DOWN && FGRenderer::getPickInfo(start, dir, x, y)
+          && scenery->get_cart_ground_intersection(start, dir, hit)) {
+
         Point3D geod = sgCartToGeod(Point3D(hit[0], hit[1], hit[2]));
-        
-        std::cout << "lon = " << geod.lon()*SGD_RADIANS_TO_DEGREES
-                  << " deg, lat = " << geod.lat()*SGD_RADIANS_TO_DEGREES
-                  << " deg, elev = " << geod.elev()
-                  << " m" << std::endl;
-      } else {
-        std::cout << "Cannot find intersection point" << std::endl;
+
+        SGPropertyNode *c = fgGetNode("/sim/input/click", true);
+        c->setDoubleValue("longitude-deg", geod.lon() * SGD_RADIANS_TO_DEGREES);
+        c->setDoubleValue("latitude-deg", geod.lat() * SGD_RADIANS_TO_DEGREES);
+        c->setDoubleValue("elevation-m", geod.elev());
+        c->setDoubleValue("elevation-ft", geod.elev() * SG_METER_TO_FEET);
+
+        fgSetBool("/sim/signals/click", 1);
       }
     }
   }
@@ -390,19 +389,13 @@ FGInput::doMouseMotion (int x, int y)
                                 // Constrain the mouse if requested
   if (mode.constrained) {
     bool need_warp = false;
-    if (x <= 0) {
-      x = xsize - 2;
-      need_warp = true;
-    } else if (x >= (xsize-1)) {
-      x = 1;
+    if (x <= (xsize * .25) || x >= (xsize * .75)) {
+      x = int(xsize * .5);
       need_warp = true;
     }
 
-    if (y <= 0) {
-      y = ysize - 2;
-      need_warp = true;
-    } else if (y >= (ysize-1)) {
-      y = 1;
+    if (y <= (ysize * .25) || y >= (ysize * .75)) {
+      y = int(ysize * .5);
       need_warp = true;
     }