FlightGear next
fg_os_common.cxx
Go to the documentation of this file.
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 <osg/GraphicsContext>
25
26#include <Viewer/renderer.hxx>
28#include "fg_os.hxx"
29#include "globals.hxx"
30
31// fg_os callback registration APIs
32//
33
34// Event handling and scene graph update is all handled by a
35// manipulator. See FGEventHandler.cpp
37{
38 globals->get_renderer()->getEventHandler()->setIdleHandler(func);
39}
40
42{
43 globals->get_renderer()->getEventHandler()->setKeyHandler(func);
44}
45
47{
48 globals->get_renderer()->getEventHandler()->setMouseClickHandler(func);
49}
50
52{
53 globals->get_renderer()->getEventHandler()->setMouseMotionHandler(func);
54}
55
56
57
void(* fgKeyHandler)(int key, int keymod, int mousex, int mousey)
Definition fg_os.hxx:72
void(* fgMouseClickHandler)(int button, int updown, int x, int y, bool mainWindow, const osgGA::GUIEventAdapter *)
Definition fg_os.hxx:73
void(* fgIdleHandler)()
Definition fg_os.hxx:68
void(* fgMouseMotionHandler)(int x, int y, const osgGA::GUIEventAdapter *)
Definition fg_os.hxx:74
void fgRegisterMouseMotionHandler(fgMouseMotionHandler func)
void fgRegisterKeyHandler(fgKeyHandler func)
void fgRegisterIdleHandler(fgIdleHandler func)
void fgRegisterMouseClickHandler(fgMouseClickHandler func)
FGGlobals * globals
Definition globals.cxx:142
naCFunction func