]> git.mxchange.org Git - flightgear.git/blob - src/GUI/gui_local.cxx
Boris Koenig:
[flightgear.git] / src / GUI / gui_local.cxx
1 #ifdef HAVE_CONFIG_H
2 #  include <config.h>
3 #endif
4
5 #ifdef HAVE_WINDOWS_H
6 #  include <windows.h>
7 #endif
8
9 #include <plib/pu.h>        // plib include
10
11 #include <FDM/flight.hxx>
12
13 #include <Main/globals.hxx>
14 #include <Main/fg_init.hxx>
15 #include <Main/fg_props.hxx>
16 #include <Scenery/tilemgr.hxx>
17 #include <Time/light.hxx>
18
19 #include "gui.h"
20 #include "trackball.h"
21
22 // FOR MOUSE VIEW MODE
23 // stashed trackball(_quat0, 0.0, 0.0, 0.0, 0.0);
24 static float _quat0[4];
25
26 float lastGuiQuat[4];
27 float curGuiQuat[4];
28
29 // To apply our mouse rotation quat to VIEW
30 // sgPreMultMat4( VIEW, GuiQuat_mat);
31 // This is here temporarily should be in views.hxx
32 float GuiQuat_mat[4][4];
33
34 void Quat0( void ) {
35     curGuiQuat[0] = _quat0[0];
36     curGuiQuat[1] = _quat0[1];
37     curGuiQuat[2] = _quat0[2];
38     curGuiQuat[3] = _quat0[3];
39 }
40
41 void initMouseQuat(void) {
42     trackball(_quat0, 0.0, 0.0, 0.0, 0.0);  
43     Quat0();
44     build_rotmatrix(GuiQuat_mat, curGuiQuat);
45 }
46
47
48 void reInit(puObject *cb)
49 {
50     // BusyCursor(0);
51     Quat0();
52
53     static const SGPropertyNode *master_freeze
54         = fgGetNode("/sim/freeze/master");
55
56     bool freeze = master_freeze->getBoolValue();
57     if ( !freeze ) {
58         fgSetBool("/sim/freeze/master", true);
59     }
60
61     cur_fdm_state->unbind();
62
63     // in case user has changed window size as
64     // restoreInitialState() overwrites these
65     int xsize = fgGetInt("/sim/startup/xsize");
66     int ysize = fgGetInt("/sim/startup/ysize");
67
68     build_rotmatrix(GuiQuat_mat, curGuiQuat);
69
70     globals->restoreInitialState();
71
72     // update our position based on current presets
73     fgInitPosition();
74
75     SGTime *t = globals->get_time_params();
76     delete t;
77     t = fgInitTime();
78     globals->set_time_params( t );
79
80     fgReInitSubsystems();
81
82     globals->get_tile_mgr()->update( fgGetDouble("/environment/visibility-m") );
83
84     globals->get_renderer()->resize( xsize, ysize );
85
86     // BusyCursor(1);
87     
88     if ( !freeze ) {
89         fgSetBool("/sim/freeze/master", false);
90     }
91 }
92