]> git.mxchange.org Git - flightgear.git/commitdiff
move callback registration functions to fg_os_common.cxx
authortimoore <timoore>
Fri, 30 Nov 2007 00:00:36 +0000 (00:00 +0000)
committertimoore <timoore>
Fri, 30 Nov 2007 00:00:36 +0000 (00:00 +0000)
src/Main/Makefile.am
src/Main/fg_os_common.cxx [new file with mode: 0644]
src/Main/fg_os_osgviewer.cxx

index f19702c2e655d2bd28ecbb581c78ac8e54901ad4..bdafefb54df60619f3dec6785cbd1ee37da21a9a 100644 (file)
@@ -19,7 +19,7 @@ if USE_SDL
 GFX_CODE = fg_os_sdl.cxx fg_os.hxx
 else
 if USE_OSGVIEWER
-GFX_CODE = fg_os_osgviewer.cxx fg_os.hxx
+GFX_CODE = fg_os_osgviewer.cxx fg_os_common.cxx fg_os.hxx
 else
 GFX_CODE = fg_os.cxx fg_os.hxx
 endif
diff --git a/src/Main/fg_os_common.cxx b/src/Main/fg_os_common.cxx
new file mode 100644 (file)
index 0000000..5cc150d
--- /dev/null
@@ -0,0 +1,62 @@
+// fg_os_common.cxx -- common functions for fg_os interface
+// implemented as an osgViewer
+//
+// Copyright (C) 2007  Tim Moore timoore@redhat.com
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+
+#include "fg_os.hxx"
+#include "globals.hxx"
+#include "renderer.hxx"
+
+// fg_os callback registration APIs
+//
+
+// Event handling and scene graph update is all handled by a
+// manipulator. See FGManipulator.cpp
+void fgRegisterIdleHandler(fgIdleHandler func)
+{
+    globals->get_renderer()->getManipulator()->setIdleHandler(func);
+}
+
+void fgRegisterDrawHandler(fgDrawHandler func)
+{
+    globals->get_renderer()->getManipulator()->setDrawHandler(func);
+}
+
+void fgRegisterWindowResizeHandler(fgWindowResizeHandler func)
+{
+    globals->get_renderer()->getManipulator()->setWindowResizeHandler(func);
+}
+
+void fgRegisterKeyHandler(fgKeyHandler func)
+{
+    globals->get_renderer()->getManipulator()->setKeyHandler(func);
+}
+
+void fgRegisterMouseClickHandler(fgMouseClickHandler func)
+{
+    globals->get_renderer()->getManipulator()->setMouseClickHandler(func);
+}
+
+void fgRegisterMouseMotionHandler(fgMouseMotionHandler func)
+{
+    globals->get_renderer()->getManipulator()->setMouseMotionHandler(func);
+}
+
+// Redraw "happens" every frame whether you want it or not.
+void fgRequestRedraw()
+{
+}
index 71600824d206e09f07141cd1dc11f2d32cd24aa0..7b7bcc70bd5f555700e154b0d52fdade9464f093 100644 (file)
@@ -1,3 +1,22 @@
+// fg_os_common.cxx -- common functions for fg_os interface
+// implemented as an osgViewer
+//
+// Copyright (C) 2007  Tim Moore timoore@redhat.com
+// Copyright (C) 2007 Mathias Froehlich 
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
 
 // fg_os implementation using OpenSceneGraph's osgViewer::Viewer class
 // to create the graphics window and run the event/update/render loop.
-//
-// fg_os callback registration APIs
-//
-
-
-// Event handling and scene graph update is all handled by a
-// manipulator. See FGManipulator.cpp
-void fgRegisterIdleHandler(fgIdleHandler func)
-{
-    globals->get_renderer()->getManipulator()->setIdleHandler(func);
-}
-
-void fgRegisterDrawHandler(fgDrawHandler func)
-{
-    globals->get_renderer()->getManipulator()->setDrawHandler(func);
-}
-
-void fgRegisterWindowResizeHandler(fgWindowResizeHandler func)
-{
-    globals->get_renderer()->getManipulator()->setWindowResizeHandler(func);
-}
-
-void fgRegisterKeyHandler(fgKeyHandler func)
-{
-    globals->get_renderer()->getManipulator()->setKeyHandler(func);
-}
-
-void fgRegisterMouseClickHandler(fgMouseClickHandler func)
-{
-    globals->get_renderer()->getManipulator()->setMouseClickHandler(func);
-}
-
-void fgRegisterMouseMotionHandler(fgMouseMotionHandler func)
-{
-    globals->get_renderer()->getManipulator()->setMouseMotionHandler(func);
-}
-
-// Redraw "happens" every frame whether you want it or not.
-void fgRequestRedraw()
-{
-}
 
 //
 // fg_os implementation