From: timoore Date: Fri, 30 Nov 2007 00:00:36 +0000 (+0000) Subject: move callback registration functions to fg_os_common.cxx X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=49f733015041cb6b254d8921874e1c471b21b70c;p=flightgear.git move callback registration functions to fg_os_common.cxx --- diff --git a/src/Main/Makefile.am b/src/Main/Makefile.am index f19702c2e..bdafefb54 100644 --- a/src/Main/Makefile.am +++ b/src/Main/Makefile.am @@ -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 index 000000000..5cc150d9d --- /dev/null +++ b/src/Main/fg_os_common.cxx @@ -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() +{ +} diff --git a/src/Main/fg_os_osgviewer.cxx b/src/Main/fg_os_osgviewer.cxx index 71600824d..7b7bcc70b 100644 --- a/src/Main/fg_os_osgviewer.cxx +++ b/src/Main/fg_os_osgviewer.cxx @@ -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 @@ -31,47 +50,6 @@ // 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