Merged in initial HUD and Joystick code.
This commit is contained in:
parent
b6789508b2
commit
90e39d537f
8 changed files with 87 additions and 22 deletions
|
@ -40,6 +40,8 @@
|
||||||
#include "../Weather/weather.h"
|
#include "../Weather/weather.h"
|
||||||
|
|
||||||
extern double goal_view_offset;
|
extern double goal_view_offset;
|
||||||
|
extern int show_hud; /* HUD state */
|
||||||
|
|
||||||
|
|
||||||
/* Handle keyboard events */
|
/* Handle keyboard events */
|
||||||
void GLUTkey(unsigned char k, int x, int y) {
|
void GLUTkey(unsigned char k, int x, int y) {
|
||||||
|
@ -78,7 +80,10 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
case 57: /* numeric keypad 9 */
|
case 57: /* numeric keypad 9 */
|
||||||
goal_view_offset = FG_PI * 1.75;
|
goal_view_offset = FG_PI * 1.75;
|
||||||
return;
|
return;
|
||||||
case 90: /* Z */
|
case 72: /* H key */
|
||||||
|
show_hud = !show_hud;
|
||||||
|
return;
|
||||||
|
case 90: /* Z key */
|
||||||
w->visibility /= 1.10;
|
w->visibility /= 1.10;
|
||||||
glFogf(GL_FOG_END, w->visibility);
|
glFogf(GL_FOG_END, w->visibility);
|
||||||
printf("Fog density = %.4f\n", w->visibility);
|
printf("Fog density = %.4f\n", w->visibility);
|
||||||
|
@ -122,7 +127,7 @@ void GLUTkey(unsigned char k, int x, int y) {
|
||||||
case 51: /* numeric keypad 3 (Pg Dn) */
|
case 51: /* numeric keypad 3 (Pg Dn) */
|
||||||
fgThrottleMove(0, -0.01);
|
fgThrottleMove(0, -0.01);
|
||||||
return;
|
return;
|
||||||
case 122: /* z */
|
case 122: /* z key */
|
||||||
w->visibility *= 1.10;
|
w->visibility *= 1.10;
|
||||||
glFogf(GL_FOG_END, w->visibility);
|
glFogf(GL_FOG_END, w->visibility);
|
||||||
printf("Fog density = %.4f\n", w->visibility);
|
printf("Fog density = %.4f\n", w->visibility);
|
||||||
|
@ -215,9 +220,12 @@ void GLUTspecialkey(int k, int x, int y) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.18 1997/08/22 21:34:38 curt
|
/* Revision 1.19 1997/08/25 20:27:21 curt
|
||||||
/* Doing a bit of reorganizing and house cleaning.
|
/* Merged in initial HUD and Joystick code.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.18 1997/08/22 21:34:38 curt
|
||||||
|
* Doing a bit of reorganizing and house cleaning.
|
||||||
|
*
|
||||||
* Revision 1.17 1997/07/19 22:34:02 curt
|
* Revision 1.17 1997/07/19 22:34:02 curt
|
||||||
* Moved PI definitions to ../constants.h
|
* Moved PI definitions to ../constants.h
|
||||||
* Moved random() stuff to ../Utils/ and renamed fg_random()
|
* Moved random() stuff to ../Utils/ and renamed fg_random()
|
||||||
|
|
|
@ -41,6 +41,8 @@
|
||||||
#include "../general.h"
|
#include "../general.h"
|
||||||
|
|
||||||
#include "../Aircraft/aircraft.h"
|
#include "../Aircraft/aircraft.h"
|
||||||
|
#include "../Cockpit/cockpit.h"
|
||||||
|
#include "../Joystick/joystick.h"
|
||||||
#include "../Math/fg_geodesy.h"
|
#include "../Math/fg_geodesy.h"
|
||||||
#include "../Math/mat3.h"
|
#include "../Math/mat3.h"
|
||||||
#include "../Math/polar.h"
|
#include "../Math/polar.h"
|
||||||
|
@ -92,6 +94,9 @@ double Simtime;
|
||||||
/* Another hack */
|
/* Another hack */
|
||||||
int use_signals = 0;
|
int use_signals = 0;
|
||||||
|
|
||||||
|
/* Yet another hack. This one used by the HUD code. Michele */
|
||||||
|
int show_hud;
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* fgInitVisuals() -- Initialize various GL/view parameters
|
* fgInitVisuals() -- Initialize various GL/view parameters
|
||||||
|
@ -308,6 +313,12 @@ static void fgUpdateVisuals( void ) {
|
||||||
/* draw scenery */
|
/* draw scenery */
|
||||||
fgSceneryRender();
|
fgSceneryRender();
|
||||||
|
|
||||||
|
/* display HUD */
|
||||||
|
if( show_hud ) {
|
||||||
|
fgCockpitUpdate();
|
||||||
|
/* fgUpdateHUD(); */
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef GLUT
|
#ifdef GLUT
|
||||||
glutSwapBuffers();
|
glutSwapBuffers();
|
||||||
#endif
|
#endif
|
||||||
|
@ -474,10 +485,25 @@ static void fgMainLoop( void ) {
|
||||||
static int remainder = 0;
|
static int remainder = 0;
|
||||||
int elapsed, multi_loop;
|
int elapsed, multi_loop;
|
||||||
double cur_elev;
|
double cur_elev;
|
||||||
|
double joy_x, joy_y;
|
||||||
|
int joy_b1, joy_b2;
|
||||||
struct flight_params *f;
|
struct flight_params *f;
|
||||||
|
|
||||||
f = ¤t_aircraft.flight;
|
f = ¤t_aircraft.flight;
|
||||||
|
|
||||||
|
/* Read joystick */
|
||||||
|
/* fgJoystickRead( &joy_x, &joy_y, &joy_b1, &joy_b2 ); */
|
||||||
|
/* printf( "Joystick X %f Y %f B1 %d B2 %d\n",
|
||||||
|
joy_x, joy_y, joy_b1, joy_b2 );
|
||||||
|
fgElevSet( -joy_y );
|
||||||
|
fgAileronSet( joy_x ); */
|
||||||
|
|
||||||
|
/* update the weather for our current position */
|
||||||
|
fgWeatherUpdate(FG_Longitude * RAD_TO_ARCSEC,
|
||||||
|
FG_Latitude * RAD_TO_ARCSEC,
|
||||||
|
FG_Altitude * FEET_TO_METER);
|
||||||
|
|
||||||
|
/* Calculate model iterations needed */
|
||||||
elapsed = fgGetTimeInterval();
|
elapsed = fgGetTimeInterval();
|
||||||
printf("Time interval is = %d, previous remainder is = %d\n", elapsed,
|
printf("Time interval is = %d, previous remainder is = %d\n", elapsed,
|
||||||
remainder);
|
remainder);
|
||||||
|
@ -489,9 +515,6 @@ static void fgMainLoop( void ) {
|
||||||
printf("Model iterations needed = %d, new remainder = %d\n", multi_loop,
|
printf("Model iterations needed = %d, new remainder = %d\n", multi_loop,
|
||||||
remainder);
|
remainder);
|
||||||
|
|
||||||
aircraft_debug(1);
|
|
||||||
fgUpdateVisuals();
|
|
||||||
|
|
||||||
if ( ! use_signals ) {
|
if ( ! use_signals ) {
|
||||||
/* flight model */
|
/* flight model */
|
||||||
fgUpdateTimeDepCalcs(multi_loop);
|
fgUpdateTimeDepCalcs(multi_loop);
|
||||||
|
@ -515,10 +538,10 @@ static void fgMainLoop( void ) {
|
||||||
FG_Altitude * FEET_TO_METER);
|
FG_Altitude * FEET_TO_METER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update the weather for our current position */
|
aircraft_debug(1);
|
||||||
fgWeatherUpdate(FG_Longitude * RAD_TO_ARCSEC,
|
|
||||||
FG_Latitude * RAD_TO_ARCSEC,
|
/* redraw display */
|
||||||
FG_Altitude * FEET_TO_METER);
|
fgUpdateVisuals();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -623,9 +646,12 @@ int main( int argc, char *argv[] ) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.9 1997/08/22 21:34:39 curt
|
/* Revision 1.10 1997/08/25 20:27:22 curt
|
||||||
/* Doing a bit of reorganizing and house cleaning.
|
/* Merged in initial HUD and Joystick code.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.9 1997/08/22 21:34:39 curt
|
||||||
|
* Doing a bit of reorganizing and house cleaning.
|
||||||
|
*
|
||||||
* Revision 1.8 1997/08/19 23:55:03 curt
|
* Revision 1.8 1997/08/19 23:55:03 curt
|
||||||
* Worked on better simulating real lighting.
|
* Worked on better simulating real lighting.
|
||||||
*
|
*
|
||||||
|
|
|
@ -28,8 +28,9 @@ TARGET=fg0
|
||||||
|
|
||||||
CFILES = fg_init.c $(INTERFACE_FILES)
|
CFILES = fg_init.c $(INTERFACE_FILES)
|
||||||
OFILES = $(CFILES:.c=.o)
|
OFILES = $(CFILES:.c=.o)
|
||||||
AFILES = ../Aircraft/libAircraft.a ../Controls/libControls.a \
|
AFILES = ../Aircraft/libAircraft.a ../Cockpit/libCockpit.a \
|
||||||
../Flight/libFlight.a ../Flight/LaRCsim/libLaRCsim.a \
|
../Controls/libControls.a ../Flight/libFlight.a \
|
||||||
|
../Joystick/libJoystick.a ../Flight/LaRCsim/libLaRCsim.a \
|
||||||
../Flight/Slew/libSlew.a ../Scenery/libScenery.a \
|
../Flight/Slew/libSlew.a ../Scenery/libScenery.a \
|
||||||
../Time/libTime.a ../Weather/libWeather.a ../Math/libMath.a
|
../Time/libTime.a ../Weather/libWeather.a ../Math/libMath.a
|
||||||
|
|
||||||
|
@ -72,6 +73,9 @@ GLTKkey.o:
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# $Log$
|
# $Log$
|
||||||
|
# Revision 1.31 1997/08/25 20:27:23 curt
|
||||||
|
# Merged in initial HUD and Joystick code.
|
||||||
|
#
|
||||||
# Revision 1.30 1997/08/22 21:34:40 curt
|
# Revision 1.30 1997/08/22 21:34:40 curt
|
||||||
# Doing a bit of reorganizing and house cleaning.
|
# Doing a bit of reorganizing and house cleaning.
|
||||||
#
|
#
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
#include "../general.h"
|
#include "../general.h"
|
||||||
|
|
||||||
#include "../Aircraft/aircraft.h"
|
#include "../Aircraft/aircraft.h"
|
||||||
|
#include "../Cockpit/cockpit.h"
|
||||||
|
#include "../Joystick/joystick.h"
|
||||||
#include "../Math/fg_random.h"
|
#include "../Math/fg_random.h"
|
||||||
#include "../Scenery/mesh.h"
|
#include "../Scenery/mesh.h"
|
||||||
#include "../Scenery/scenery.h"
|
#include "../Scenery/scenery.h"
|
||||||
|
@ -40,6 +42,9 @@
|
||||||
#include "../Weather/weather.h"
|
#include "../Weather/weather.h"
|
||||||
|
|
||||||
|
|
||||||
|
extern int show_hud; /* HUD state */
|
||||||
|
|
||||||
|
|
||||||
/* General house keeping initializations */
|
/* General house keeping initializations */
|
||||||
|
|
||||||
void fgInitGeneral( void ) {
|
void fgInitGeneral( void ) {
|
||||||
|
@ -137,6 +142,9 @@ void fgInitSubsystems( void ) {
|
||||||
/* Initialize the weather modeling subsystem */
|
/* Initialize the weather modeling subsystem */
|
||||||
fgWeatherInit();
|
fgWeatherInit();
|
||||||
|
|
||||||
|
/* Initialize the Cockpit subsystem */
|
||||||
|
fgCockpitInit( current_aircraft );
|
||||||
|
|
||||||
/* Initialize the Scenery Management subsystem */
|
/* Initialize the Scenery Management subsystem */
|
||||||
fgSceneryInit();
|
fgSceneryInit();
|
||||||
|
|
||||||
|
@ -166,11 +174,20 @@ void fgInitSubsystems( void ) {
|
||||||
/* Initialize the flight model subsystem data structures base on
|
/* Initialize the flight model subsystem data structures base on
|
||||||
* above values */
|
* above values */
|
||||||
fgFlightModelInit( FG_LARCSIM, f, 1.0 / DEFAULT_MODEL_HZ );
|
fgFlightModelInit( FG_LARCSIM, f, 1.0 / DEFAULT_MODEL_HZ );
|
||||||
|
|
||||||
|
/* To HUD or not to HUD */
|
||||||
|
show_hud = 1;
|
||||||
|
|
||||||
|
/* Joystick support */
|
||||||
|
fgJoystickInit( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.1 1997/08/23 01:46:20 curt
|
/* Revision 1.2 1997/08/25 20:27:23 curt
|
||||||
/* Initial revision.
|
/* Merged in initial HUD and Joystick code.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.1 1997/08/23 01:46:20 curt
|
||||||
|
* Initial revision.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -48,7 +48,7 @@ struct scenery_params scenery;
|
||||||
/* Initialize the Scenery Management system */
|
/* Initialize the Scenery Management system */
|
||||||
void fgSceneryInit() {
|
void fgSceneryInit() {
|
||||||
/* set the default terrain detail level */
|
/* set the default terrain detail level */
|
||||||
scenery.terrain_skip = 10;
|
scenery.terrain_skip = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,9 +81,12 @@ void fgSceneryRender() {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.13 1997/08/22 21:34:41 curt
|
/* Revision 1.14 1997/08/25 20:27:24 curt
|
||||||
/* Doing a bit of reorganizing and house cleaning.
|
/* Merged in initial HUD and Joystick code.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.13 1997/08/22 21:34:41 curt
|
||||||
|
* Doing a bit of reorganizing and house cleaning.
|
||||||
|
*
|
||||||
* Revision 1.12 1997/08/19 23:55:08 curt
|
* Revision 1.12 1997/08/19 23:55:08 curt
|
||||||
* Worked on better simulating real lighting.
|
* Worked on better simulating real lighting.
|
||||||
*
|
*
|
||||||
|
|
|
@ -28,7 +28,7 @@ include make.inc
|
||||||
|
|
||||||
|
|
||||||
SUBSUBDIRS = Flight/LaRCsim Flight/Slew
|
SUBSUBDIRS = Flight/LaRCsim Flight/Slew
|
||||||
SUBDIRS = Aircraft Controls Flight Math Scenery Time Weather
|
SUBDIRS = Aircraft Cockpit Controls Flight Joystick Math Scenery Time Weather
|
||||||
MAIN = GLUT
|
MAIN = GLUT
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,6 +71,9 @@ zip: clean
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# $Log$
|
# $Log$
|
||||||
|
# Revision 1.25 1997/08/25 20:27:21 curt
|
||||||
|
# Merged in initial HUD and Joystick code.
|
||||||
|
#
|
||||||
# Revision 1.24 1997/08/16 12:22:17 curt
|
# Revision 1.24 1997/08/16 12:22:17 curt
|
||||||
# Tweaks for new version.
|
# Tweaks for new version.
|
||||||
#
|
#
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
VERSION = 0.09
|
VERSION = 0.10
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Choose your weapons
|
# Choose your weapons
|
||||||
|
@ -120,6 +120,9 @@ FG_CFLAGS = $(GLOBAL_CFLAGS)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# $Log$
|
# $Log$
|
||||||
|
# Revision 1.12 1997/08/25 20:27:21 curt
|
||||||
|
# Merged in initial HUD and Joystick code.
|
||||||
|
#
|
||||||
# Revision 1.11 1997/08/22 21:34:33 curt
|
# Revision 1.11 1997/08/22 21:34:33 curt
|
||||||
# Doing a bit of reorganizing and house cleaning.
|
# Doing a bit of reorganizing and house cleaning.
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
fg_time.o: fg_time.c fg_time.h ../types.h
|
fg_time.o: fg_time.c fg_time.h ../types.h
|
||||||
fg_timer.o: fg_timer.c fg_timer.h
|
fg_timer.o: fg_timer.c fg_timer.h
|
||||||
|
sptest.o: sptest.c sunpos.h ../constants.h
|
||||||
sunpos.o: sunpos.c sunpos.h fg_time.h ../types.h ../constants.h \
|
sunpos.o: sunpos.c sunpos.h fg_time.h ../types.h ../constants.h \
|
||||||
../Math/fg_geodesy.h ../Math/polar.h ../Math/../types.h
|
../Math/fg_geodesy.h ../Math/polar.h ../Math/../types.h
|
||||||
|
|
Loading…
Reference in a new issue