1
0
Fork 0

Merge branch 'fgpanel' of 10.101.2.62:~/FlightGear/fg-osg/FlightGear into next

This commit is contained in:
Torsten Dreyer 2011-05-27 20:56:09 +02:00
commit 60b6dcdae3
12 changed files with 74 additions and 11 deletions

4
utils/fgpanel/.cvsignore Normal file
View file

@ -0,0 +1,4 @@
.deps
Makefile
Makefile.in
fgpanel

View file

@ -17,7 +17,12 @@
# include <config.h> # include <config.h>
#endif #endif
using namespace std; #include "FGGLApplication.hxx"
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
#include <map> #include <map>
#include <algorithm> #include <algorithm>
#include "ApplicationProperties.hxx" #include "ApplicationProperties.hxx"
@ -93,7 +98,7 @@ inline bool FGFontCache::FntParamsLess::operator()(const FntParams& f1,
struct FGFontCache::fnt * struct FGFontCache::fnt *
FGFontCache::getfnt(const char *name, float size, float slant) FGFontCache::getfnt(const char *name, float size, float slant)
{ {
string fontName(name); std::string fontName(name);
FntParams fntParams(fontName, size, slant); FntParams fntParams(fontName, size, slant);
PuFontMap::iterator i = _puFonts.find(fntParams); PuFontMap::iterator i = _puFonts.find(fntParams);
if (i != _puFonts.end()) if (i != _puFonts.end())
@ -183,7 +188,7 @@ FGFontCache::getfntpath(const char *name)
bool FGFontCache::initializeFonts() bool FGFontCache::initializeFonts()
{ {
static string fontext("txf"); static std::string fontext("txf");
init(); init();
ulDir* fontdir = ulOpenDir(_path.c_str()); ulDir* fontdir = ulOpenDir(_path.c_str());
if (!fontdir) if (!fontdir)
@ -195,7 +200,7 @@ bool FGFontCache::initializeFonts()
if (path.extension() == fontext) { if (path.extension() == fontext) {
fntTexFont* f = new fntTexFont; fntTexFont* f = new fntTexFont;
if (f->load((char *)path.c_str())) if (f->load((char *)path.c_str()))
_texFonts[string(dirEntry->d_name)] = f; _texFonts[std::string(dirEntry->d_name)] = f;
else else
delete f; delete f;
} }

View file

@ -14,6 +14,7 @@
// //
#ifndef __FGFONTCACHE_HXX #ifndef __FGFONTCACHE_HXX
#define __FGFONTCACHE_HXX #define __FGFONTCACHE_HXX
#include <simgear/math/SGMath.hxx>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/props/props.hxx> #include <simgear/props/props.hxx>
#include <plib/pu.h> #include <plib/pu.h>
@ -55,8 +56,8 @@ private:
// Path to the font directory // Path to the font directory
SGPath _path; SGPath _path;
typedef map<const string, fntTexFont*> TexFontMap; typedef std::map<const std::string, fntTexFont*> TexFontMap;
typedef map<const FntParams, fnt*, FntParamsLess> PuFontMap; typedef std::map<const FntParams, fnt*, FntParamsLess> PuFontMap;
TexFontMap _texFonts; TexFontMap _texFonts;
PuFontMap _puFonts; PuFontMap _puFonts;

View file

@ -15,9 +15,18 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// //
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "FGGLApplication.hxx" #include "FGGLApplication.hxx"
#include "GL/gl.h" #ifdef HAVE_WINDOWS_H
#include "GL/glut.h" #include <windows.h>
#define snprintf sprintf_s
#endif
#include <GL/gl.h>
#include <GL/glut.h>
#include <iostream> #include <iostream>
#include <exception> #include <exception>

View file

@ -13,6 +13,13 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// //
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
#include "FGPNGTextureLoader.hxx" #include "FGPNGTextureLoader.hxx"
#include <GL/glu.h> #include <GL/glu.h>

View file

@ -15,6 +15,16 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// //
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
#include "FGGLApplication.hxx"
#include "FGPanelApplication.hxx" #include "FGPanelApplication.hxx"
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glut.h> #include <GL/glut.h>
@ -131,7 +141,7 @@ void FGPanelApplication::Init()
{ {
glAlphaFunc(GL_GREATER, 0.1); glAlphaFunc(GL_GREATER, 0.1);
glutSetCursor( GLUT_CURSOR_NONE ); glutSetCursor( GLUT_CURSOR_NONE );
ApplicationProperties::fontCache.initializeFonts(); ApplicationProperties::fontCache.initializeFonts();
} }
void FGPanelApplication::Reshape( int width, int height ) void FGPanelApplication::Reshape( int width, int height )
@ -172,8 +182,7 @@ void FGPanelApplication::Key( unsigned char key, int x, int y )
{ {
switch( key ) { switch( key ) {
case 0x1b: case 0x1b:
if( gameMode ) glutLeaveGameMode(); exit(0);
else glutDestroyWindow( windowId );
break; break;
} }
} }
@ -226,7 +235,11 @@ double FGPanelApplication::Sleep()
double elapsed_us = (current_time_stamp - last_time_stamp).toUSecs(); double elapsed_us = (current_time_stamp - last_time_stamp).toUSecs();
if ( elapsed_us < frame_us ) { if ( elapsed_us < frame_us ) {
double requested_us = frame_us - elapsed_us; double requested_us = frame_us - elapsed_us;
#ifdef _WIN32
::Sleep ((int)(requested_us / 1000.0)) ;
#else
usleep ( (useconds_t)(requested_us ) ) ; usleep ( (useconds_t)(requested_us ) ) ;
#endif
} }
// busy wait timing loop. // busy wait timing loop.
// //

View file

@ -21,6 +21,7 @@
#include "FGGLApplication.hxx" #include "FGGLApplication.hxx"
#include "FGPanelProtocol.hxx" #include "FGPanelProtocol.hxx"
#include <simgear/math/SGMath.hxx>
#include <simgear/structure/subsystem_mgr.hxx> #include <simgear/structure/subsystem_mgr.hxx>
#include <simgear/props/props.hxx> #include <simgear/props/props.hxx>

View file

@ -15,6 +15,18 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// //
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
#ifdef WIN32
#define strtof strtod
#endif
#include "FGPanelProtocol.hxx" #include "FGPanelProtocol.hxx"
#include "ApplicationProperties.hxx" #include "ApplicationProperties.hxx"
#include <simgear/io/sg_socket.hxx> #include <simgear/io/sg_socket.hxx>

View file

@ -17,6 +17,7 @@
// //
#ifndef __FGPANELPROTOCOL_HXX #ifndef __FGPANELPROTOCOL_HXX
#define __FGPANELPROTOCOL_HXX #define __FGPANELPROTOCOL_HXX
#include <simgear/math/SGMath.hxx>
#include <simgear/structure/subsystem_mgr.hxx> #include <simgear/structure/subsystem_mgr.hxx>
#include <simgear/props/props.hxx> #include <simgear/props/props.hxx>
#include <simgear/io/iochannel.hxx> #include <simgear/io/iochannel.hxx>

View file

@ -17,6 +17,14 @@
// Reader for sgi's .rgb format. // Reader for sgi's .rgb format.
// specification can be found at http://local.wasp.uwa.edu.au/~pbourke/dataformats/sgirgb/sgiversion.html // specification can be found at http://local.wasp.uwa.edu.au/~pbourke/dataformats/sgirgb/sgiversion.html
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
#include "FGRGBTextureLoader.hxx" #include "FGRGBTextureLoader.hxx"
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glu.h> #include <GL/glu.h>

View file

@ -36,6 +36,7 @@
#include <plib/fnt.h> #include <plib/fnt.h>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <simgear/math/SGMath.hxx>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include "panel.hxx" #include "panel.hxx"

View file

@ -29,6 +29,7 @@
#include <string.h> // for strcmp() #include <string.h> // for strcmp()
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <simgear/math/SGMath.hxx>
#include <simgear/structure/exception.hxx> #include <simgear/structure/exception.hxx>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>