]> git.mxchange.org Git - flightgear.git/blob - src/Main/fg_os_common.cxx
Merge commit 'refs/merge-requests/1552' of git@gitorious.org:fg/flightgear into next
[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 #ifdef HAVE_CONFIG_H
21 #include <config.h>
22 #endif
23
24 #include <plib/pu.h>
25 #include <osg/GraphicsContext>
26
27 #include "fg_os.hxx"
28 #include "globals.hxx"
29 #include "renderer.hxx"
30 #include "FGEventHandler.hxx"
31
32 // fg_os callback registration APIs
33 //
34
35 // Event handling and scene graph update is all handled by a
36 // manipulator. See FGEventHandler.cpp
37 void fgRegisterIdleHandler(fgIdleHandler func)
38 {
39     globals->get_renderer()->getEventHandler()->setIdleHandler(func);
40 }
41
42 void fgRegisterDrawHandler(fgDrawHandler func)
43 {
44     globals->get_renderer()->getEventHandler()->setDrawHandler(func);
45 }
46
47 void fgRegisterWindowResizeHandler(fgWindowResizeHandler func)
48 {
49     globals->get_renderer()->getEventHandler()->setWindowResizeHandler(func);
50 }
51
52 void fgRegisterKeyHandler(fgKeyHandler func)
53 {
54     globals->get_renderer()->getEventHandler()->setKeyHandler(func);
55 }
56
57 void fgRegisterMouseClickHandler(fgMouseClickHandler func)
58 {
59     globals->get_renderer()->getEventHandler()->setMouseClickHandler(func);
60 }
61
62 void fgRegisterMouseMotionHandler(fgMouseMotionHandler func)
63 {
64     globals->get_renderer()->getEventHandler()->setMouseMotionHandler(func);
65 }
66
67 // Redraw "happens" every frame whether you want it or not.
68 void fgRequestRedraw()
69 {
70 }
71
72