Beispiel #1
0
        private void Form1_Load(object sender, System.EventArgs e)
        {
            gameTime = new Framework2D.GameTime(frequency);
            Size dispsize = DisplaySize;

            //https://stackoverflow.com/questions/8406713/calculate-the-viewport-rectangle-of-a-zoomed-scrolled-canvas?rq=1
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            this.SetStyle(ControlStyles.UserPaint, false);
            this.Size            = dispsize;
            this.ClientSize      = dispsize;
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            this.SetStyle(ControlStyles.FixedHeight, true);
            this.SetStyle(ControlStyles.FixedWidth, false);
            this.MinimumSize = DisplaySize;
            this.MaximumSize = DisplaySize;
            this.Update();
            this.Location = new Point(0, 0);
            InitGDI(dispsize.Width, DisplaySize.Height);
            refresh = new Timer()
            {
                Interval = frequency, Enabled = true
            };
            refresh.Tick   += new EventHandler(GameLoop);
            this.KeyPress  += new KeyPressEventHandler(GameKeyPress);
            this.KeyUp     += new KeyEventHandler(GameKeyUp);
            this.KeyDown   += new KeyEventHandler(GameKeyDown);
            this.MouseDown += new MouseEventHandler(GameMouseDown);
            this.MouseUp   += new MouseEventHandler(GameMouseUp);
            this.MouseMove += new MouseEventHandler(GameMouseMove);
            audioPlayer     = new MciAudio(this);
            AudioPlayer     = new Tuple <MciAudio>(audioPlayer);
            DrawManager     = new Graphic.RenderManager();

            GameLoad();
        }
Beispiel #2
0
 //any actions when the game is closed;
 public void GameClosed()
 {
     MciAudio.Close();
 }