]> git.mxchange.org Git - flightgear.git/blob - src/GUI/gui_local.cxx
Fix for reinit after user resizes screen.
[flightgear.git] / src / GUI / gui_local.cxx
1 #include <GL/glut.h>            // needed before pu.h
2 #include <plib/pu.h>            // plib include
3
4 #include <Main/globals.hxx>
5 #include <Main/fg_init.hxx>
6 #include <Main/fg_props.hxx>
7
8 #include "gui.h"
9 #include "trackball.h"
10
11 // from main.cxx
12 extern void fgReshape(int, int);
13
14 // FOR MOUSE VIEW MODE
15 // stashed trackball(_quat0, 0.0, 0.0, 0.0, 0.0);
16 static float _quat0[4];
17
18 float lastGuiQuat[4];
19 float curGuiQuat[4];
20
21 // To apply our mouse rotation quat to VIEW
22 // sgPreMultMat4( VIEW, GuiQuat_mat);
23 // This is here temporarily should be in views.hxx
24 float GuiQuat_mat[4][4];
25
26 void Quat0( void ) {
27         curGuiQuat[0] = _quat0[0];
28         curGuiQuat[1] = _quat0[1];
29         curGuiQuat[2] = _quat0[2];
30         curGuiQuat[3] = _quat0[3];
31 }
32
33 void initMouseQuat(void) {
34         trackball(_quat0, 0.0, 0.0, 0.0, 0.0);  
35         Quat0();
36         build_rotmatrix(GuiQuat_mat, curGuiQuat);
37 }
38
39
40 void reInit(puObject *cb)
41 {
42         BusyCursor(0);
43         Quat0();
44
45         // in case user has changed window size as
46         // restoreInitialState() overwrites these
47         int xsize = fgGetInt("/sim/startup/xsize");
48         int ysize = fgGetInt("/sim/startup/ysize");
49
50         build_rotmatrix(GuiQuat_mat, curGuiQuat);
51         /* check */ globals->restoreInitialState();
52
53         fgReInitSubsystems();
54
55         fgReshape( xsize, ysize );
56
57         BusyCursor(1);
58 }
59