From ced3d03bdb3ce866d832e03fb212865140905a9a Mon Sep 17 00:00:00 2001 From: Thomas Leyh Date: Sun, 24 Jul 2016 08:14:18 +0200 Subject: Add project files. --- V3/Screens/AbstractScreen.cs | 57 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 V3/Screens/AbstractScreen.cs (limited to 'V3/Screens/AbstractScreen.cs') diff --git a/V3/Screens/AbstractScreen.cs b/V3/Screens/AbstractScreen.cs new file mode 100644 index 0000000..becd38d --- /dev/null +++ b/V3/Screens/AbstractScreen.cs @@ -0,0 +1,57 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using V3.Input; + +namespace V3.Screens +{ + public abstract class AbstractScreen : IScreen + { + /// + /// Indicates whether screens below this one should be updated. + /// + public bool UpdateLower { get; } + + /// + /// Indicates whether screens below this one should be drawn. + /// + public bool DrawLower { get; } + + protected AbstractScreen(bool updateLower, bool drawLower) + { + UpdateLower = updateLower; + DrawLower = drawLower; + } + + /// + /// Handles the given key event and returns whether it should be passed + /// to the screens below this one. + /// + /// the key event that occurred + /// true if the event has been handeled by this screen and + /// should not be passed to the lower screens, false otherwise + public virtual bool HandleKeyEvent(IKeyEvent keyEvent) + { + return false; + } + + /// + /// Handles the given mouse event and returns whether it should be passed + /// to the screens below this one. + /// + /// the mouse event that occurred + /// true if the event has been handeled by this screen and + /// should not be passed to the lower screens, false otherwise + public virtual bool HandleMouseEvent(IMouseEvent mouseEvent) + { + return true; + } + + public virtual void Update(GameTime gameTime) + { + } + + public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch) + { + } + } +} -- cgit v1.2.1