aboutsummaryrefslogtreecommitdiff
path: root/V3/Screens/AbstractScreen.cs
blob: becd38d2722b8d3a8b2adb9dcae90a3b6a87579c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using V3.Input;

namespace V3.Screens
{
    public abstract class AbstractScreen : IScreen
    {
        /// <summary>
        /// Indicates whether screens below this one should be updated.
        /// </summary>
        public bool UpdateLower { get; }

        /// <summary>
        /// Indicates whether screens below this one should be drawn.
        /// </summary>
        public bool DrawLower { get; }

        protected AbstractScreen(bool updateLower, bool drawLower)
        {
            UpdateLower = updateLower;
            DrawLower = drawLower;
        }

        /// <summary>
        /// Handles the given key event and returns whether it should be passed
        /// to the screens below this one.
        /// </summary>
        /// <param name="keyEvent">the key event that occurred</param>
        /// <returns>true if the event has been handeled by this screen and
        /// should not be passed to the lower screens, false otherwise</returns>
        public virtual bool HandleKeyEvent(IKeyEvent keyEvent)
        {
            return false;
        }

        /// <summary>
        /// Handles the given mouse event and returns whether it should be passed
        /// to the screens below this one.
        /// </summary>
        /// <param name="mouseEvent">the mouse event that occurred</param>
        /// <returns>true if the event has been handeled by this screen and
        /// should not be passed to the lower screens, false otherwise</returns>
        public virtual bool HandleMouseEvent(IMouseEvent mouseEvent)
        {
            return true;
        }

        public virtual void Update(GameTime gameTime)
        {
        }

        public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
        }
    }
}