]> git.mxchange.org Git - flightgear.git/blob - src/GUI/gui_local.cxx
Multiplayer client/server system -- MessageBuf class and test harness complete
[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 FG_GLUT_H          // needed before pu.h
10 #include <plib/pu.h>        // plib include
11
12 #include <FDM/flight.hxx>
13
14 #include <Main/globals.hxx>
15 #include <Main/fg_init.hxx>
16 #include <Main/fg_props.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     SGTime *t = globals->get_time_params();
77     delete t;
78     t = fgInitTime();
79     globals->set_time_params( t );
80
81     fgReInitSubsystems();
82
83     globals->get_tile_mgr()->update( fgGetDouble("/environment/visibility-m") );
84
85     fgReshape( xsize, ysize );
86
87     // BusyCursor(1);
88     
89     if ( !freeze ) {
90         fgSetBool("/sim/freeze/master", false);
91     }
92 }
93