|
|
@ -74,8 +74,8 @@ namespace osgMyGUI
|
|
|
|
_left -= globalViewSize.width/2;
|
|
|
|
_left -= globalViewSize.width/2;
|
|
|
|
_top -= globalViewSize.height/2;
|
|
|
|
_top -= globalViewSize.height/2;
|
|
|
|
|
|
|
|
|
|
|
|
_left /= scale;
|
|
|
|
_left = static_cast<int>(_left/scale);
|
|
|
|
_top /= scale;
|
|
|
|
_top = static_cast<int>(_top/scale);
|
|
|
|
|
|
|
|
|
|
|
|
_left += mViewSize.width/2;
|
|
|
|
_left += mViewSize.width/2;
|
|
|
|
_top += mViewSize.height/2;
|
|
|
|
_top += mViewSize.height/2;
|
|
|
@ -84,8 +84,8 @@ namespace osgMyGUI
|
|
|
|
float ScalingLayer::getScaleFactor() const
|
|
|
|
float ScalingLayer::getScaleFactor() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
|
|
|
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
|
|
|
float w = viewSize.width;
|
|
|
|
float w = static_cast<float>(viewSize.width);
|
|
|
|
float h = viewSize.height;
|
|
|
|
float h = static_cast<float>(viewSize.height);
|
|
|
|
|
|
|
|
|
|
|
|
float heightScale = (h / mViewSize.height);
|
|
|
|
float heightScale = (h / mViewSize.height);
|
|
|
|
float widthScale = (w / mViewSize.width);
|
|
|
|
float widthScale = (w / mViewSize.width);
|
|
|
@ -103,8 +103,8 @@ namespace osgMyGUI
|
|
|
|
MyGUI::IntSize globalViewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
|
|
|
MyGUI::IntSize globalViewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
|
|
|
MyGUI::IntSize viewSize = globalViewSize;
|
|
|
|
MyGUI::IntSize viewSize = globalViewSize;
|
|
|
|
float scale = getScaleFactor();
|
|
|
|
float scale = getScaleFactor();
|
|
|
|
viewSize.width /= scale;
|
|
|
|
viewSize.width = static_cast<int>(viewSize.width / scale);
|
|
|
|
viewSize.height /= scale;
|
|
|
|
viewSize.height = static_cast<int>(viewSize.height / scale);
|
|
|
|
|
|
|
|
|
|
|
|
float hoffset = (globalViewSize.width - mViewSize.width*getScaleFactor())/2.f / static_cast<float>(globalViewSize.width);
|
|
|
|
float hoffset = (globalViewSize.width - mViewSize.width*getScaleFactor())/2.f / static_cast<float>(globalViewSize.width);
|
|
|
|
float voffset = (globalViewSize.height - mViewSize.height*getScaleFactor())/2.f / static_cast<float>(globalViewSize.height);
|
|
|
|
float voffset = (globalViewSize.height - mViewSize.height*getScaleFactor())/2.f / static_cast<float>(globalViewSize.height);
|
|
|
|