mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-07-11 01:28:41 +12:00
Screen layouts: Add configurable screen sizes
This commit is contained in:
parent
62748eef47
commit
1c0f65c740
4 changed files with 92 additions and 89 deletions
|
@ -592,7 +592,7 @@ void RendererGL::display() {
|
|||
|
||||
// Flip topScreenY and bottomScreenY because glBlitFramebuffer uses bottom-left origin
|
||||
blitInfo.topScreenY = outputWindowHeight - (blitInfo.topScreenY + blitInfo.topScreenHeight);
|
||||
blitInfo.topScreenY = outputWindowHeight - (blitInfo.bottomScreenY + blitInfo.bottomScreenHeight);
|
||||
blitInfo.bottomScreenY = outputWindowHeight - (blitInfo.bottomScreenY + blitInfo.bottomScreenHeight);
|
||||
|
||||
// Used for optimizing the screen blit into a single blit
|
||||
blitInfo.destX = windowCoords.singleBlitInfo.destX;
|
||||
|
@ -601,13 +601,9 @@ void RendererGL::display() {
|
|||
blitInfo.destHeight = windowCoords.singleBlitInfo.destHeight;
|
||||
|
||||
// Check if we can blit the screens in 1 blit. If not, we'll break it into two.
|
||||
// TODO: Maybe add some size-related checks too.
|
||||
blitInfo.canDoSingleBlit =
|
||||
windowCoords.topScreenY + windowCoords.topScreenHeight == windowCoords.bottomScreenY &&
|
||||
windowCoords.bottomScreenX == windowCoords.topScreenX + int(ScreenLayout::BOTTOM_SCREEN_X_OFFSET * windowCoords.scale) &&
|
||||
windowCoords.topScreenWidth == u32(ScreenLayout::TOP_SCREEN_WIDTH * windowCoords.scale) &&
|
||||
windowCoords.bottomScreenWidth == u32(ScreenLayout::BOTTOM_SCREEN_WIDTH * windowCoords.scale) &&
|
||||
windowCoords.topScreenHeight == u32(ScreenLayout::TOP_SCREEN_HEIGHT * windowCoords.scale) &&
|
||||
windowCoords.bottomScreenHeight == u32(ScreenLayout::BOTTOM_SCREEN_HEIGHT * windowCoords.scale);
|
||||
windowCoords.topScreenY + windowCoords.topScreenHeight == windowCoords.bottomScreenY && layout == ScreenLayout::Layout::Default;
|
||||
}
|
||||
|
||||
if (blitInfo.canDoSingleBlit) {
|
||||
|
|
|
@ -109,17 +109,21 @@ void RendererMTL::display() {
|
|||
ScreenLayout::WindowCoordinates windowCoords;
|
||||
ScreenLayout::calculateCoordinates(windowCoords, outputWindowWidth, outputWindowHeight, ScreenLayout::Layout::Default);
|
||||
|
||||
blitInfo.scale = windowCoords.scale;
|
||||
blitInfo.topScreenX = windowCoords.topScreenX;
|
||||
blitInfo.topScreenY = windowCoords.topScreenY;
|
||||
blitInfo.bottomScreenX = windowCoords.bottomScreenX;
|
||||
blitInfo.bottomScreenY = windowCoords.bottomScreenY;
|
||||
blitInfo.topScreenX = float(windowCoords.topScreenX);
|
||||
blitInfo.topScreenY = float(windowCoords.topScreenY);
|
||||
blitInfo.bottomScreenX = float(windowCoords.bottomScreenX);
|
||||
blitInfo.bottomScreenY = float(windowCoords.bottomScreenY);
|
||||
|
||||
blitInfo.topScreenWidth = float(windowCoords.topScreenWidth);
|
||||
blitInfo.topScreenHeight = float(windowCoords.topScreenHeight);
|
||||
blitInfo.bottomScreenWidth = float(windowCoords.bottomScreenWidth);
|
||||
blitInfo.bottomScreenHeight = float(windowCoords.bottomScreenHeight);
|
||||
}
|
||||
|
||||
// Top screen
|
||||
if (topScreen) {
|
||||
renderCommandEncoder->setViewport(
|
||||
MTL::Viewport{blitInfo.topScreenX, blitInfo.topScreenY, 400 * blitInfo.scale, 240 * blitInfo.scale, 0.0f, 1.0f}
|
||||
MTL::Viewport{blitInfo.topScreenX, blitInfo.topScreenY, blitInfo.topScreenWidth, blitInfo.topScreenHeight, 0.0f, 1.0f}
|
||||
);
|
||||
renderCommandEncoder->setFragmentTexture(topScreen->get().texture, 0);
|
||||
renderCommandEncoder->drawPrimitives(MTL::PrimitiveTypeTriangleStrip, NS::UInteger(0), NS::UInteger(4));
|
||||
|
@ -128,7 +132,7 @@ void RendererMTL::display() {
|
|||
// Bottom screen
|
||||
if (bottomScreen) {
|
||||
renderCommandEncoder->setViewport(
|
||||
MTL::Viewport{blitInfo.bottomScreenX, blitInfo.bottomScreenY, 320 * blitInfo.scale, 240 * blitInfo.scale, 0.0f, 1.0f}
|
||||
MTL::Viewport{blitInfo.bottomScreenX, blitInfo.bottomScreenY, blitInfo.bottomScreenWidth, blitInfo.bottomScreenHeight, 0.0f, 1.0f}
|
||||
);
|
||||
renderCommandEncoder->setFragmentTexture(bottomScreen->get().texture, 0);
|
||||
renderCommandEncoder->drawPrimitives(MTL::PrimitiveTypeTriangleStrip, NS::UInteger(0), NS::UInteger(4));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue