Changes to toggle panel on and off.
This commit is contained in:
parent
e03741be5f
commit
40db8d0c1f
8 changed files with 645 additions and 541 deletions
|
@ -35,6 +35,8 @@
|
|||
#include <Include/fg_constants.h>
|
||||
#include <Debug/logstream.hxx>
|
||||
#include <Main/options.hxx>
|
||||
#include <Cockpit/panel.hxx>
|
||||
#include <Main/views.hxx>
|
||||
|
||||
#include <plib/pu.h>
|
||||
|
||||
|
@ -328,10 +330,18 @@ static void rolloutsmooth_adj( puObject *hs )
|
|||
|
||||
static void goAwayAPAdjust (puObject *)
|
||||
{
|
||||
FGView *v = ¤t_view;
|
||||
puPopLiveInterface ( ) ;
|
||||
// puPopInterface ( ) ;
|
||||
puPopGroup ( ) ;
|
||||
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 *)
|
||||
|
|
|
@ -73,9 +73,14 @@ static float alpha;
|
|||
static int n1;
|
||||
static int n2;
|
||||
|
||||
static GLfloat Wings[] = {-1.25, -28.125, 1.255, -28.125, 1.255, 28.125, -1.25, 28.125};
|
||||
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};
|
||||
static GLfloat Wings[] = {
|
||||
-1.25, -28.125, 1.255, -28.125, 1.255, 28.125, -1.25, 28.125};
|
||||
|
||||
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;
|
||||
|
||||
|
@ -87,19 +92,29 @@ FGPanel::FGPanel(void){
|
|||
GLint test;
|
||||
GLubyte *tex = new GLubyte[262144];
|
||||
|
||||
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);
|
||||
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[4] = new FGTexInstrument(358, 52, 4, 30, 3, 30, -3.0, 3.0, 100, 440, 66.15, 66, 2);
|
||||
test_instr[5] = new FGTexInstrument(357.5, 167, 5, 25, 4, 30, 0, 10000, 0, 360, 194, 191, 1);
|
||||
test_instr[6] = new FGTexInstrument(357.5, 167, 5, 32, 3, 30, 0, 3000, 0, 1080, 194, 191, 1);
|
||||
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[4] = new FGTexInstrument(358, 52, 4, 30, 3, 30, -3.0, 3.0, 100,
|
||||
440, 66.15, 66, 2);
|
||||
test_instr[5] = new FGTexInstrument(357.5, 167, 5, 25, 4, 30, 0, 10000, 0,
|
||||
360, 194, 191, 1);
|
||||
test_instr[6] = new FGTexInstrument(357.5, 167, 5, 32, 3, 30, 0, 3000, 0,
|
||||
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);
|
||||
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);
|
||||
// glListBase(FontList);
|
||||
|
@ -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){
|
||||
fgOPTIONS *o;
|
||||
FGView *v = ¤t_view;
|
||||
int i;
|
||||
GLint buffer;
|
||||
|
||||
|
@ -226,7 +242,8 @@ void FGPanel::ReInit( int x, int y, int finx, int finy){
|
|||
xglPixelStorei(GL_UNPACK_SKIP_ROWS, y);
|
||||
xglRasterPos2i(x, y);
|
||||
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
|
||||
xglDrawBuffer( (GLenum)buffer );
|
||||
|
@ -443,7 +460,9 @@ light_ambient2[2] = a;
|
|||
n = i % 180;
|
||||
xglNormal3f(0.0, 0.0, 1.5);
|
||||
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));
|
||||
xglNormal3f(normals[n][0], normals[n][1], normals[n][3]);
|
||||
|
@ -473,7 +492,9 @@ light_ambient2[2] = a;
|
|||
n = i % 180;
|
||||
xglNormal3f(0.0, 0.0, 1.5);
|
||||
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));
|
||||
xglNormal3f(normals[n][0], normals[n][1], normals[n][2]);
|
||||
|
@ -558,7 +579,8 @@ void FGTexInstrument::UpdatePointer(void){
|
|||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
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)
|
||||
alpha = alpha1;
|
||||
|
@ -779,7 +801,9 @@ 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;
|
||||
float diff = (alpha2 - alpha1) / (float)(steps - 1);
|
||||
|
||||
|
@ -808,8 +832,10 @@ void DrawScale(float XPos, float YPos, float InnerRadius, float OuterRadius,
|
|||
}
|
||||
|
||||
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) * InnerRadius, cos(i * diff * DEG_TO_RAD) * InnerRadius, 0.0);
|
||||
xglVertex3f(sin(i * diff * DEG_TO_RAD) * OuterRadius,
|
||||
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();
|
||||
|
||||
|
@ -857,10 +883,14 @@ void DrawBeechcraftLogo(float XPos, float YPos, float width, float height){
|
|||
|
||||
void PrintMatrix( void){
|
||||
xglGetDoublev(GL_MODELVIEW_MATRIX, mvmatrix);
|
||||
printf("matrix2 = %f %f %f %f \n", mvmatrix[0], mvmatrix[1], mvmatrix[2], mvmatrix[3]);
|
||||
printf(" %f %f %f %f \n", 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]);
|
||||
printf("matrix2 = %f %f %f %f \n",
|
||||
mvmatrix[0], mvmatrix[1], mvmatrix[2], mvmatrix[3]);
|
||||
printf(" %f %f %f %f \n",
|
||||
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){
|
||||
|
|
|
@ -48,9 +48,11 @@
|
|||
#include <Debug/logstream.hxx>
|
||||
#include <Aircraft/aircraft.hxx>
|
||||
#include <Airports/simple.hxx>
|
||||
#include <Cockpit/panel.hxx>
|
||||
#include <FDM/flight.hxx>
|
||||
#include <Main/options.hxx>
|
||||
#include <Main/fg_init.hxx>
|
||||
#include <Main/views.hxx>
|
||||
#include <Time/fg_time.hxx>
|
||||
|
||||
#include "gui.h"
|
||||
|
@ -114,7 +116,17 @@ void guiGetMouse(int *x, int *y)
|
|||
|
||||
void reInit(puObject *cb)
|
||||
{
|
||||
FGView *v = ¤t_view;
|
||||
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)
|
||||
|
@ -124,6 +136,10 @@ void guiToggleMenu(void)
|
|||
hideMenuButton -> invokeCallback();
|
||||
}
|
||||
|
||||
void guiTogglePanel(puObject *cb)
|
||||
{
|
||||
current_options.toggle_panel();
|
||||
}
|
||||
|
||||
void MenuHideMenuCb(puObject *cb)
|
||||
{
|
||||
|
@ -133,32 +149,35 @@ void MenuHideMenuCb(puObject *cb)
|
|||
#if defined ( WIN32 ) || defined(__CYGWIN32__)
|
||||
glutSetCursor(GLUT_CURSOR_NONE);
|
||||
#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
|
||||
}
|
||||
|
||||
void hideMenuCb (puObject *cb)
|
||||
{
|
||||
if (cb -> getValue () )
|
||||
{
|
||||
if (cb -> getValue () ) {
|
||||
mainMenuBar -> reveal();
|
||||
// printf("Showing Menu\n");
|
||||
hideMenuButton -> setLegend ("Hide Menu");
|
||||
#if defined ( WIN32 ) || defined(__CYGWIN32__)
|
||||
glutSetCursor(GLUT_CURSOR_INHERIT);
|
||||
#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
|
||||
}
|
||||
else
|
||||
{
|
||||
} else{
|
||||
mainMenuBar -> hide ();
|
||||
// printf("Hiding Menu\n");
|
||||
hideMenuButton -> setLegend ("Show Menu");
|
||||
#if defined ( WIN32 ) || defined(__CYGWIN32__)
|
||||
glutSetCursor(GLUT_CURSOR_NONE);
|
||||
#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
|
||||
}
|
||||
}
|
||||
|
@ -191,7 +210,7 @@ void goAwayCb (puObject *me)
|
|||
dialogBox = NULL;
|
||||
}
|
||||
|
||||
void mkDialog (char *txt)
|
||||
void mkDialog (const char *txt)
|
||||
{
|
||||
dialogBox = new puDialogBox (150, 50);
|
||||
{
|
||||
|
@ -301,6 +320,17 @@ static void validateApt (puObject *inpApt)
|
|||
void AptDialog_Cancel(puObject *)
|
||||
{
|
||||
FGTime *t = FGTime::cur_time_params;
|
||||
FGView *v = ¤t_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;
|
||||
AptDialogResetButton = NULL;
|
||||
|
@ -393,27 +423,38 @@ void NewAirportInit(puObject *cb)
|
|||
---------------------------------------------------------------------*/
|
||||
char *fileSubmenu [] = {
|
||||
"Exit", "Close", "---------", "Print", "---------", "Save", "Reset", NULL };
|
||||
puCallback fileSubmenuCb [] = {
|
||||
goodBye, MenuHideMenuCb, NULL, notCb, NULL, notCb, reInit, NULL};
|
||||
|
||||
char *editSubmenu [] = {
|
||||
"Edit text", NULL };
|
||||
puCallback editSubmenuCb [] = {
|
||||
notCb, NULL };
|
||||
|
||||
char *viewSubmenu [] = {
|
||||
"Cockpit View > ", "View >","------------", "View options...", NULL };
|
||||
"Cockpit View > ", "View >","------------", "Toggle Panel...", NULL };
|
||||
puCallback viewSubmenuCb [] = {
|
||||
notCb, notCb, NULL, guiTogglePanel, NULL };
|
||||
|
||||
char *aircraftSubmenu [] = {
|
||||
"Autopilot ...", "Engine ...", "Navigation", "Communication", NULL};
|
||||
puCallback aircraftSubmenuCb [] = {
|
||||
fgAPAdjust, notCb, notCb, notCb, NULL };
|
||||
|
||||
char *environmentSubmenu [] = {
|
||||
"Airport", "Terrain", "Weather", NULL};
|
||||
puCallback environmentSubmenuCb [] = {
|
||||
NewAirportInit, notCb, notCb, NULL };
|
||||
|
||||
char *optionsSubmenu [] = {
|
||||
"Preferences", "Realism & Reliablity...", NULL};
|
||||
puCallback optionsSubmenuCb [] = {
|
||||
notCb, notCb, NULL};
|
||||
|
||||
char *helpSubmenu [] = {
|
||||
"About...", "Help", NULL };
|
||||
|
||||
puCallback fileSubmenuCb [] = { goodBye, MenuHideMenuCb, NULL, notCb, NULL, notCb, reInit, 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 };
|
||||
|
||||
puCallback helpSubmenuCb [] = {
|
||||
notCb, helpCb, NULL };
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
|
|
|
@ -31,8 +31,6 @@ extern void guiMotionFunc ( int x, int y );
|
|||
extern void guiMouseFunc(int button, int updown, int x, int y);
|
||||
extern void guiInit();
|
||||
extern void guiToggleMenu(void);
|
||||
extern void mkDialog (char *txt);
|
||||
|
||||
extern void mkDialog (char *txt);
|
||||
void mkDialog (const char *txt);
|
||||
|
||||
#endif // _GUI_H_
|
||||
|
|
|
@ -144,6 +144,9 @@ void GLUTkey(unsigned char k, int x, int y) {
|
|||
t->adjust_warp(-60);
|
||||
local_update_sky_and_lighting_params();
|
||||
return;
|
||||
case 80: // P key
|
||||
current_options.toggle_panel();
|
||||
break;
|
||||
case 84: // T key
|
||||
t->adjust_warp_delta(-30);
|
||||
local_update_sky_and_lighting_params();
|
||||
|
|
|
@ -803,9 +803,9 @@ static void fgIdleFunction ( void ) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// options.cxx needs to see this for toggle_panel()
|
||||
// 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
|
||||
// to know what the values of width & height are.
|
||||
if ( (height > 0) && (width > 0) ) {
|
||||
|
@ -859,7 +859,7 @@ int fgGlutInit( int *argc, char **argv ) {
|
|||
} else {
|
||||
// Open the cool new 'game mode' window
|
||||
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_ysize() );
|
||||
|
||||
|
|
|
@ -38,18 +38,22 @@ bool global_fullscreen = true;
|
|||
|
||||
#include STL_STRING
|
||||
|
||||
#include <Debug/logstream.hxx>
|
||||
#include <Misc/fgstream.hxx>
|
||||
#include <FDM/flight.hxx>
|
||||
#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 <Main/options.hxx>
|
||||
|
||||
#include "options.hxx"
|
||||
#include "fg_serial.hxx"
|
||||
|
||||
FG_USING_STD(string);
|
||||
FG_USING_NAMESPACE(std);
|
||||
|
||||
// from GLUTmain.cxx
|
||||
extern void fgReshape( int width, int height );
|
||||
|
||||
inline double
|
||||
atof( const string& str )
|
||||
|
@ -203,6 +207,23 @@ fgOPTIONS::fgOPTIONS() :
|
|||
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
|
||||
fgOPTIONS::parse_time(const string& time_in) {
|
||||
|
|
|
@ -227,6 +227,7 @@ public:
|
|||
xglHint ( GL_FOG_HINT, GL_FASTEST );
|
||||
}
|
||||
}
|
||||
void toggle_panel();
|
||||
inline void set_xsize( int x ) { xsize= x; }
|
||||
inline void set_ysize( int y ) { xsize= y; }
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue