Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions DeltaCore/UI/Game/GameViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ open class GameViewController: UIViewController, GameControllerReceiver

public var automaticallyPausesWhileInactive: Bool = true

// Offset applied to the game view while it's centered with no on-screen controls.
public var gameScreenOffset: CGPoint = .zero

public var gameView: GameView! {
return self.gameViews.first
}
Expand Down Expand Up @@ -361,7 +364,7 @@ open class GameViewController: UIViewController, GameControllerReceiver
contentAspectRatio = gameScreenDimensions
}

let appPlacementFrame = AVMakeRect(aspectRatio: contentAspectRatio, insideRect: availableGameFrame).rounded()
let appPlacementFrame = AVMakeRect(aspectRatio: contentAspectRatio, insideRect: availableGameFrame).rounded().offsetBy(dx: self.gameScreenOffset.x, dy: self.gameScreenOffset.y)
if self.appPlacementLayoutGuide.layoutFrame.rounded() != appPlacementFrame
{
self.appPlacementXConstraint.constant = appPlacementFrame.minX
Expand Down Expand Up @@ -401,7 +404,7 @@ open class GameViewController: UIViewController, GameControllerReceiver
else
{
let gameScreenFrame = AVMakeRect(aspectRatio: gameScreenDimensions, insideRect: availableGameFrame)
self.gameView.frame = gameScreenFrame
self.gameView.frame = gameScreenFrame.offsetBy(dx: self.gameScreenOffset.x, dy: self.gameScreenOffset.y)
}

if let emulatorCore = self.emulatorCore, emulatorCore.state != .running
Expand Down