using Godot; using System; public partial class Main : Node2D { // public void ResizeChessboardToFitScreen() // { // var viewportSize = GetViewportRect().Size; // var designSize = new Vector2(800, 800); // 设计时棋盘的尺寸,这里假设为正方形 // var screenAspectRatio = viewportSize.X / viewportSize.Y; // var boardAspectRatio = designSize.X / designSize.Y; // // 计算保持棋盘比例的缩放因子 // float scaleFactor; // if (screenAspectRatio > boardAspectRatio) // { // // 屏幕更宽,按高度缩放 // scaleFactor = viewportSize.Y / designSize.Y; // } // else // { // // 屏幕更高或相等,按宽度缩放 // scaleFactor = viewportSize.X / designSize.X; // } // // 应用缩放 // GetNode("Chessboard").Scale = new Vector2(scaleFactor, scaleFactor); // } // Called when the node enters the scene tree for the first time. Global global = null; public override void _Ready() { // GetTree().Connect("screen_resized", ResizeChessboardToFitScreen); // Button undo = GetNode