diff options
Diffstat (limited to 'Penguloon/Controls')
| -rw-r--r-- | Penguloon/Controls/Checkbox.cs | 44 | ||||
| -rw-r--r-- | Penguloon/Controls/IngameOptions.cs | 27 | ||||
| -rw-r--r-- | Penguloon/Controls/LevelSelector.cs | 4 |
3 files changed, 73 insertions, 2 deletions
diff --git a/Penguloon/Controls/Checkbox.cs b/Penguloon/Controls/Checkbox.cs new file mode 100644 index 0000000..7db93f5 --- /dev/null +++ b/Penguloon/Controls/Checkbox.cs @@ -0,0 +1,44 @@ +using Microsoft.Xna.Framework; +using Penguloon.Scenes; + +namespace Penguloon.Controls +{ + public class Checkbox : ControlBase + { + public bool Selected { get; set; } = false; + + public Checkbox(SceneBase parentScene, Vector2 position, Vector2 size) : base(parentScene, position, size) + { + this.BackgroundIdle = ContentManager.GetTexture("UI/checkbox-empty"); + this.BackgroundPressed = ContentManager.GetTexture("UI/checkbox-empty"); + this.BackgroundDisabled = ContentManager.GetTexture("UI/checkbox-empty"); + + this.ForeColor = Color.White; + this.BorderColor = Color.Gray; + this.BorderWidth = 0; + this.Font = ContentManager.GetFont(StaticUIValues.MenuFont); + + OnClick += Button_OnClick; + } + + private void Button_OnClick(object sender, ClickArgs e) + { + Selected = !Selected; + + if (Selected) + { + this.BackgroundIdle = ContentManager.GetTexture("UI/checkbox-selected"); + this.BackgroundPressed = ContentManager.GetTexture("UI/checkbox-selected"); + this.BackgroundDisabled = ContentManager.GetTexture("UI/checkbox-selected"); + } + else + { + this.BackgroundIdle = ContentManager.GetTexture("UI/checkbox-empty"); + this.BackgroundPressed = ContentManager.GetTexture("UI/checkbox-empty"); + this.BackgroundDisabled = ContentManager.GetTexture("UI/checkbox-empty"); + } + + SoundManager.PlayClickSound(); + } + } +}
\ No newline at end of file diff --git a/Penguloon/Controls/IngameOptions.cs b/Penguloon/Controls/IngameOptions.cs index f59379d..0e2616c 100644 --- a/Penguloon/Controls/IngameOptions.cs +++ b/Penguloon/Controls/IngameOptions.cs @@ -25,6 +25,12 @@ namespace Penguloon.Controls public MuteButton BtnMute { get; set; } + public Checkbox CheckboxAutoStart { get; set; } + + Vector2 BtnSize; + Vector2 AutoStartTextPos; + string autoStartText; + public IngameOptions(SceneBase parentScene, Vector2 position, Vector2 size) : base(parentScene, position, size) { this.DrawText = false; @@ -32,7 +38,7 @@ namespace Penguloon.Controls this.BackgroundPressed = ContentManager.GetTexture("UI/optionsMenuBackground"); this.BackgroundDisabled = ContentManager.GetTexture("UI/optionsMenuBackground"); - Vector2 BtnSize = new Vector2(Size.X - 90, StaticUIValues.IngameUIPlayButtonHeight); + BtnSize = new Vector2(Size.X - 90, StaticUIValues.IngameUIPlayButtonHeight); Vector2 MsgBoxSize = new Vector2(900, 550); BtnMute = new MuteButton(parentScene, @@ -49,7 +55,18 @@ namespace Penguloon.Controls QuitConfirmationBox = new MessageBox(parentScene, new Vector2((StaticUIValues.ScreenViewport.X / 2) - (MsgBoxSize.X / 2), (StaticUIValues.ScreenViewport.Y / 2) - (MsgBoxSize.Y / 2)), - MsgBoxSize, parentScene.Main.Resources.GetString(Resource.String.IngameOptionsQuitConfirmation)); + MsgBoxSize, parentScene.Main.Resources.GetString(Resource.String.IngameOptionsQuitConfirmation)); + + CheckboxAutoStart = new Checkbox(parentScene, + new Vector2(position.X + (Size.X / 2) - (BtnSize.X / 2) + 20 + StaticUIValues.MenuButtonSize.Y, Position.Y + Size.Y - (50 * 2) - (BtnSize.Y * 2)), + new Vector2(StaticUIValues.MenuButtonSize.Y, StaticUIValues.MenuButtonSize.Y)); + + Font = ContentManager.GetFont(StaticUIValues.IngameFont); + + AutoStartTextPos = new Vector2(Position.X + (Size.X / 2) - (BtnSize.X / 2) + 20 + StaticUIValues.MenuButtonSize.Y + 20 + StaticUIValues.MenuButtonSize.Y, + Position.Y + Size.Y - (50 * 2) - (BtnSize.Y * 2) + (StaticUIValues.MenuButtonSize.Y / 2) - (Font.MeasureString("boeit niet").Y / 2)); + + autoStartText = parentScene.Main.Resources.GetString(Resource.String.IngameOptionsAutoStart); BtnContinue.OnClick += BtnContinue_OnClick; BtnQuit.OnClick += BtnQuit_OnClick; @@ -102,6 +119,11 @@ namespace Penguloon.Controls BtnContinue.Draw(deltaTime); BtnQuit.Draw(deltaTime); BtnMute.Draw(deltaTime); + CheckboxAutoStart.Draw(deltaTime); + + ParentScene.DrawText(Font, "Auto Start", + AutoStartTextPos, new Vector2(), TextAllignment.LeftTop, Color.White, Color.Gray, 2); + QuitConfirmationBox.Draw(deltaTime); } @@ -120,6 +142,7 @@ namespace Penguloon.Controls BtnContinue.Update(deltaTime, touchLocations); BtnQuit.Update(deltaTime, touchLocations); BtnMute.Update(deltaTime, touchLocations); + CheckboxAutoStart.Update(deltaTime, touchLocations); } } }
\ No newline at end of file diff --git a/Penguloon/Controls/LevelSelector.cs b/Penguloon/Controls/LevelSelector.cs index b5f0b26..885d6c1 100644 --- a/Penguloon/Controls/LevelSelector.cs +++ b/Penguloon/Controls/LevelSelector.cs @@ -108,6 +108,10 @@ namespace Penguloon.Controls Levels.Add(new SandLevel1()); Levels.Add(new SandLevel2()); + Levels.Add(new SandLevel3()); + + Levels.Add(new SpaceLevel1()); + Levels.Add(new SpaceLevel2()); } public override void Draw(float deltaTime) |
