Search code examples
c#monogamesavechanges

how i can save the windowsize in monogame?


In my c# MonoGame I can change the window size to full screen and to window screen size. How I can save it? When I leave the game, it should start with the same window size as the one which I choose before. How can I save it?


Solution

  • You have multiple options for this, but you will need to use storage that is unrelated to Monogame.

    What I would usually do is save a file to the user disk when modifying a setting. Then, when you load the game, you check to see if that file exists and if it does you load the values from it and then apply them to your game.

    Using windows registry could also be a solution, but have more limitation (you need to run the game as an admin) (C# Create Values in Registry Local Machine)