how does one set the (OS) window size/clientRect in an code only environment at startup?
what i tried, but didnt work:
- setting PreferredBackBufferWidth/Height of Game.GraphicsDeviceManager
- setting Game.Window.PreferredWindowedSize in the OnWindowCreatedEvent
(in that event i can set the position of the window but the preferred size is ignored)
- both (1 & 2)
In StartupScript try this:
var game = (Game)Game; game.IsFixedTimeStep = true; game.GraphicsDeviceManager.PreferredBackBufferWidth = 1920; game.GraphicsDeviceManager.PreferredBackBufferHeight = 1080; game.GraphicsDeviceManager.IsFullScreen = true; game.GraphicsDeviceManager.ApplyChanges();
Hi thanks for your answer!
that was the method i tried in point 1.
but it didnt work, now i know why 
when creating the game device i tried to use feature level GraphicsProfile.Level_11_2.
this only worked with using AutoLoadDefaultSettings = true
but this somehow prevents the usage of my preferred settings.
using AutoLoadDefaultSettings = false now let me set the size
example:
strideGameInstance = new CustomGameClass
{
GraphicsDeviceManager =
{
PreferredGraphicsProfile = new[] {GraphicsProfile.Level_11_1},
PreferredBackBufferWidth = OsWindow.ClientRectSize.X,
PreferredBackBufferHeight = OsWindow.ClientRectSize.Y
},
AutoLoadDefaultSettings = false
};
then one can set the windowsize by adding an event to Game.WindowCreated:
strideGame.WindowCreated += OnStrideEngineGameWindowCreated;
like this:
private void OnStrideEngineGameWindowCreated(object sender, EventArgs e)
{
strideGame.Window.Title = OsWindow.Title;
strideGame.Window.Position = new Int2(OsWindow.Position.X, OsWindow.Position.Y);
}
strideGame is the stride game class “Game”.