0
GraphicsWindow.Width = 1080
GraphicsWindow.Height = 607.5

gw = 1080
gh = 607.5
GraphicsWindow.Left = 0
GraphicsWindow.Top = 0

dw = Desktop.Width
dh = Desktop.Height

WidthMod = dw / gw
HeightMod = dh / gh

newWidth = 1080 * WidthMod
newHeight = 607.5 * HeightMod

distanceWidth = newWidth - gw
distanceHeight = newHeight - gh

 LDGraphicsWindow.Reposition(WidthMod, HeightMod, distanceWidth / 2, distanceHeight / 1.3, 0)

重新定位命令的语法是:reposition(scaleX, scaleY, panX, panY, angle) 我不明白为什么将distanceWidth(这是旧屏幕和新屏幕大小之间的差异)除以2或将distanceHeight除以1.3将游戏平移到我需要它的最高角落。我想平移它,以便该游戏具有相同的视图,仅取决于 16:9 的比例。

请帮忙 OMG PLESAE :(((((

4

1 回答 1

0

LDGraphicsWindow.Repsoition实际上根本不移动或缩放窗口,它只是移动窗口内的所有形状。这可能不是你要找的。

如果您只是想为给定的纵横比创建最大的 GraphicsWindow 并将其居中,则可以使用非常标准的代码轻松完成:

textRatio = "16:9"

ratioArr = LDText.Split(textRatio, ":")

ratio = ratioArr[1] / ratioArr[2] ' Get the numerical ratio from the text
curRatio = Desktop.Width/Desktop.Height ' Get the current ratio

GraphicsWindow.Show()

If curRatio > ratio Then 'Screen is too wide
  GraphicsWindow.Width = Desktop.Height * ratio
  GraphicsWindow.Height = Desktop.Height
ElseIf curRatio < ratio Then 'Screen is too tall
  GraphicsWindow.Height = Desktop.Width / ratio
  GraphicsWindow.Width = Desktop.Width
EndIf

'Center the window
GraphicsWindow.Left = (Desktop.Width/2)-(GraphicsWindow.Width/2)
GraphicsWindow.Top = (Desktop.Height/2)-(GraphicsWindow.Height/2)
于 2021-12-06T17:39:54.523 回答