Exemple #1
0
        /// <summary>
        /// Создает экземпляр игры, и связывает его с игровым окном, которым является PictureBox
        /// </summary>
        /// <param name="gameWindow">PictureBox - игровое окно</param>
        public Game(PictureBox gameWindow)
        {
            this.GameWindow  = gameWindow;
            this.Image       = new Bitmap(GameWindow.Width, GameWindow.Height);
            this.G           = Graphics.FromImage(Image);
            this.Objects     = new ObjectCollection();
            this.windowColor = Color.Black;
            this.StepTimer   = new Timer();

            this.StepTimer.Interval = 17;

            this.StepTimer.Tick += StepTimer_Tick;

            this.StepTimer.Start();
            this.GameWindow.MouseDown += GameWindow_MouseDown;
            this.GameWindow.MouseUp   += GameWindow_MouseUp;
        }
Exemple #2
0
        /// <summary>
        /// Создает экземпляр игры, и связывает его с игровым окном, которым является PictureBox
        /// </summary>
        /// <param name="gameWindow">PictureBox - игровое окно</param>
        public Game(PictureBox gameWindow)
        {
            this.GameWindow      = gameWindow;
            this.Image           = new Bitmap(GameWindow.Width, GameWindow.Height);
            this.G               = Graphics.FromImage(Image);
            this.G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            this.Objects         = new ObjectCollection();
            this.windowColor     = Color.Black;
            this.StepTimer       = new Timer();

            this.StepTimer.Interval = 17;

            this.StepTimer.Tick += StepTimer_Tick;

            this.StepTimer.Start();
            this.GameWindow.MouseDown += GameWindow_MouseDown;
            this.GameWindow.MouseUp   += GameWindow_MouseUp;
            this.GameWindow.MouseMove += GameWindow_MouseMove;
        }