Пример #1
0
        internal GameWindow(Game game, GameOptions options)
        {
            this.game = game;

            #if WINDOWS
            this.window = new Win32GameWindow(options);
            #endif

            this.window.Tick += this.Window_Tick;
            this.window.SizeChanged += this.Window_Resize;
            this.window.TextInput += this.Window_TextInput;

            this.window.Size = options.WindowSize;
        }
Пример #2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public Game(GameOptions options)
        {
            if (options == null)
                throw new ArgumentNullException(nameof(options));

            this.options = options;

            this.Window = new GameWindow(this, this.options);
            this.oldWindowWidth = this.Window.Width;
            this.oldWindowHeight = this.Window.Height;
            this.Window.Resize += this.Window_Resize;

            this.Graphics = new GraphicsContext(this.Window);
            this.Graphics.Viewport = new Rectangle(0, 0, this.Window.Width, this.Window.Height);
        }
Пример #3
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public Win32GameWindow(GameOptions options)
            : base()
        {
            this.options = options;

            this.Cursor = Cursors.Arrow;
            this.FormBorderStyle = options.WindowResizable ?  FormBorderStyle.Sizable : FormBorderStyle.Fixed3D;
            this.MaximizeBox = false;
            this.ClientSize = new System.Drawing.Size(options.WindowSize.Width, options.WindowSize.Height);
            this.KeyPreview = true;
            this.Visible = false;

            //this.Icon = Snowball.GameFramework.Properties.Resources.Icon;

            this.textInputEventArgs = new TextInputEventArgs();

            this.closeEventArgs = new CancelEventArgs();
        }