문제
XNA에서 창 크기를 어떻게 조정할 수 있습니까?
기본 800x600 해상도로 시작됩니다.
해결책 2
나는 당신이 설정해야한다는 것을 알았습니다
GraphicDevice.PreferredBackBufferHeight = height;
GraphicDevice.PreferredBackBufferWidth = width;
게임 클래스의 생성자 에서이 작업을 수행하면 작동하지만 생성자 외부 에서이 작업을 시도하면 호출해야합니다.
GraphicsDevice.ApplyChanges();
또한 풀 스크린 (디버깅 중에 실제로 제대로 작동하지 않음)을 사용하면 사용할 수 있습니다.
if (!GraphicsDevice.IsFullScreen)
GraphicsDevice.ToggleFullScreen();
다른 팁
XNA 4.0 기준 으로이 속성은 이제 GraphicsDeviceManager
. 즉. 이 코드는 게임의 생성자에 들어갑니다.
graphics = new GraphicsDeviceManager(this);
graphics.IsFullScreen = false;
graphics.PreferredBackBufferHeight = 340;
graphics.PreferredBackBufferWidth = 480;
// if changing GraphicsDeviceManager properties outside
// your game constructor also call:
// graphics.ApplyChanges();
당신은 이것을보아야합니다. http://forums.xna.com/forums/p/1031/107718.aspx.
이 솔루션은 XNA 3.0에서 작동합니다. 게임 객체의 생성자에 넣으십시오.
// Resize the screen to 1024 x 768.
IntPtr ptr = this.Window.Handle;
System.Windows.Forms.Form form = (System.Windows.Forms.Form)System.Windows.Forms.Control.FromHandle(ptr);
form.Size = new System.Drawing.Size(1024, 768);
graphics.PreferredBackBufferWidth = 1024;
graphics.PreferredBackBufferHeight = 768;
graphics.ApplyChanges();
제휴하지 않습니다 StackOverflow