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/Data/Options.cs | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 V3/Data/Options.cs (limited to 'V3/Data/Options.cs') diff --git a/V3/Data/Options.cs b/V3/Data/Options.cs new file mode 100644 index 0000000..38670dc --- /dev/null +++ b/V3/Data/Options.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Xna.Framework; +using V3.Camera; + +namespace V3.Data +{ + /// + /// The graphics options. + /// + [Serializable] + public sealed class Options + { + /// + /// All available screen resolutions. + /// + public static List Resolutions { get; } = new List + { + new Point(800, 480), + new Point(800, 600), + new Point(1024, 768), + new Point(1280, 800), + new Point(1280, 1024), + new Point(1366, 768), + new Point(1920, 1080) + }; + + /// + /// All available camera types. + /// + public static List CameraTypes { get; } = + Enum.GetValues(typeof (CameraType)).Cast().ToList(); + + /// + /// All available debug modes. + /// + public static List DebugModes { get; } = + Enum.GetValues(typeof (DebugMode)).Cast().ToList(); + + /// + /// All available volume settings. + /// + public static List Volumes { get; } = new List() + { + 10, + 20, + 30, + 40, + 50, + 60, + 70, + 80, + 90, + 100 + }; + private static readonly Point sDefaultResolution = Resolutions[0]; + private static readonly bool sDefaultIsFullScreen = false; + private static readonly DebugMode sDefaultDebugMode = DebugMode.Off; + private static readonly CameraType sDefaultCameraType = CameraType.Scrolling; + private static readonly bool sDefaultIsMuted = false; + private static readonly int sDefaultVolume = 100; + + /// + /// The current screen resolution. + /// + public Point Resolution { get; set; } = sDefaultResolution; + + /// + /// True if the game should be run in full screen, otherwise false. + /// + public bool IsFullScreen { get; set; } = sDefaultIsFullScreen; + + /// + /// The current debug mode. + /// + public DebugMode DebugMode { get; set; } = sDefaultDebugMode; + + /// + /// The current camera type. + /// + public CameraType CameraType { get; set; } = sDefaultCameraType; + + /// + /// True if the sound is muted, otherwise false. + /// + public bool IsMuted { get; set; } = sDefaultIsMuted; + + /// + /// The volume to use for the sound (if the sound is not muted), range + /// 0 .. 100. + /// + public int Volume { get; set; } = sDefaultVolume; + + /// + /// Returns the effective volume with regard to the mute and volume + /// settings. + /// + /// the effective volume that should be used for sound + public float GetEffectiveVolume() + { + return IsMuted ? 0 : ((float) Volume) / 100; + } + } +} -- cgit v1.2.1