]> git.mxchange.org Git - flightgear.git/blob - src/Main/fg_os_common.cxx
Clean up header file use of iostream and "using" declarations
[flightgear.git] / src / Main / fg_os_common.cxx
1 // fg_os_common.cxx -- common functions for fg_os interface
2 // implemented as an osgViewer
3 //
4 // Copyright (C) 2007  Tim Moore timoore@redhat.com
5 //
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License as
8 // published by the Free Software Foundation; either version 2 of the
9 // License, or (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful, but
12 // WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19
20 #include <config.h>
21 #include <plib/pu.h>
22 #include <osg/GraphicsContext>
23
24 #include "fg_os.hxx"
25 #include "globals.hxx"
26 #include "renderer.hxx"
27
28 // fg_os callback registration APIs
29 //
30
31 // Event handling and scene graph update is all handled by a
32 // manipulator. See FGManipulator.cpp
33 void fgRegisterIdleHandler(fgIdleHandler func)
34 {
35     globals->get_renderer()->getManipulator()->setIdleHandler(func);
36 }
37
38 void fgRegisterDrawHandler(fgDrawHandler func)
39 {
40     globals->get_renderer()->getManipulator()->setDrawHandler(func);
41 }
42
43 void fgRegisterWindowResizeHandler(fgWindowResizeHandler func)
44 {
45     globals->get_renderer()->getManipulator()->setWindowResizeHandler(func);
46 }
47
48 void fgRegisterKeyHandler(fgKeyHandler func)
49 {
50     globals->get_renderer()->getManipulator()->setKeyHandler(func);
51 }
52
53 void fgRegisterMouseClickHandler(fgMouseClickHandler func)
54 {
55     globals->get_renderer()->getManipulator()->setMouseClickHandler(func);
56 }
57
58 void fgRegisterMouseMotionHandler(fgMouseMotionHandler func)
59 {
60     globals->get_renderer()->getManipulator()->setMouseMotionHandler(func);
61 }
62
63 // Redraw "happens" every frame whether you want it or not.
64 void fgRequestRedraw()
65 {
66 }
67
68