コード例 #1
0
ファイル: GameWindow.cs プロジェクト: jonathansharman/crayon
        private GameWindow(double fps, int gameWidth, int gameHeight, int screenWidth, int screenHeight, int executionContextId)
            : base(screenWidth, screenHeight)
        {
            GameWindow.instance     = this;
            this.executionContextId = executionContextId;

            this.gameWidth    = gameWidth;
            this.gameHeight   = gameHeight;
            this.screenWidth  = screenWidth;
            this.screenHeight = screenHeight;
            this.X            = 50;
            this.Y            = 50;

            this.TargetRenderFrequency = fps;

            this.UpdateFrame += (sender, e) => this.Update();
            this.RenderFrame += (sender, e) => this.Render();
            this.Load        += (sender, e) => this.Startup();
            this.Resize      += (sender, e) => this.Resizing();

            this.Mouse.Move       += (sender, e) => this.MouseMove(e.X, e.Y);
            this.Mouse.ButtonDown += (sender, e) => this.MouseButton(e.Button, e.X, e.Y, true);
            this.Mouse.ButtonUp   += (sender, e) => this.MouseButton(e.Button, e.X, e.Y, false);
            this.Keyboard.KeyDown += (sender, e) => this.KeyEvent(e.Key, true);
            this.Keyboard.KeyUp   += (sender, e) => this.KeyEvent(e.Key, false);

            if (UniversalBitmap.IconSupported)
            {
                UniversalBitmap bmp = ResourceReader.ReadIconResource("icon.ico");
                if (bmp != null)
                {
                    this.Icon = bmp.GenerateIcon();
                }
            }
        }
コード例 #2
0
        private GameWindow(double fps, int gameWidth, int gameHeight, int screenWidth, int screenHeight, int executionContextId)
            : base(screenWidth, screenHeight)
        {
            GameWindow.instance     = this;
            this.executionContextId = executionContextId;

            this.gameWidth    = gameWidth;
            this.gameHeight   = gameHeight;
            this.screenWidth  = screenWidth;
            this.screenHeight = screenHeight;
            this.X            = 50;
            this.Y            = 50;

            this.TargetRenderFrequency = fps;

            this.UpdateFrame += (sender, e) => this.Update();
            this.RenderFrame += (sender, e) => this.Render();
            this.Load        += (sender, e) => this.Startup();
            this.Resize      += (sender, e) => this.Resizing();

            if (UniversalBitmap.IconSupported)
            {
                UniversalBitmap bmp = ResourceReader.ReadIconResource("icon.ico");
                if (bmp != null)
                {
                    this.Icon = bmp.GenerateIcon();
                }
            }
        }