1
0
Fork 0

Merge branch 'next' into durk-atc

This commit is contained in:
Durk Talsma 2011-06-01 22:11:17 +02:00
commit 63708fb0df
3 changed files with 38 additions and 23 deletions

View file

@ -52,26 +52,30 @@ WindowBuilder::makeDefaultTraits(bool stencil)
{ {
GraphicsContext::WindowingSystemInterface* wsi GraphicsContext::WindowingSystemInterface* wsi
= osg::GraphicsContext::getWindowingSystemInterface(); = osg::GraphicsContext::getWindowingSystemInterface();
int w = fgGetInt("/sim/startup/xsize");
int h = fgGetInt("/sim/startup/ysize");
int bpp = fgGetInt("/sim/rendering/bits-per-pixel");
bool alpha = fgGetBool("/sim/rendering/clouds3d-enable");
bool fullscreen = fgGetBool("/sim/startup/fullscreen");
GraphicsContext::Traits* traits = new osg::GraphicsContext::Traits; GraphicsContext::Traits* traits = new osg::GraphicsContext::Traits;
traits->readDISPLAY(); traits->readDISPLAY();
unsigned screenwidth = 0;
unsigned screenheight = 0;
wsi->getScreenResolution(*traits, screenwidth, screenheight);
if (traits->displayNum < 0) if (traits->displayNum < 0)
traits->displayNum = 0; traits->displayNum = 0;
if (traits->screenNum < 0) if (traits->screenNum < 0)
traits->screenNum = 0; traits->screenNum = 0;
int bpp = fgGetInt("/sim/rendering/bits-per-pixel");
bool alpha = fgGetBool("/sim/rendering/clouds3d-enable");
int cbits = (bpp <= 16) ? 5 : 8; int cbits = (bpp <= 16) ? 5 : 8;
int zbits = (bpp <= 16) ? 16 : 24; int zbits = (bpp <= 16) ? 16 : 24;
traits->red = traits->green = traits->blue = cbits; traits->red = traits->green = traits->blue = cbits;
traits->depth = zbits; traits->depth = zbits;
if (alpha) if (alpha)
traits->alpha = 8; traits->alpha = 8;
if (stencil) if (stencil)
traits->stencil = 8; traits->stencil = 8;
traits->doubleBuffer = true; traits->doubleBuffer = true;
traits->mipMapGeneration = true; traits->mipMapGeneration = true;
traits->windowName = "FlightGear"; traits->windowName = "FlightGear";
@ -79,26 +83,25 @@ WindowBuilder::makeDefaultTraits(bool stencil)
traits->sampleBuffers = fgGetBool("/sim/rendering/multi-sample-buffers", traits->sampleBuffers); traits->sampleBuffers = fgGetBool("/sim/rendering/multi-sample-buffers", traits->sampleBuffers);
traits->samples = fgGetInt("/sim/rendering/multi-samples", traits->samples); traits->samples = fgGetInt("/sim/rendering/multi-samples", traits->samples);
traits->vsync = fgGetBool("/sim/rendering/vsync-enable", traits->vsync); traits->vsync = fgGetBool("/sim/rendering/vsync-enable", traits->vsync);
if (fullscreen) { traits->windowDecoration = !fgGetBool("/sim/startup/fullscreen");
unsigned width = 0;
unsigned height = 0; if (!traits->windowDecoration) {
wsi->getScreenResolution(*traits, width, height); // fullscreen
traits->windowDecoration = false;
traits->width = width;
traits->height = height;
traits->supportsResize = false; traits->supportsResize = false;
traits->width = screenwidth;
traits->height = screenheight;
} else { } else {
traits->windowDecoration = true; // window
int w = fgGetInt("/sim/startup/xsize");
int h = fgGetInt("/sim/startup/ysize");
traits->supportsResize = true;
traits->width = w; traits->width = w;
traits->height = h; traits->height = h;
unsigned screenwidth = 0; if ((w>0)&&(h>0))
unsigned screenheight = 0; {
wsi->getScreenResolution(*traits, screenwidth, screenheight); traits->x = ((unsigned)w>screenwidth) ? 0 : (screenwidth-w)/3;
// Ugly Hack, why does CW_USEDEFAULT works like phase of the moon? traits->y = ((unsigned)h>screenheight) ? 0 : (screenheight-h)/3;
// Mac also needs this to show window frame, menubar and Docks }
traits->x = (w>screenwidth) ? 0 : (screenwidth-w)/3;
traits->y = (h>screenheight) ? 0 : (screenheight-h)/3;
traits->supportsResize = true;
} }
return traits; return traits;
} }
@ -166,8 +169,11 @@ GraphicsWindow* WindowBuilder::buildWindow(const SGPropertyNode* winNode)
int traitsSet = setFromProperty(traits->hostName, winNode, "host-name"); int traitsSet = setFromProperty(traits->hostName, winNode, "host-name");
traitsSet |= setFromProperty(traits->displayNum, winNode, "display"); traitsSet |= setFromProperty(traits->displayNum, winNode, "display");
traitsSet |= setFromProperty(traits->screenNum, winNode, "screen"); traitsSet |= setFromProperty(traits->screenNum, winNode, "screen");
const SGPropertyNode* fullscreenNode = winNode->getNode("fullscreen"); const SGPropertyNode* fullscreenNode = winNode->getNode("fullscreen");
if (fullscreenNode && fullscreenNode->getBoolValue()) { if (fullscreenNode && fullscreenNode->getBoolValue()) {
// fullscreen mode
unsigned width = 0; unsigned width = 0;
unsigned height = 0; unsigned height = 0;
wsi->getScreenResolution(*traits, width, height); wsi->getScreenResolution(*traits, width, height);
@ -175,9 +181,16 @@ GraphicsWindow* WindowBuilder::buildWindow(const SGPropertyNode* winNode)
traits->width = width; traits->width = width;
traits->height = height; traits->height = height;
traits->supportsResize = false; traits->supportsResize = false;
traits->x = 0;
traits->y = 0;
traitsSet = 1; traitsSet = 1;
} else { } else {
int resizable = 0; int resizable = 0;
if (fullscreenNode && !fullscreenNode->getBoolValue())
{
traits->windowDecoration = true;
resizable = 1;
}
resizable |= setFromProperty(traits->windowDecoration, winNode, resizable |= setFromProperty(traits->windowDecoration, winNode,
"decoration"); "decoration");
resizable |= setFromProperty(traits->width, winNode, "width"); resizable |= setFromProperty(traits->width, winNode, "width");

View file

@ -13,7 +13,8 @@ libNavaids_a_SOURCES = \
airways.hxx airways.cxx \ airways.hxx airways.cxx \
route.hxx route.cxx \ route.hxx route.cxx \
waypoint.hxx waypoint.cxx \ waypoint.hxx waypoint.cxx \
procedure.hxx procedure.cxx procedure.hxx procedure.cxx \
PositionedBinding.hxx PositionedBinding.cxx
# #
# testnavs_SOURCES = testnavs.cxx # testnavs_SOURCES = testnavs.cxx

View file

@ -28,6 +28,7 @@
#include <set> #include <set>
#include <algorithm> // for sort #include <algorithm> // for sort
#include <queue> #include <queue>
#include <memory>
#include <boost/algorithm/string/case_conv.hpp> #include <boost/algorithm/string/case_conv.hpp>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>