]> git.mxchange.org Git - flightgear.git/blob - src/GUI/gui_local.cxx
Don't restore initial screen geometry because there is nothing in fg_os* to resize...
[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 <Main/renderer.hxx>
17 #include <Scenery/tilemgr.hxx>
18 #include <Time/light.hxx>
19
20 #include "gui.h"
21 #include "trackball.h"
22
23 // FOR MOUSE VIEW MODE
24 // stashed trackball(_quat0, 0.0, 0.0, 0.0, 0.0);
25 static float _quat0[4];
26
27 float lastGuiQuat[4];
28 float curGuiQuat[4];
29
30 // To apply our mouse rotation quat to VIEW
31 // sgPreMultMat4( VIEW, GuiQuat_mat);
32 // This is here temporarily should be in views.hxx
33 float GuiQuat_mat[4][4];
34
35 void Quat0( void ) {
36     curGuiQuat[0] = _quat0[0];
37     curGuiQuat[1] = _quat0[1];
38     curGuiQuat[2] = _quat0[2];
39     curGuiQuat[3] = _quat0[3];
40 }
41
42 void initMouseQuat(void) {
43     trackball(_quat0, 0.0, 0.0, 0.0, 0.0);  
44     Quat0();
45     build_rotmatrix(GuiQuat_mat, curGuiQuat);
46 }
47
48
49 void reInit(puObject *cb)
50 {
51     // BusyCursor(0);
52     Quat0();
53
54     static const SGPropertyNode *master_freeze
55         = fgGetNode("/sim/freeze/master");
56
57     bool freeze = master_freeze->getBoolValue();
58     if ( !freeze ) {
59         fgSetBool("/sim/freeze/master", true);
60     }
61
62     cur_fdm_state->unbind();
63
64     // in case user has changed window size as
65     // restoreInitialState() overwrites these
66     int xsize = fgGetInt("/sim/startup/xsize");
67     int ysize = fgGetInt("/sim/startup/ysize");
68
69     build_rotmatrix(GuiQuat_mat, curGuiQuat);
70
71     globals->restoreInitialState();
72
73     // update our position based on current presets
74     fgInitPosition();
75
76     // We don't know how to resize the window, so keep the last values 
77     //  for xsize and ysize, and don't use the one set initially
78     fgSetInt("/sim/startup/xsize",xsize);
79     fgSetInt("/sim/startup/ysize",ysize);
80
81     SGTime *t = globals->get_time_params();
82     delete t;
83     t = fgInitTime();
84     globals->set_time_params( t );
85
86     fgReInitSubsystems();
87
88     globals->get_tile_mgr()->update( fgGetDouble("/environment/visibility-m") );
89     globals->get_renderer()->resize( xsize, ysize );
90
91     fgSetBool("/sim/signals/reinit", true);
92
93     // BusyCursor(1);
94     
95     if ( !freeze ) {
96         fgSetBool("/sim/freeze/master", false);
97     }
98 }
99