public Game1(FormSettings settings) : base(settings) { Paint += Game1_Paint; Invalidate += Game1_Invalidate; Click += Game1_MouseClick; }
static void Main(string[] args) { // Form Settings FormSettings settings = new FormSettings() { ContentDirectory = "Content", ScreenSize = new Microsoft.Xna.Framework.Point(800, 600), Windowed = true, WindowMouseView = true, FormContolLayout = new DefaultLayuout(), Window = new DefaultGameWindow() }; // Run Window using (Game1 game = new Game1(settings)) game.Run(); }
/// <summary> /// Конструктор по умолчанию /// </summary> protected Form(FormSettings settings) : this(settings.FormContolLayout) { _gameWindow = settings.Window ?? new DefaultGameWindow(); #region Screen Size Corrections Point screen; screen.X = settings.ScreenSize.X > GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width ? GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width : settings.ScreenSize.X; screen.Y = settings.ScreenSize.Y > GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height ? GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height : settings.ScreenSize.Y; _gameWindow.Screen = screen; Content.RootDirectory = settings.ContentDirectory; #endregion ControlInicializer(_gameWindow); Controls = settings.FormContolLayout; _gameWindow.GraphicsDeviceManager.IsFullScreen = !settings.Windowed; _gameWindow.IsMouseVisible = settings.WindowMouseView; _gameWindow.TargetElapsedTime = TimeSpan.FromSeconds(1.0f / 100.0f); _gameWindow.IsFixedTimeStep = false; _gameWindow.GraphicsDeviceManager.SynchronizeWithVerticalRetrace = false; AplyScreenSize(); InicializeFormComponent(); }
public MainForm(FormSettings settings) : base(settings) { InicializeComponent(); }