Example #1
0
        // Er wordt gechecked of op de knop wordt gedrukt, daarna wordt een event uitgevoerd
        public override void Update(GameTime gameTime, Input input)
        {
            mousePosition = input.MousePosition;
            if (mousePosition.Y > position.Y && mousePosition.Y < position.Y + size.Y)
            {
                if (input.IsLeftMouseDown() && ButtonDown != null)
                    ButtonDown(this, new EventArgs());
                else if (input.IsLeftMouseUp() && ButtonUp != null)
                    ButtonUp(this, new EventArgs());
            }

            scale = 1.0f;
            if (mousePosition.X > position.X && mousePosition.X < position.X + size.X &&            // er wordt gekeken of de muis op de knop staat, daarna wordt zn grootte aangepast
                mousePosition.Y > position.Y && mousePosition.Y < position.Y + size.Y)
                scale = 1.2f;

            position.X = (TetrisGame.WindowDimension.X - (int)ResourceManager.Fonts["Comic Sans"].MeasureString(label).X * scale) / 2;          // de positie wordt weer aangepast, afhankelijk van de scale
        }
Example #2
0
 // virtuele Update en Draw methode die overschreven gaan worden
 public virtual void Update(GameTime gametime, Input input)
 {
 }