1
0
Fork 0
flightgear/src/Viewer/WindowSystemAdapter.cxx
James Turner 804dc4e74a Steps to make PUI optional, HiDPI tolerant.
Move all PUI event and rendering into a custom camera, which can be
rendered via an FBO to account for display-resolution scaling (HiDPI).

Start wrapping PUI calls in #ifdefs so PUI can be disabled at compile
time; a run-time switch is trivial now but not implemented yet.
2017-10-20 12:10:51 +01:00

68 lines
1.8 KiB
C++

// Copyright (C) 2008 Tim Moore
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include<algorithm>
#include <functional>
#include "CameraGroup.hxx"
#include "WindowSystemAdapter.hxx"
#include <osg/Camera>
#include <osg/GraphicsContext>
#include <osg/Viewport>
using namespace osg;
using namespace std;
namespace flightgear
{
ref_ptr<WindowSystemAdapter> WindowSystemAdapter::_wsa;
void GraphicsContextOperation::operator()(GraphicsContext* gc)
{
run(gc);
++done;
}
WindowSystemAdapter::WindowSystemAdapter() :
_nextWindowID(0)
{
}
GraphicsWindow*
WindowSystemAdapter::registerWindow(GraphicsContext* gc,
const string& windowName)
{
GraphicsWindow* window = new GraphicsWindow(gc, windowName,
_nextWindowID++);
windows.push_back(window);
return window;
}
GraphicsWindow* WindowSystemAdapter::findWindow(const string& name)
{
for (WindowVector::iterator iter = windows.begin(), e = windows.end();
iter != e;
++iter) {
if ((*iter)->name == name)
return iter->get();
}
return 0;
}
}