Renderer: Replaced RenderTarget::Get[Height|Width] by RenderTarget::GetSize
Utility: Removed Window::Get[Height|Width] methods
This commit is contained in:
@@ -148,7 +148,10 @@ namespace Ndk
|
||||
|
||||
Nz::Vector2ui windowDimensions;
|
||||
if (info.window->IsValid())
|
||||
windowDimensions.Set(info.window->GetWidth(), info.window->GetHeight() / 4);
|
||||
{
|
||||
windowDimensions = info.window->GetSize();
|
||||
windowDimensions.y /= 4;
|
||||
}
|
||||
else
|
||||
windowDimensions.MakeZero();
|
||||
|
||||
@@ -212,7 +215,8 @@ namespace Ndk
|
||||
|
||||
overlay->resizedSlot.Connect(info.renderTarget->OnRenderTargetSizeChange, [&consoleRef] (const Nz::RenderTarget* renderTarget)
|
||||
{
|
||||
consoleRef.SetSize({float(renderTarget->GetWidth()), renderTarget->GetHeight() / 4.f});
|
||||
Nz::Vector2ui size = renderTarget->GetSize();
|
||||
consoleRef.SetSize({float(size.x), size.y / 4.f});
|
||||
});
|
||||
|
||||
info.console = std::move(overlay);
|
||||
|
||||
@@ -334,15 +334,15 @@ namespace Ndk
|
||||
{
|
||||
NazaraAssert(m_target, "CameraComponent has no target");
|
||||
|
||||
unsigned int targetWidth = m_target->GetWidth();
|
||||
unsigned int targetHeight = std::max(m_target->GetHeight(), 1U); // Let's make sure we won't divide by zero
|
||||
Nz::Vector2ui targetSize = m_target->GetSize();
|
||||
targetSize.y = std::max(targetSize.y, 1U); // Let's make sure we won't divide by zero
|
||||
|
||||
// Our target region is expressed as % of the viewport dimensions, let's compute it in pixels
|
||||
Nz::Rectf fViewport(m_targetRegion);
|
||||
fViewport.x *= targetWidth;
|
||||
fViewport.y *= targetHeight;
|
||||
fViewport.width *= targetWidth;
|
||||
fViewport.height *= targetHeight;
|
||||
fViewport.x *= targetSize.x;
|
||||
fViewport.y *= targetSize.y;
|
||||
fViewport.width *= targetSize.x;
|
||||
fViewport.height *= targetSize.y;
|
||||
|
||||
// Compute the new aspect ratio, if it's different we need to invalidate the projection matrix
|
||||
float aspectRatio = fViewport.width/fViewport.height;
|
||||
|
||||
Reference in New Issue
Block a user