1
0
Fork 0

Changes to toggle panel on and off.

This commit is contained in:
curt 1999-05-06 22:16:12 +00:00
parent e03741be5f
commit 40db8d0c1f
8 changed files with 645 additions and 541 deletions

View file

@ -35,6 +35,8 @@
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Debug/logstream.hxx> #include <Debug/logstream.hxx>
#include <Main/options.hxx> #include <Main/options.hxx>
#include <Cockpit/panel.hxx>
#include <Main/views.hxx>
#include <plib/pu.h> #include <plib/pu.h>
@ -328,10 +330,18 @@ static void rolloutsmooth_adj( puObject *hs )
static void goAwayAPAdjust (puObject *) static void goAwayAPAdjust (puObject *)
{ {
FGView *v = &current_view;
puPopLiveInterface ( ) ; puPopLiveInterface ( ) ;
// puPopInterface ( ) ;
puPopGroup ( ) ; puPopGroup ( ) ;
APAdjustDialog -> hide(); APAdjustDialog -> hide();
if ( current_options.get_panel_status() ) {
// this seems to be the only way to do this :-(
// problem is the viewport has been mucked with
// current_options.toggle_panel();
// current_options.toggle_panel();
xglViewport(0, 0, (GLint)(v->winWidth), (GLint)(v->winHeight) );
FGPanel::OurPanel->ReInit(0, 0, 1024, 768);
}
} }
void cancelAPAdjust(puObject *) void cancelAPAdjust(puObject *)

View file

@ -73,9 +73,14 @@ static float alpha;
static int n1; static int n1;
static int n2; static int n2;
static GLfloat Wings[] = {-1.25, -28.125, 1.255, -28.125, 1.255, 28.125, -1.25, 28.125}; static GLfloat Wings[] = {
static GLfloat Elevator[] = { 3.0, -10.9375, 4.5, -10.9375, 4.5, 10.9375, 3.0, 10.9375}; -1.25, -28.125, 1.255, -28.125, 1.255, 28.125, -1.25, 28.125};
static GLfloat Rudder[] = {2.0, -0.45, 10.625, -0.45, 10.625, 0.55, 2.0, 0.55};
static GLfloat Elevator[] = {
3.0, -10.9375, 4.5, -10.9375, 4.5, 10.9375, 3.0, 10.9375};
static GLfloat Rudder[] = {
2.0, -0.45, 10.625, -0.45, 10.625, 0.55, 2.0, 0.55};
FGPanel* FGPanel::OurPanel = 0; FGPanel* FGPanel::OurPanel = 0;
@ -87,23 +92,33 @@ FGPanel::FGPanel(void){
GLint test; GLint test;
GLubyte *tex = new GLubyte[262144]; GLubyte *tex = new GLubyte[262144];
OurPanel = this; if(OurPanel) {
FG_LOG( FG_GENERAL, FG_ALERT, "Error: only one Panel allowed" );
exit(-1);
}
OurPanel = this;
Xzoom = (float)((float)(current_view.get_winWidth())/1024); Xzoom = (float)((float)(current_view.get_winWidth())/1024);
Yzoom = (float)((float)(current_view.get_winHeight())/768); Yzoom = (float)((float)(current_view.get_winHeight())/768);
test_instr[3] = new FGTexInstrument(144.375, 166.875, 4, 32, 3, 30, 15.0, 260.0, -20.0, 360, 65, 193, 0); test_instr[3] = new FGTexInstrument(144.375, 166.875, 4, 32, 3, 30, 15.0,
test_instr[4] = new FGTexInstrument(358, 52, 4, 30, 3, 30, -3.0, 3.0, 100, 440, 66.15, 66, 2); 260.0, -20.0, 360, 65, 193, 0);
test_instr[5] = new FGTexInstrument(357.5, 167, 5, 25, 4, 30, 0, 10000, 0, 360, 194, 191, 1); test_instr[4] = new FGTexInstrument(358, 52, 4, 30, 3, 30, -3.0, 3.0, 100,
test_instr[6] = new FGTexInstrument(357.5, 167, 5, 32, 3, 30, 0, 3000, 0, 1080, 194, 191, 1); 440, 66.15, 66, 2);
test_instr[0] = new FGHorizon(251, 166.75); test_instr[5] = new FGTexInstrument(357.5, 167, 5, 25, 4, 30, 0, 10000, 0,
test_instr[1] = new FGTurnCoordinator(143.75, 51.75); 360, 194, 191, 1);
//test_instr[2] = new FGRpmGauge(462.5, 133); test_instr[6] = new FGTexInstrument(357.5, 167, 5, 32, 3, 30, 0, 3000, 0,
test_instr[2] = new FGTexInstrument(462.5, 133, 10, 20, 5.5, 60, 0.0, 1.0, -67, 180, 174, 83, 3); 1080, 194, 191, 1);
test_instr[0] = new FGHorizon(251, 166.75);
test_instr[1] = new FGTurnCoordinator(143.75, 51.75);
//test_instr[2] = new FGRpmGauge(462.5, 133);
test_instr[2] = new FGTexInstrument(462.5, 133, 10, 20, 5.5, 60, 0.0, 1.0,
-67, 180, 174, 83, 3);
// FontList = glGenLists (256); // FontList = glGenLists (256);
// glListBase(FontList); // glListBase(FontList);
// InitLists(); // InitLists();
#ifdef GL_VERSION_1_1 #ifdef GL_VERSION_1_1
xglGenTextures(2, panel_tex_id); xglGenTextures(2, panel_tex_id);
@ -150,21 +165,21 @@ test_instr[2] = new FGTexInstrument(462.5, 133, 10, 20, 5.5, 60, 0.0, 1.0,
if ((background = read_rgb_texture( (char *)tpath.c_str(), &width, &height ))==NULL ){ if ((background = read_rgb_texture( (char *)tpath.c_str(), &width, &height ))==NULL ){
} }
// for(y=0;y<256;y++){ // for(y=0;y<256;y++){
// for(x=0;x<256;x++){ // for(x=0;x<256;x++){
// tex[(y+x*256)*3] = imag[(y+x*256)*3]; // tex[(y+x*256)*3] = imag[(y+x*256)*3];
// tex[(y+x*256)*3 + 1] = imag[(y+x*256)*3 + 1]; // tex[(y+x*256)*3 + 1] = imag[(y+x*256)*3 + 1];
// tex[(y+x*256)*3 + 2] = imag[(y+x*256)*3 + 2]; // tex[(y+x*256)*3 + 2] = imag[(y+x*256)*3 + 2];
// tex[(y+x*256)*3 + 3] = (imag[(y+x*256)*3 + 1] + imag[(y+x*256)*3 + 2] // + imag[(y+x*256)*3 + 0])/3; // tex[(y+x*256)*3 + 3] = (imag[(y+x*256)*3 + 1] + imag[(y+x*256)*3 + 2] // + imag[(y+x*256)*3 + 0])/3;
// //
// if((imag[(y+x*256)*3] < 150) && (imag[(y+x*256)*3 +1] < 150) && // (imag[(y+x*256)*3 + 2] < 150) ){ // if((imag[(y+x*256)*3] < 150) && (imag[(y+x*256)*3 +1] < 150) && // (imag[(y+x*256)*3 + 2] < 150) ){
// tex[(y+x*256)*3 + 3] = 0x0; // tex[(y+x*256)*3 + 3] = 0x0;
// } // }
// else{ // else{
// tex[(y+x*256)*3 + 3] = 0xff; // tex[(y+x*256)*3 + 3] = 0xff;
// } // }
// } // }
// } // }
xglPixelZoom(Xzoom, Yzoom); xglPixelZoom(Xzoom, Yzoom);
xglPixelStorei(GL_UNPACK_ALIGNMENT, 1); xglPixelStorei(GL_UNPACK_ALIGNMENT, 1);
@ -194,6 +209,7 @@ test_instr[2] = new FGTexInstrument(462.5, 133, 10, 20, 5.5, 60, 0.0, 1.0,
void FGPanel::ReInit( int x, int y, int finx, int finy){ void FGPanel::ReInit( int x, int y, int finx, int finy){
fgOPTIONS *o; fgOPTIONS *o;
FGView *v = &current_view;
int i; int i;
GLint buffer; GLint buffer;
@ -226,7 +242,8 @@ void FGPanel::ReInit( int x, int y, int finx, int finy){
xglPixelStorei(GL_UNPACK_SKIP_ROWS, y); xglPixelStorei(GL_UNPACK_SKIP_ROWS, y);
xglRasterPos2i(x, y); xglRasterPos2i(x, y);
xglPixelZoom(Xzoom, Yzoom); xglPixelZoom(Xzoom, Yzoom);
xglDrawPixels(finx - x, finy - y, GL_RGB, GL_UNSIGNED_BYTE, (GLvoid *)(background)); xglDrawPixels(finx - x, finy - y, GL_RGB, GL_UNSIGNED_BYTE,
(GLvoid *)(background));
// restore original buffer state // restore original buffer state
xglDrawBuffer( (GLenum)buffer ); xglDrawBuffer( (GLenum)buffer );
@ -242,8 +259,8 @@ void FGPanel::Update ( void ) {
double speed; double speed;
int i; int i;
// static bool beech_drawn = false; // static bool beech_drawn = false;
// char *test = "ALM 100"; // char *test = "ALM 100";
var[0] = get_speed() /* * 1.4 */; // We have to multiply the airspeed by a var[0] = get_speed() /* * 1.4 */; // We have to multiply the airspeed by a
// factor, to simulate flying a Bonanza // factor, to simulate flying a Bonanza
@ -278,8 +295,8 @@ void FGPanel::Update ( void ) {
test_instr[1]->Render(); test_instr[1]->Render();
test_instr[2]->Render(); test_instr[2]->Render();
// DrawBeechcraftLogo(230, 235, 30, 10); // DrawBeechcraftLogo(230, 235, 30, 10);
// DrawScale(144.375, 166.875, 38, 41.0, 18, 340, 44, 2.0, 1.0, 1.0, 1.0); // DrawScale(144.375, 166.875, 38, 41.0, 18, 340, 44, 2.0, 1.0, 1.0, 1.0);
xglEnable(GL_LIGHTING); xglEnable(GL_LIGHTING);
@ -385,13 +402,13 @@ void FGHorizon::Render(void){
xglLightfv(GL_LIGHT1, GL_SPECULAR, light_specular); xglLightfv(GL_LIGHT1, GL_SPECULAR, light_specular);
xglLightfv(GL_LIGHT1, GL_SPOT_DIRECTION, direction); xglLightfv(GL_LIGHT1, GL_SPOT_DIRECTION, direction);
#ifdef GL_VERSION_1_1 #ifdef GL_VERSION_1_1
xglBindTexture(GL_TEXTURE_2D, panel_tex_id[1]); xglBindTexture(GL_TEXTURE_2D, panel_tex_id[1]);
#elif GL_EXT_texture_object #elif GL_EXT_texture_object
xglBindTextureEXT(GL_TEXTURE_2D, panel_tex_id[1]); xglBindTextureEXT(GL_TEXTURE_2D, panel_tex_id[1]);
#else #else
# error port me # error port me
#endif #endif
xglLoadIdentity(); xglLoadIdentity();
xglTranslatef(0.0, ((pitch / 10) * 0.046875), 0.0); xglTranslatef(0.0, ((pitch / 10) * 0.046875), 0.0);
@ -427,9 +444,9 @@ void FGHorizon::Render(void){
if((shifted > (bottom - radius)) && (n1 < 1000) && (n1 > 0)){ if((shifted > (bottom - radius)) && (n1 < 1000) && (n1 > 0)){
a = sin(theta * DEG_TO_RAD) * sin(theta * DEG_TO_RAD); a = sin(theta * DEG_TO_RAD) * sin(theta * DEG_TO_RAD);
light_ambient2[0] = a; light_ambient2[0] = a;
light_ambient2[1] = a; light_ambient2[1] = a;
light_ambient2[2] = a; light_ambient2[2] = a;
xglLightfv(GL_LIGHT1, GL_AMBIENT, light_ambient2); xglLightfv(GL_LIGHT1, GL_AMBIENT, light_ambient2);
xglLightfv(GL_LIGHT1, GL_DIFFUSE, light_ambient2); xglLightfv(GL_LIGHT1, GL_DIFFUSE, light_ambient2);
@ -443,7 +460,9 @@ light_ambient2[2] = a;
n = i % 180; n = i % 180;
xglNormal3f(0.0, 0.0, 1.5); xglNormal3f(0.0, 0.0, 1.5);
xglTexCoord2f((56 / 256), (140 / 256)); xglTexCoord2f((56 / 256), (140 / 256));
xglVertex3f(((vertices[n1 % 180][0] + vertices[n2 % 180][0]) / 2), ((vertices[n1 % 180][1] + vertices[n2 % 180][1]) / 2), 0.0); xglVertex3f(((vertices[n1 % 180][0] + vertices[n2 % 180][0]) / 2),
((vertices[n1 % 180][1] + vertices[n2 % 180][1]) / 2),
0.0);
xglTexCoord2f((57 / 256), (139 / 256)); xglTexCoord2f((57 / 256), (139 / 256));
xglNormal3f(normals[n][0], normals[n][1], normals[n][3]); xglNormal3f(normals[n][0], normals[n][1], normals[n][3]);
@ -459,9 +478,9 @@ light_ambient2[2] = a;
if((shifted < (-top + radius)) && (n1 < 1000) && (n1 > 0)){ if((shifted < (-top + radius)) && (n1 < 1000) && (n1 > 0)){
a = sin(theta * DEG_TO_RAD) * sin(theta * DEG_TO_RAD); a = sin(theta * DEG_TO_RAD) * sin(theta * DEG_TO_RAD);
light_ambient2[0] = a; light_ambient2[0] = a;
light_ambient2[1] = a; light_ambient2[1] = a;
light_ambient2[2] = a; light_ambient2[2] = a;
xglLightfv(GL_LIGHT1, GL_AMBIENT, light_ambient2); xglLightfv(GL_LIGHT1, GL_AMBIENT, light_ambient2);
xglLightfv(GL_LIGHT1, GL_DIFFUSE, light_ambient2); xglLightfv(GL_LIGHT1, GL_DIFFUSE, light_ambient2);
@ -473,7 +492,9 @@ light_ambient2[2] = a;
n = i % 180; n = i % 180;
xglNormal3f(0.0, 0.0, 1.5); xglNormal3f(0.0, 0.0, 1.5);
xglTexCoord2f((73 / 256), (237 / 256)); xglTexCoord2f((73 / 256), (237 / 256));
xglVertex3f(((vertices[n1 % 180][0] + vertices[n2 % 180][0]) / 2), ((vertices[n1 % 180][1] + vertices[n2 % 180][1]) / 2), 0.0); xglVertex3f(((vertices[n1 % 180][0] + vertices[n2 % 180][0]) / 2),
((vertices[n1 % 180][1] + vertices[n2 % 180][1]) / 2),
0.0);
xglTexCoord2f((73 / 256), (236 / 256)); xglTexCoord2f((73 / 256), (236 / 256));
xglNormal3f(normals[n][0], normals[n][1], normals[n][2]); xglNormal3f(normals[n][0], normals[n][1], normals[n][2]);
@ -525,7 +546,7 @@ light_ambient2[2] = a;
xglDisable(GL_LIGHTING); xglDisable(GL_LIGHTING);
xglDisable(GL_LIGHT1); xglDisable(GL_LIGHT1);
xglEnable(GL_LIGHT0); xglEnable(GL_LIGHT0);
} }
// fgHorizonInit - initialize values for the AH // fgHorizonInit - initialize values for the AH
@ -537,9 +558,9 @@ void FGHorizon::Init(void){
top = 36.5; top = 36.5;
int n; int n;
float step = (360*DEG_TO_RAD)/180; float step = (360*DEG_TO_RAD)/180;
for(n=0;n<180;n++){ for(n=0;n<180;n++){
vertices[n][0] = cos(n * step) * radius; vertices[n][0] = cos(n * step) * radius;
vertices[n][1] = sin(n * step) * radius; vertices[n][1] = sin(n * step) * radius;
texCoord[n][0] = (cos(n * step) * radius)/256; texCoord[n][0] = (cos(n * step) * radius)/256;
@ -558,7 +579,8 @@ void FGTexInstrument::UpdatePointer(void){
glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_FLOAT, 0, vertices); glVertexPointer(2, GL_FLOAT, 0, vertices);
alpha=((((float)((var[variable]) - (value1))) / (value2 - value1))* (alpha2 - alpha1) + alpha1); alpha=((((float)((var[variable]) - (value1))) /
(value2 - value1))* (alpha2 - alpha1) + alpha1);
if (alpha < alpha1) if (alpha < alpha1)
alpha = alpha1; alpha = alpha1;
@ -582,40 +604,40 @@ void FGTexInstrument::UpdatePointer(void){
// area. Shall be a method of a panel class once. // area. Shall be a method of a panel class once.
void fgEraseArea(GLfloat *array, int NumVerti, GLfloat texXPos, GLfloat texYPos, GLfloat XPos, GLfloat YPos, int Texid, float ScaleFactor){ void fgEraseArea(GLfloat *array, int NumVerti, GLfloat texXPos, GLfloat texYPos, GLfloat XPos, GLfloat YPos, int Texid, float ScaleFactor){
int i, j; int i, j;
int n; int n;
float a; float a;
float ififth; float ififth;
xglEnable(GL_TEXTURE_2D); xglEnable(GL_TEXTURE_2D);
xglEnable(GL_TEXTURE_GEN_S); xglEnable(GL_TEXTURE_GEN_S);
xglEnable(GL_TEXTURE_GEN_T); xglEnable(GL_TEXTURE_GEN_T);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
xglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); xglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
xglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); xglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
xglTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); xglTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
xglMatrixMode(GL_TEXTURE); xglMatrixMode(GL_TEXTURE);
xglLoadIdentity(); xglLoadIdentity();
#ifdef GL_VERSION_1_1 #ifdef GL_VERSION_1_1
xglBindTexture(GL_TEXTURE_2D, panel_tex_id[Texid]); xglBindTexture(GL_TEXTURE_2D, panel_tex_id[Texid]);
#elif GL_EXT_texture_object #elif GL_EXT_texture_object
xglBindTextureEXT(GL_TEXTURE_2D, panel_tex_id[Texid]); xglBindTextureEXT(GL_TEXTURE_2D, panel_tex_id[Texid]);
#else #else
# error port me # error port me
#endif #endif
xglMatrixMode(GL_TEXTURE); xglMatrixMode(GL_TEXTURE);
xglLoadIdentity(); xglLoadIdentity();
xglTranslatef(-((float)((XPos/0.625)/256)), -((float)((YPos/0.625)/256)), 0.0); xglTranslatef(-((float)((XPos/0.625)/256)), -((float)((YPos/0.625)/256)), 0.0);
xglTranslatef(texXPos/256 , texYPos/256, 0.0); xglTranslatef(texXPos/256 , texYPos/256, 0.0);
xglScalef(0.00625, 0.00625, 1.0); xglScalef(0.00625, 0.00625, 1.0);
xglBegin(GL_POLYGON); xglBegin(GL_POLYGON);
for(n=0;n<NumVerti;n += 2){ for(n=0;n<NumVerti;n += 2){
xglVertex2f(array[n] * ScaleFactor, array[n + 1] * ScaleFactor); xglVertex2f(array[n] * ScaleFactor, array[n + 1] * ScaleFactor);
} }
xglEnd(); xglEnd();
xglLoadIdentity(); xglLoadIdentity();
@ -631,48 +653,48 @@ xglVertex2f(array[n] * ScaleFactor, array[n + 1] * ScaleFactor);
// CreatePointer - calculate the vertices of a pointer // CreatePointer - calculate the vertices of a pointer
void FGTexInstrument::CreatePointer(void){ void FGTexInstrument::CreatePointer(void){
int i; int i;
float alpha; float alpha;
float alphastep; float alphastep;
float r = radius; float r = radius;
vertices[0] = 0; vertices[0] = 0;
vertices[1] = length; vertices[1] = length;
vertices[2] = -(width/2); vertices[2] = -(width/2);
vertices[3] = length - ((width/2)/(tan(angle*DEG_TO_RAD/2))); vertices[3] = length - ((width/2)/(tan(angle*DEG_TO_RAD/2)));
vertices[4] = -(width/2); vertices[4] = -(width/2);
vertices[5] = cos(asin((width/2)/r))*r; vertices[5] = cos(asin((width/2)/r))*r;
alphastep = (asin((width/2)/r)+asin((width/2)/r))/5; alphastep = (asin((width/2)/r)+asin((width/2)/r))/5;
alpha = asin(-(width/2)/r); alpha = asin(-(width/2)/r);
for(i=0;i<5;i++){ for(i=0;i<5;i++){
alpha += alphastep; alpha += alphastep;
vertices[(i*2)+6] = sin(alpha)*r; vertices[(i*2)+6] = sin(alpha)*r;
} }
alpha = asin(-(width/2)/r); alpha = asin(-(width/2)/r);
for(i=0;i<5;i++){ for(i=0;i<5;i++){
alpha +=alphastep; alpha +=alphastep;
vertices[(i*2)+7]= cos(alpha)*r; vertices[(i*2)+7]= cos(alpha)*r;
} }
vertices[16] = - vertices[4]; vertices[16] = - vertices[4];
vertices[17] = vertices[5]; vertices[17] = vertices[5];
vertices[18] = - vertices[2]; vertices[18] = - vertices[2];
vertices[19] = vertices[3]; vertices[19] = vertices[3];
} }
// fgUpdateTurnCoordinator - draws turn coordinator related stuff // fgUpdateTurnCoordinator - draws turn coordinator related stuff
void FGTurnCoordinator::Render(void){ void FGTurnCoordinator::Render(void){
int n; int n;
xglDisable(GL_LIGHTING); xglDisable(GL_LIGHTING);
xglDisable(GL_BLEND); xglDisable(GL_BLEND);
xglEnable(GL_TEXTURE_2D); xglEnable(GL_TEXTURE_2D);
alpha = (get_sideslip() / 1.5) * 560; alpha = (get_sideslip() / 1.5) * 560;
if(alpha > 56){ if(alpha > 56){
@ -688,108 +710,110 @@ xglEnable(GL_TEXTURE_2D);
xglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); xglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
xglTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); xglTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
xglMatrixMode(GL_MODELVIEW); xglMatrixMode(GL_MODELVIEW);
xglLoadIdentity(); xglLoadIdentity();
xglTranslatef(BallXPos, BallYPos, 0.0); xglTranslatef(BallXPos, BallYPos, 0.0);
xglTranslatef(0.75 * sin(alphahist[0] * DEG_TO_RAD) * 31, 0.3 * (39 - (cos(alphahist[0] * DEG_TO_RAD) * 39)), 0.0); xglTranslatef(0.75 * sin(alphahist[0] * DEG_TO_RAD) * 31, 0.3 * (39 - (cos(alphahist[0] * DEG_TO_RAD) * 39)), 0.0);
fgEraseArea(vertices, 72, BallTexXPos + ((0.75 * sin(alphahist[0] * DEG_TO_RAD) * 31) / 0.625), BallTexYPos + ((0.3 * (39 - (cos(alphahist[0] * DEG_TO_RAD) * 39))) / 0.625), BallXPos + (0.75 * sin(alphahist[0] * DEG_TO_RAD) * 31), BallYPos + (0.3 * (39 - (cos(alphahist[0] * DEG_TO_RAD) * 39))), 1, 1); fgEraseArea(vertices, 72, BallTexXPos + ((0.75 * sin(alphahist[0] * DEG_TO_RAD) * 31) / 0.625), BallTexYPos + ((0.3 * (39 - (cos(alphahist[0] * DEG_TO_RAD) * 39))) / 0.625), BallXPos + (0.75 * sin(alphahist[0] * DEG_TO_RAD) * 31), BallYPos + (0.3 * (39 - (cos(alphahist[0] * DEG_TO_RAD) * 39))), 1, 1);
xglDisable(GL_TEXTURE_2D); xglDisable(GL_TEXTURE_2D);
xglEnable(GL_BLEND); xglEnable(GL_BLEND);
xglBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ONE); xglBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ONE);
xglMatrixMode(GL_MODELVIEW); xglMatrixMode(GL_MODELVIEW);
xglLoadIdentity(); xglLoadIdentity();
xglTranslatef(BallXPos, BallYPos, 0.0); xglTranslatef(BallXPos, BallYPos, 0.0);
xglTranslatef(0.75 * sin(alpha * DEG_TO_RAD) * 31, 0.3 * (39 - (cos(alpha * DEG_TO_RAD) * 39)), 0.0); xglTranslatef(0.75 * sin(alpha * DEG_TO_RAD) * 31, 0.3 * (39 - (cos(alpha * DEG_TO_RAD) * 39)), 0.0);
xglBegin(GL_POLYGON); xglBegin(GL_POLYGON);
xglColor3f(0.8, 0.8, 0.8); xglColor3f(0.8, 0.8, 0.8);
for(i=0;i<36;i++){ for(i=0;i<36;i++){
xglVertex2f(vertices[2 * i], vertices[(2 * i) + 1]); xglVertex2f(vertices[2 * i], vertices[(2 * i) + 1]);
} }
xglEnd(); xglEnd();
xglDisable(GL_TEXTURE_2D); xglDisable(GL_TEXTURE_2D);
xglDisable(GL_BLEND); xglDisable(GL_BLEND);
xglMatrixMode(GL_MODELVIEW); xglMatrixMode(GL_MODELVIEW);
xglLoadIdentity(); xglLoadIdentity();
xglTranslatef(XPos, YPos, 0.0); xglTranslatef(XPos, YPos, 0.0);
xglRotatef(rollhist[0] * RAD_TO_DEG + 90, 0.0, 0.0, 1.0); xglRotatef(rollhist[0] * RAD_TO_DEG + 90, 0.0, 0.0, 1.0);
fgEraseArea(Wings, 8, PlaneTexXPos, PlaneTexYPos, XPos, YPos, 1, 1); fgEraseArea(Wings, 8, PlaneTexXPos, PlaneTexYPos, XPos, YPos, 1, 1);
fgEraseArea(Elevator, 8, PlaneTexXPos, PlaneTexYPos, XPos, YPos, 1, 1); fgEraseArea(Elevator, 8, PlaneTexXPos, PlaneTexYPos, XPos, YPos, 1, 1);
fgEraseArea(Rudder, 8, PlaneTexXPos, PlaneTexYPos, XPos, YPos, 1, 1); fgEraseArea(Rudder, 8, PlaneTexXPos, PlaneTexYPos, XPos, YPos, 1, 1);
xglLoadIdentity(); xglLoadIdentity();
xglTranslatef(XPos, YPos, 0.0); xglTranslatef(XPos, YPos, 0.0);
xglRotatef(-get_roll() * RAD_TO_DEG + 90, 0.0, 0.0, 1.0); xglRotatef(-get_roll() * RAD_TO_DEG + 90, 0.0, 0.0, 1.0);
xglBegin(GL_POLYGON); xglBegin(GL_POLYGON);
xglColor3f(1.0, 1.0, 1.0); xglColor3f(1.0, 1.0, 1.0);
for(i=0;i<90;i++){ for(i=0;i<90;i++){
xglVertex2f(cos(i * 4 * DEG_TO_RAD) * 5, sin(i * 4 * DEG_TO_RAD) * 5); xglVertex2f(cos(i * 4 * DEG_TO_RAD) * 5, sin(i * 4 * DEG_TO_RAD) * 5);
} }
xglEnd(); xglEnd();
xglBegin(GL_POLYGON); xglBegin(GL_POLYGON);
xglVertex2f(Wings[0], Wings[1]); xglVertex2f(Wings[0], Wings[1]);
xglVertex2f(Wings[2], Wings[3]); xglVertex2f(Wings[2], Wings[3]);
xglVertex2f(Wings[4], Wings[5]); xglVertex2f(Wings[4], Wings[5]);
xglVertex2f(Wings[6], Wings[7]); xglVertex2f(Wings[6], Wings[7]);
xglVertex2f(Wings[0], Wings[1]); xglVertex2f(Wings[0], Wings[1]);
xglEnd(); xglEnd();
xglBegin(GL_POLYGON); xglBegin(GL_POLYGON);
xglVertex2f(Elevator[0], Elevator[1]); xglVertex2f(Elevator[0], Elevator[1]);
xglVertex2f(Elevator[2], Elevator[3]); xglVertex2f(Elevator[2], Elevator[3]);
xglVertex2f(Elevator[4], Elevator[5]); xglVertex2f(Elevator[4], Elevator[5]);
xglVertex2f(Elevator[6], Elevator[7]); xglVertex2f(Elevator[6], Elevator[7]);
xglVertex2f(Elevator[0], Elevator[1]); xglVertex2f(Elevator[0], Elevator[1]);
xglEnd(); xglEnd();
xglBegin(GL_POLYGON); xglBegin(GL_POLYGON);
xglVertex2f(Rudder[0], Rudder[1]); xglVertex2f(Rudder[0], Rudder[1]);
xglVertex2f(Rudder[2], Rudder[3]); xglVertex2f(Rudder[2], Rudder[3]);
xglVertex2f(Rudder[4], Rudder[5]); xglVertex2f(Rudder[4], Rudder[5]);
xglVertex2f(Rudder[6], Rudder[7]); xglVertex2f(Rudder[6], Rudder[7]);
xglVertex2f(Rudder[0], Rudder[1]); xglVertex2f(Rudder[0], Rudder[1]);
xglEnd(); xglEnd();
alphahist[0] = alphahist[1]; alphahist[0] = alphahist[1];
alphahist[1] = alpha; alphahist[1] = alpha;
rollhist[0] = rollhist[1]; rollhist[0] = rollhist[1];
rollhist[1] = -get_roll(); rollhist[1] = -get_roll();
xglDisable(GL_BLEND); xglDisable(GL_BLEND);
} }
void FGTurnCoordinator::Init(void){ void FGTurnCoordinator::Init(void){
int n; int n;
PlaneTexXPos = 49; PlaneTexXPos = 49;
PlaneTexYPos = 59.75; PlaneTexYPos = 59.75;
BallXPos = 145; BallXPos = 145;
BallYPos = 24; BallYPos = 24;
BallTexXPos = 49; BallTexXPos = 49;
BallTexYPos = 16; BallTexYPos = 16;
BallRadius = 3.5; BallRadius = 3.5;
for(n=0;n<36;n++){ for(n=0;n<36;n++){
vertices[2 * n] = cos(10 * n * DEG_TO_RAD) * BallRadius; vertices[2 * n] = cos(10 * n * DEG_TO_RAD) * BallRadius;
vertices[(2 * n) + 1] = sin(10 * n * DEG_TO_RAD) * BallRadius; vertices[(2 * n) + 1] = sin(10 * n * DEG_TO_RAD) * BallRadius;
} }
} }
void DrawScale(float XPos, float YPos, float InnerRadius, float OuterRadius, float alpha1, float alpha2, int steps, float LineWidth, float red, float green, float blue, bool filled){ void DrawScale(float XPos, float YPos, float InnerRadius, float OuterRadius,
float alpha1, float alpha2, int steps, float LineWidth,
float red, float green, float blue, bool filled){
int i; int i;
float diff = (alpha2 - alpha1) / (float)(steps - 1); float diff = (alpha2 - alpha1) / (float)(steps - 1);
#define ANTIALIASED_INSTRUMENTS #define ANTIALIASED_INSTRUMENTS
#ifdef ANTIALIASED_INSTRUMENTS #ifdef ANTIALIASED_INSTRUMENTS
xglEnable(GL_LINE_SMOOTH); xglEnable(GL_LINE_SMOOTH);
xglEnable(GL_BLEND); xglEnable(GL_BLEND);
xglHint(GL_LINE_SMOOTH_HINT, GL_FASTEST); xglHint(GL_LINE_SMOOTH_HINT, GL_FASTEST);
#endif #endif
xglMatrixMode(GL_MODELVIEW); xglMatrixMode(GL_MODELVIEW);
xglLoadIdentity(); xglLoadIdentity();
@ -808,15 +832,17 @@ void DrawScale(float XPos, float YPos, float InnerRadius, float OuterRadius,
} }
for(i=0;i < steps; i++){ for(i=0;i < steps; i++){
xglVertex3f(sin(i * diff * DEG_TO_RAD) * OuterRadius, cos(i * diff * DEG_TO_RAD) * OuterRadius, 0.0); xglVertex3f(sin(i * diff * DEG_TO_RAD) * OuterRadius,
xglVertex3f(sin(i * diff * DEG_TO_RAD) * InnerRadius, cos(i * diff * DEG_TO_RAD) * InnerRadius, 0.0); cos(i * diff * DEG_TO_RAD) * OuterRadius, 0.0);
xglVertex3f(sin(i * diff * DEG_TO_RAD) * InnerRadius,
cos(i * diff * DEG_TO_RAD) * InnerRadius, 0.0);
} }
xglEnd(); xglEnd();
xglLoadIdentity(); xglLoadIdentity();
xglDisable(GL_LINE_SMOOTH); xglDisable(GL_LINE_SMOOTH);
xglDisable(GL_BLEND); xglDisable(GL_BLEND);
} }
void DrawBeechcraftLogo(float XPos, float YPos, float width, float height){ void DrawBeechcraftLogo(float XPos, float YPos, float width, float height){
xglMatrixMode(GL_MODELVIEW); xglMatrixMode(GL_MODELVIEW);
@ -824,16 +850,16 @@ void DrawBeechcraftLogo(float XPos, float YPos, float width, float height){
xglTranslatef(XPos, YPos, 0.0); xglTranslatef(XPos, YPos, 0.0);
xglEnable(GL_BLEND); xglEnable(GL_BLEND);
xglEnable(GL_TEXTURE_2D); xglEnable(GL_TEXTURE_2D);
// xglTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_BLEND); // xglTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_BLEND);
// xglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // xglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
#ifdef GL_VERSION_1_1 #ifdef GL_VERSION_1_1
xglBindTexture(GL_TEXTURE_2D, panel_tex_id[1]); xglBindTexture(GL_TEXTURE_2D, panel_tex_id[1]);
#elif GL_EXT_texture_object #elif GL_EXT_texture_object
xglBindTextureEXT(GL_TEXTURE_2D, panel_tex_id[1]); xglBindTextureEXT(GL_TEXTURE_2D, panel_tex_id[1]);
#else #else
# error port me # error port me
#endif #endif
xglBegin(GL_POLYGON); xglBegin(GL_POLYGON);
@ -850,17 +876,21 @@ void DrawBeechcraftLogo(float XPos, float YPos, float width, float height){
xglDisable(GL_BLEND); xglDisable(GL_BLEND);
xglDisable(GL_TEXTURE_2D); xglDisable(GL_TEXTURE_2D);
} }
// PrintMatrix - routine to print the current modelview matrix. // PrintMatrix - routine to print the current modelview matrix.
void PrintMatrix( void){ void PrintMatrix( void){
xglGetDoublev(GL_MODELVIEW_MATRIX, mvmatrix); xglGetDoublev(GL_MODELVIEW_MATRIX, mvmatrix);
printf("matrix2 = %f %f %f %f \n", mvmatrix[0], mvmatrix[1], mvmatrix[2], mvmatrix[3]); printf("matrix2 = %f %f %f %f \n",
printf(" %f %f %f %f \n", mvmatrix[4], mvmatrix[5], mvmatrix[6], mvmatrix[7]); mvmatrix[0], mvmatrix[1], mvmatrix[2], mvmatrix[3]);
printf(" %f %f %f %f \n", mvmatrix[8], mvmatrix[9], mvmatrix[10], mvmatrix[11]); printf(" %f %f %f %f \n",
printf(" %f %f %f %f \n", mvmatrix[12], mvmatrix[13], mvmatrix[14], mvmatrix[15]); mvmatrix[4], mvmatrix[5], mvmatrix[6], mvmatrix[7]);
printf(" %f %f %f %f \n",
mvmatrix[8], mvmatrix[9], mvmatrix[10], mvmatrix[11]);
printf(" %f %f %f %f \n",
mvmatrix[12], mvmatrix[13], mvmatrix[14], mvmatrix[15]);
} }
void FGRpmGauge::Init(void){ void FGRpmGauge::Init(void){
@ -876,12 +906,12 @@ void FGRpmGauge::Init(void){
} }
xglEnd(); xglEnd();
DrawScale(XPos, YPos, 22.5, 25.625, 50, 135, 10, 1.0, 0.0, 0.7, 0.0,FILLED); DrawScale(XPos, YPos, 22.5, 25.625, 50, 135, 10, 1.0, 0.0, 0.7, 0.0,FILLED);
DrawScale(XPos, YPos, 21.0, 25.625, -70, 180, 8, 1.8, 0.88, 0.88, 0.88, false); DrawScale(XPos, YPos, 21.0, 25.625, -70, 180, 8, 1.8, 0.88, 0.88, 0.88, false);
DrawScale(XPos, YPos, 22.5, 25.0, -70, 180, 40, 0.6, 0.5, 0.5, 0.5, false); DrawScale(XPos, YPos, 22.5, 25.0, -70, 180, 40, 0.6, 0.5, 0.5, 0.5, false);
xglEndList(); xglEndList();
} }
void FGRpmGauge::Render(void){ void FGRpmGauge::Render(void){
xglMatrixMode(GL_MODELVIEW); xglMatrixMode(GL_MODELVIEW);
@ -890,7 +920,7 @@ void FGRpmGauge::Render(void){
xglCallList(list); xglCallList(list);
} }
void FGPanel::DrawTestLetter(float X, float Y){ void FGPanel::DrawTestLetter(float X, float Y){
xglEnable(GL_TEXTURE_2D); xglEnable(GL_TEXTURE_2D);
@ -906,7 +936,7 @@ void FGPanel::DrawTestLetter(float X, float Y){
xglTranslatef(6.0, 0.0, 0.0); xglTranslatef(6.0, 0.0, 0.0);
xglDisable(GL_TEXTURE_2D); xglDisable(GL_TEXTURE_2D);
xglDisable(GL_BLEND); xglDisable(GL_BLEND);
} }
void FGPanel::InitLists(void){ void FGPanel::InitLists(void){
xglNewList(FontList + 'A', GL_COMPILE); xglNewList(FontList + 'A', GL_COMPILE);
@ -1020,7 +1050,7 @@ void FGPanel::InitLists(void){
xglNewList(FontList + ' ', GL_COMPILE); xglNewList(FontList + ' ', GL_COMPILE);
xglTranslatef(8.0, 0.0, 0.0); xglTranslatef(8.0, 0.0, 0.0);
xglEndList(); xglEndList();
} }
void FGPanel::TexString(char *s, float XPos, float YPos, float size){ void FGPanel::TexString(char *s, float XPos, float YPos, float size){
xglMatrixMode(GL_MODELVIEW); xglMatrixMode(GL_MODELVIEW);
@ -1028,27 +1058,27 @@ void FGPanel::TexString(char *s, float XPos, float YPos, float size){
xglTranslatef(XPos, YPos, 0.0); xglTranslatef(XPos, YPos, 0.0);
xglScalef(size, size, 1.0); xglScalef(size, size, 1.0);
#ifdef GL_VERSION_1_1 #ifdef GL_VERSION_1_1
xglBindTexture(GL_TEXTURE_2D, panel_tex_id[1]); xglBindTexture(GL_TEXTURE_2D, panel_tex_id[1]);
#elif GL_EXT_texture_object #elif GL_EXT_texture_object
xglBindTextureEXT(GL_TEXTURE_2D, panel_tex_id[1]); xglBindTextureEXT(GL_TEXTURE_2D, panel_tex_id[1]);
#else #else
# error port me # error port me
#endif #endif
while((*s) != '\0'){ while((*s) != '\0'){
xglCallList(FontList + (*s)); xglCallList(FontList + (*s));
s++; s++;
} }
xglLoadIdentity(); xglLoadIdentity();
} }
void FGTexInstrument::Init(void){ void FGTexInstrument::Init(void){
CreatePointer(); CreatePointer();
} }
void FGTexInstrument::Render(void){ void FGTexInstrument::Render(void){
xglEnable(GL_TEXTURE_2D); xglEnable(GL_TEXTURE_2D);
xglLoadIdentity(); xglLoadIdentity();
xglTranslatef(XPos, YPos, 0.0); xglTranslatef(XPos, YPos, 0.0);
xglRotatef(-tape[0], 0.0, 0.0, 1.0); xglRotatef(-tape[0], 0.0, 0.0, 1.0);
@ -1057,5 +1087,5 @@ xglEnable(GL_TEXTURE_2D);
UpdatePointer(); UpdatePointer();
xglDisable(GL_TEXTURE_2D); xglDisable(GL_TEXTURE_2D);
} }

View file

@ -48,9 +48,11 @@
#include <Debug/logstream.hxx> #include <Debug/logstream.hxx>
#include <Aircraft/aircraft.hxx> #include <Aircraft/aircraft.hxx>
#include <Airports/simple.hxx> #include <Airports/simple.hxx>
#include <Cockpit/panel.hxx>
#include <FDM/flight.hxx> #include <FDM/flight.hxx>
#include <Main/options.hxx> #include <Main/options.hxx>
#include <Main/fg_init.hxx> #include <Main/fg_init.hxx>
#include <Main/views.hxx>
#include <Time/fg_time.hxx> #include <Time/fg_time.hxx>
#include "gui.h" #include "gui.h"
@ -114,7 +116,17 @@ void guiGetMouse(int *x, int *y)
void reInit(puObject *cb) void reInit(puObject *cb)
{ {
FGView *v = &current_view;
fgReInitSubsystems(); fgReInitSubsystems();
if ( current_options.get_panel_status() ) {
// this seems to be the only way to do this :-(
// problem is the viewport has been mucked with
// current_options.toggle_panel();
// current_options.toggle_panel();
xglViewport(0, 0 ,
(GLint)(v->winWidth), (GLint)(v->winHeight) );
FGPanel::OurPanel->ReInit(0, 0, 1024, 768);
}
} }
void guiToggleMenu(void) void guiToggleMenu(void)
@ -124,6 +136,10 @@ void guiToggleMenu(void)
hideMenuButton -> invokeCallback(); hideMenuButton -> invokeCallback();
} }
void guiTogglePanel(puObject *cb)
{
current_options.toggle_panel();
}
void MenuHideMenuCb(puObject *cb) void MenuHideMenuCb(puObject *cb)
{ {
@ -133,32 +149,35 @@ void MenuHideMenuCb(puObject *cb)
#if defined ( WIN32 ) || defined(__CYGWIN32__) #if defined ( WIN32 ) || defined(__CYGWIN32__)
glutSetCursor(GLUT_CURSOR_NONE); glutSetCursor(GLUT_CURSOR_NONE);
#else // I guess this is what we want to do ?? #else // I guess this is what we want to do ??
// puHideCursor(); // does not work with VooDoo #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
glutWarpPointer( glutGet(GLUT_SCREEN_WIDTH), glutGet(GLUT_SCREEN_HEIGHT));
#endif
#endif #endif
} }
void hideMenuCb (puObject *cb) void hideMenuCb (puObject *cb)
{ {
if (cb -> getValue () ) if (cb -> getValue () ) {
{
mainMenuBar -> reveal(); mainMenuBar -> reveal();
// printf("Showing Menu\n"); // printf("Showing Menu\n");
hideMenuButton -> setLegend ("Hide Menu"); hideMenuButton -> setLegend ("Hide Menu");
#if defined ( WIN32 ) || defined(__CYGWIN32__) #if defined ( WIN32 ) || defined(__CYGWIN32__)
glutSetCursor(GLUT_CURSOR_INHERIT); glutSetCursor(GLUT_CURSOR_INHERIT);
#else // I guess this is what we want to do ?? #else // I guess this is what we want to do ??
// puShowCursor(); // does not work with VooDoo glutWarpPointer( glutGet(GLUT_SCREEN_WIDTH)/2,
glutGet(GLUT_SCREEN_HEIGHT)/2 );
#endif #endif
} } else{
else
{
mainMenuBar -> hide (); mainMenuBar -> hide ();
// printf("Hiding Menu\n"); // printf("Hiding Menu\n");
hideMenuButton -> setLegend ("Show Menu"); hideMenuButton -> setLegend ("Show Menu");
#if defined ( WIN32 ) || defined(__CYGWIN32__) #if defined ( WIN32 ) || defined(__CYGWIN32__)
glutSetCursor(GLUT_CURSOR_NONE); glutSetCursor(GLUT_CURSOR_NONE);
#else // I guess this is what we want to do ?? #else // I guess this is what we want to do ??
// puHideCursor(); // does not work with VooDoo #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
glutWarpPointer( glutGet(GLUT_SCREEN_WIDTH),
glutGet(GLUT_SCREEN_HEIGHT));
#endif
#endif #endif
} }
} }
@ -191,7 +210,7 @@ void goAwayCb (puObject *me)
dialogBox = NULL; dialogBox = NULL;
} }
void mkDialog (char *txt) void mkDialog (const char *txt)
{ {
dialogBox = new puDialogBox (150, 50); dialogBox = new puDialogBox (150, 50);
{ {
@ -301,6 +320,17 @@ static void validateApt (puObject *inpApt)
void AptDialog_Cancel(puObject *) void AptDialog_Cancel(puObject *)
{ {
FGTime *t = FGTime::cur_time_params; FGTime *t = FGTime::cur_time_params;
FGView *v = &current_view;
if ( current_options.get_panel_status() ) {
// this seems to be the only way to do this :-(
// problem is the viewport has been mucked with
// current_options.toggle_panel();
// current_options.toggle_panel();
xglViewport(0, 0 ,
(GLint)(v->winWidth), (GLint)(v->winHeight) );
FGPanel::OurPanel->ReInit(0, 0, 1024, 768);
}
delete AptDialogResetButton; delete AptDialogResetButton;
AptDialogResetButton = NULL; AptDialogResetButton = NULL;
@ -393,27 +423,38 @@ void NewAirportInit(puObject *cb)
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
char *fileSubmenu [] = { char *fileSubmenu [] = {
"Exit", "Close", "---------", "Print", "---------", "Save", "Reset", NULL }; "Exit", "Close", "---------", "Print", "---------", "Save", "Reset", NULL };
puCallback fileSubmenuCb [] = {
goodBye, MenuHideMenuCb, NULL, notCb, NULL, notCb, reInit, NULL};
char *editSubmenu [] = { char *editSubmenu [] = {
"Edit text", NULL }; "Edit text", NULL };
puCallback editSubmenuCb [] = {
notCb, NULL };
char *viewSubmenu [] = { char *viewSubmenu [] = {
"Cockpit View > ", "View >","------------", "View options...", NULL }; "Cockpit View > ", "View >","------------", "Toggle Panel...", NULL };
puCallback viewSubmenuCb [] = {
notCb, notCb, NULL, guiTogglePanel, NULL };
char *aircraftSubmenu [] = { char *aircraftSubmenu [] = {
"Autopilot ...", "Engine ...", "Navigation", "Communication", NULL}; "Autopilot ...", "Engine ...", "Navigation", "Communication", NULL};
puCallback aircraftSubmenuCb [] = {
fgAPAdjust, notCb, notCb, notCb, NULL };
char *environmentSubmenu [] = { char *environmentSubmenu [] = {
"Airport", "Terrain", "Weather", NULL}; "Airport", "Terrain", "Weather", NULL};
puCallback environmentSubmenuCb [] = {
NewAirportInit, notCb, notCb, NULL };
char *optionsSubmenu [] = { char *optionsSubmenu [] = {
"Preferences", "Realism & Reliablity...", NULL}; "Preferences", "Realism & Reliablity...", NULL};
puCallback optionsSubmenuCb [] = {
notCb, notCb, NULL};
char *helpSubmenu [] = { char *helpSubmenu [] = {
"About...", "Help", NULL }; "About...", "Help", NULL };
puCallback helpSubmenuCb [] = {
puCallback fileSubmenuCb [] = { goodBye, MenuHideMenuCb, NULL, notCb, NULL, notCb, reInit, NULL}; notCb, helpCb, NULL };
puCallback editSubmenuCb [] = { notCb, NULL };
puCallback viewSubmenuCb [] = { notCb, notCb, NULL, notCb, NULL };
puCallback aircraftSubmenuCb [] = { fgAPAdjust, notCb, notCb, notCb, NULL };
puCallback environmentSubmenuCb [] = { NewAirportInit, notCb, notCb, NULL };
puCallback optionsSubmenuCb [] = { notCb, notCb, NULL};
puCallback helpSubmenuCb [] = { notCb, helpCb, NULL };
/* ------------------------------------------------------------------------- /* -------------------------------------------------------------------------

View file

@ -31,8 +31,6 @@ extern void guiMotionFunc ( int x, int y );
extern void guiMouseFunc(int button, int updown, int x, int y); extern void guiMouseFunc(int button, int updown, int x, int y);
extern void guiInit(); extern void guiInit();
extern void guiToggleMenu(void); extern void guiToggleMenu(void);
extern void mkDialog (char *txt); void mkDialog (const char *txt);
extern void mkDialog (char *txt);
#endif // _GUI_H_ #endif // _GUI_H_

View file

@ -144,6 +144,9 @@ void GLUTkey(unsigned char k, int x, int y) {
t->adjust_warp(-60); t->adjust_warp(-60);
local_update_sky_and_lighting_params(); local_update_sky_and_lighting_params();
return; return;
case 80: // P key
current_options.toggle_panel();
break;
case 84: // T key case 84: // T key
t->adjust_warp_delta(-30); t->adjust_warp_delta(-30);
local_update_sky_and_lighting_params(); local_update_sky_and_lighting_params();

View file

@ -803,9 +803,9 @@ static void fgIdleFunction ( void ) {
} }
} }
// options.cxx needs to see this for toggle_panel()
// Handle new window size or exposure // Handle new window size or exposure
static void fgReshape( int width, int height ) { void fgReshape( int width, int height ) {
// Do this so we can call fgReshape(0,0) ourselves without having // Do this so we can call fgReshape(0,0) ourselves without having
// to know what the values of width & height are. // to know what the values of width & height are.
if ( (height > 0) && (width > 0) ) { if ( (height > 0) && (width > 0) ) {
@ -859,7 +859,7 @@ int fgGlutInit( int *argc, char **argv ) {
} else { } else {
// Open the cool new 'game mode' window // Open the cool new 'game mode' window
char game_mode_str[256]; char game_mode_str[256];
sprintf( game_mode_str, "width=%d height=%d bpp=16", sprintf( game_mode_str, "width=%d height=%d bpp=32",
current_options.get_xsize(), current_options.get_xsize(),
current_options.get_ysize() ); current_options.get_ysize() );

View file

@ -38,18 +38,22 @@ bool global_fullscreen = true;
#include STL_STRING #include STL_STRING
#include <Debug/logstream.hxx>
#include <Misc/fgstream.hxx>
#include <FDM/flight.hxx>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Include/general.hxx>
#include <Cockpit/cockpit.hxx>
#include <Debug/logstream.hxx>
#include <FDM/flight.hxx>
#include <Misc/fgstream.hxx>
#include <Time/fg_time.hxx> #include <Time/fg_time.hxx>
#include <Main/options.hxx>
#include "options.hxx"
#include "fg_serial.hxx" #include "fg_serial.hxx"
FG_USING_STD(string); FG_USING_STD(string);
FG_USING_NAMESPACE(std); FG_USING_NAMESPACE(std);
// from GLUTmain.cxx
extern void fgReshape( int width, int height );
inline double inline double
atof( const string& str ) atof( const string& str )
@ -203,6 +207,23 @@ fgOPTIONS::fgOPTIONS() :
port_options_list.end() ); port_options_list.end() );
} }
void
fgOPTIONS::toggle_panel() {
if( panel_status ) {
panel_status = false;
} else {
panel_status = true;
}
if ( panel_status ) {
if( FGPanel::OurPanel == 0)
new FGPanel;
fov *= 0.4232;
} else {
fov *= (1.0 /0.4232);
}
fgReshape( xsize, ysize);
}
double double
fgOPTIONS::parse_time(const string& time_in) { fgOPTIONS::parse_time(const string& time_in) {

View file

@ -227,6 +227,7 @@ public:
xglHint ( GL_FOG_HINT, GL_FASTEST ); xglHint ( GL_FOG_HINT, GL_FASTEST );
} }
} }
void toggle_panel();
inline void set_xsize( int x ) { xsize= x; } inline void set_xsize( int x ) { xsize= x; }
inline void set_ysize( int y ) { xsize= y; } inline void set_ysize( int y ) { xsize= y; }