From 92b3bc04f3711d588126e8e30485cb368a61dc28 Mon Sep 17 00:00:00 2001 From: jason2211 Date: Tue, 21 Nov 2017 19:58:03 -0500 Subject: [PATCH 01/13] ObjectPool Enumeration Bug (#440) * Modified Entity's Reset method to clear _name field * ObjectPool enumerations was stuck in a loop since the tail node's next node was getting set to itself --- .../Collections/ObjectPool.cs | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Source/MonoGame.Extended/Collections/ObjectPool.cs b/Source/MonoGame.Extended/Collections/ObjectPool.cs index dd1f5201..116ff0a2 100644 --- a/Source/MonoGame.Extended/Collections/ObjectPool.cs +++ b/Source/MonoGame.Extended/Collections/ObjectPool.cs @@ -49,8 +49,8 @@ namespace MonoGame.Extended.Collections var node = _headNode; while (node != null) { - node = (T)_headNode.NextNode; yield return node; + node = (T)node.NextNode; } } @@ -101,13 +101,15 @@ namespace MonoGame.Extended.Collections { TotalCount++; var item = _instantiationFunction(); + if (item == null) + throw new NullReferenceException($"The created pooled object of type '{typeof(T).Name}' is null."); item.PreviousNode = _tailNode; item.NextNode = null; + if (_headNode == null) + _headNode = item; if (_tailNode != null) _tailNode.NextNode = item; _tailNode = item; - if (item == null) - throw new NullReferenceException($"The created pooled object of type '{typeof(T).Name}' is null."); return item; } @@ -130,6 +132,9 @@ namespace MonoGame.Extended.Collections if (item == _tailNode) _tailNode = previousNode; + if (_tailNode != null) + _tailNode.NextNode = null; + _freeItems.AddToBack(poolable1); ItemReturned?.Invoke((T)item); @@ -139,9 +144,12 @@ namespace MonoGame.Extended.Collections { item.Initialize(_returnToPoolDelegate); item.NextNode = null; - item.PreviousNode = _tailNode; - _tailNode.NextNode = item; - _tailNode = item; + if (item != _tailNode) + { + item.PreviousNode = _tailNode; + _tailNode.NextNode = item; + _tailNode = item; + } ItemUsed?.Invoke(item); } From 97d237f11f4d3ca51f747ec278e8697eb0dd2e61 Mon Sep 17 00:00:00 2001 From: tspayne87 Date: Sun, 26 Nov 2017 03:48:57 -0700 Subject: [PATCH 02/13] [GUI] Propegation changed also adding in fix for Issue #428 (#441) * Adding in changes to deal with custom control types for loading from a GuiScreen, also adding in block text if a width for the element exists. Adding in Padding to some elements to give the developer some more options in styles. Adding in some changes to the textbox to deal with selecting a section of text. * Adding in a few changes to deal with propagation down the GuiControl tree, this was added to most events. Also, adding in the idea of a form and submit button to deal with keyboard controls when inside of a form. This gives simalar behavier to how forms work in the browser. * Adding in the enter key skip for the textbox. * Fixing issue where GuiSystem would call initialize twice * Adding in a fix for Issue #428, by leveraging the propegation system to deal with hover styles. --- .../Controls/GuiControl.cs | 29 +++++++----- .../Controls/GuiTextBox.cs | 2 +- Source/MonoGame.Extended.Gui/GuiSystem.cs | 5 ++- .../Screens/ScreenGameComponent.cs | 3 +- .../Sandbox/Content/adventure-gui-skin.json | 9 ++++ .../Sandbox/Content/test-addition-screen.json | 45 +++++++++++++++++-- Source/Tests/Sandbox/Game1.cs | 16 ++++++- 7 files changed, 88 insertions(+), 21 deletions(-) diff --git a/Source/MonoGame.Extended.Gui/Controls/GuiControl.cs b/Source/MonoGame.Extended.Gui/Controls/GuiControl.cs index 231ba515..9d32768f 100644 --- a/Source/MonoGame.Extended.Gui/Controls/GuiControl.cs +++ b/Source/MonoGame.Extended.Gui/Controls/GuiControl.cs @@ -70,6 +70,8 @@ namespace MonoGame.Extended.Gui.Controls public HorizontalAlignment HorizontalTextAlignment { get; set; } = HorizontalAlignment.Centre; public VerticalAlignment VerticalTextAlignment { get; set; } = VerticalAlignment.Centre; + private bool _isHovering; + private string _text; public string Text { @@ -169,16 +171,8 @@ namespace MonoGame.Extended.Gui.Controls public virtual void OnScrolled(int delta) { } - public virtual bool OnKeyTyped(IGuiContext context, KeyboardEventArgs args) - { - if (args.Key == Keys.Tab || args.Key == Keys.Enter) return false; - return true; - } - public virtual bool OnKeyPressed(IGuiContext context, KeyboardEventArgs args) - { - if (args.Key == Keys.Tab || args.Key == Keys.Enter) return false; - return true; - } + public virtual bool OnKeyTyped(IGuiContext context, KeyboardEventArgs args) { return true; } + public virtual bool OnKeyPressed(IGuiContext context, KeyboardEventArgs args) { return true; } public virtual bool OnFocus(IGuiContext context) { return true; } public virtual bool OnUnfocus(IGuiContext context) { return true; } @@ -189,15 +183,21 @@ namespace MonoGame.Extended.Gui.Controls public virtual bool OnPointerEnter(IGuiContext context, GuiPointerEventArgs args) { - if (IsEnabled) + if (IsEnabled && !_isHovering) + { + _isHovering = true; HoverStyle?.Apply(this); + } return true; } public virtual bool OnPointerLeave(IGuiContext context, GuiPointerEventArgs args) { - if (IsEnabled) + if (IsEnabled && _isHovering) + { + _isHovering = false; HoverStyle?.Revert(this); + } return true; } @@ -212,6 +212,11 @@ namespace MonoGame.Extended.Gui.Controls DrawForeground(context, renderer, deltaSeconds, GetTextInfo(context, CreateBoxText(Text, Font ?? context.DefaultFont, Width), BoundingRectangle, HorizontalTextAlignment, VerticalTextAlignment)); } + public bool HasParent(GuiControl control) + { + return Parent != null && (Parent == control || Parent.HasParent(control)); + } + protected List FindControls() where T : GuiControl { diff --git a/Source/MonoGame.Extended.Gui/Controls/GuiTextBox.cs b/Source/MonoGame.Extended.Gui/Controls/GuiTextBox.cs index cda3ddcf..9b22fd7f 100644 --- a/Source/MonoGame.Extended.Gui/Controls/GuiTextBox.cs +++ b/Source/MonoGame.Extended.Gui/Controls/GuiTextBox.cs @@ -121,7 +121,7 @@ namespace MonoGame.Extended.Gui.Controls { case Keys.Tab: case Keys.Enter: - return false; + return true; case Keys.Back: if (Text.Length > 0) { diff --git a/Source/MonoGame.Extended.Gui/GuiSystem.cs b/Source/MonoGame.Extended.Gui/GuiSystem.cs index 75ef179c..85021895 100644 --- a/Source/MonoGame.Extended.Gui/GuiSystem.cs +++ b/Source/MonoGame.Extended.Gui/GuiSystem.cs @@ -162,7 +162,8 @@ namespace MonoGame.Extended.Gui if (_hoveredControl != hoveredControl) { - PropagateDown(_hoveredControl, x => x.OnPointerLeave(this, args)); + if (_hoveredControl != null && (hoveredControl == null || !hoveredControl.HasParent(_hoveredControl))) + PropagateDown(_hoveredControl, x => x.OnPointerLeave(this, args)); _hoveredControl = hoveredControl; PropagateDown(_hoveredControl, x => x.OnPointerEnter(this, args)); } @@ -200,7 +201,7 @@ namespace MonoGame.Extended.Gui /// A function to check if the propagation should resume, if returns false it will continue down the tree. private void PropagateDown(GuiControl control, Func predicate) { - while(control != null && !predicate(control)) + while(control != null && predicate(control)) { control = control.Parent; } diff --git a/Source/MonoGame.Extended/Screens/ScreenGameComponent.cs b/Source/MonoGame.Extended/Screens/ScreenGameComponent.cs index b82b631b..bc93a2c8 100644 --- a/Source/MonoGame.Extended/Screens/ScreenGameComponent.cs +++ b/Source/MonoGame.Extended/Screens/ScreenGameComponent.cs @@ -52,7 +52,8 @@ namespace MonoGame.Extended.Screens public override void Initialize() { foreach (var screen in _screens) - screen.Initialize(); + if (!screen.IsInitialized) // Check if screen has already been Initialized from the register + screen.Initialize(); base.Initialize(); } diff --git a/Source/Tests/Sandbox/Content/adventure-gui-skin.json b/Source/Tests/Sandbox/Content/adventure-gui-skin.json index b4fed6bf..c90072a4 100644 --- a/Source/Tests/Sandbox/Content/adventure-gui-skin.json +++ b/Source/Tests/Sandbox/Content/adventure-gui-skin.json @@ -94,6 +94,15 @@ { "Name": "brown-panel-no-size", "Type": "GuiStackPanel", + "BackgroundRegion": "panel_brown", + "HoverStyle": { + "Type": "GuiStackPanel", + "BackgroundRegion": "panelInset_beige" + } + }, + { + "Name": "brown-grid-no-size", + "Type": "GuiUniformGrid", "BackgroundRegion": "panel_brown" }, { diff --git a/Source/Tests/Sandbox/Content/test-addition-screen.json b/Source/Tests/Sandbox/Content/test-addition-screen.json index 111c33c1..144e4b67 100644 --- a/Source/Tests/Sandbox/Content/test-addition-screen.json +++ b/Source/Tests/Sandbox/Content/test-addition-screen.json @@ -1,12 +1,49 @@ { "Skin": "Content/adventure-gui-skin.json", - "Name": "test-addition-screen", + "Name": "test-additional-screen", "Controls": [ { - "Type": "GuiStackPanel", + "Type": "GuiUniformGrid", "Name": "MainPanel", - "Style": "brown-panel-no-size", - "Padding": "15" + "Padding": "15", + "Style": "brown-grid-no-size", + "HorizontalAlignment": "Stretch", + "VerticalAlignment": "Top", + "Orientation": "Horizontal", + "Height": "60", + "Rows": "1", + "Columns": "2", + "Controls": [ + { + "Type": "GuiLabel", + "Style": "label", + "TextColor": "#FFFFFF", + "Margin": "0 10", + "Width": "200", + "Height": "30", + "Text": "Hello World", + "HorizontalAlignment": "Left" + }, + { + "Type": "GuiStackPanel", + "Orientation": "Horizontal", + "Margin": "0 10", + "Controls": [ + { + "Type": "GuiButton", + "Width": "200", + "Text": "Test", + "Style": "white-button" + }, + { + "Type": "GuiButton", + "Width": "200", + "Text": "Test", + "Style": "white-button" + } + ] + } + ] } ] } diff --git a/Source/Tests/Sandbox/Game1.cs b/Source/Tests/Sandbox/Game1.cs index 9443194d..c3c3d716 100644 --- a/Source/Tests/Sandbox/Game1.cs +++ b/Source/Tests/Sandbox/Game1.cs @@ -63,13 +63,17 @@ namespace Sandbox { IsMouseVisible = false; - _viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, _graphicsDeviceManager.PreferredBackBufferWidth, _graphicsDeviceManager.PreferredBackBufferHeight); + // _viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, _graphicsDeviceManager.PreferredBackBufferWidth, _graphicsDeviceManager.PreferredBackBufferHeight); + _viewportAdapter = new WindowViewportAdapter(Window, GraphicsDevice); _skin = GuiSkin.FromFile(Content, @"Content/adventure-gui-skin.json", typeof(MyPanel)); var guiRenderer = new GuiSpriteBatchRenderer(GraphicsDevice, _viewportAdapter.GetScaleMatrix); var viewModel = new ViewModel(); + //_screen = GuiScreen.FromFile(Content, "Content/test-addition-screen.json", typeof(MyPanel)); + //Window.ClientSizeChanged += OnClientSizeChanged; + _screen = GuiScreen.FromFile(Content, "Content/adventure-gui-screen.json", typeof(MyPanel)); var listBox = _screen.FindControl("Listbox"); @@ -123,5 +127,15 @@ namespace Sandbox listBox.Items.Add(new { Name = textBox.Text }); } } + private void OnClientSizeChanged(object sender, EventArgs eventArgs) + { + if (_guiSystem != null) + { + foreach (var screen in _guiSystem.Screens) + { + screen.Layout(_guiSystem, _guiSystem.BoundingRectangle); + } + } + } } } From 61614b5ffab6c1f7f067077a1350cb7b200e24cd Mon Sep 17 00:00:00 2001 From: tspayne87 Date: Sun, 17 Dec 2017 04:36:10 -0700 Subject: [PATCH 03/13] [GUI] Binding Context / Control Style Fixes (#443) * Adding in changes to deal with custom control types for loading from a GuiScreen, also adding in block text if a width for the element exists. Adding in Padding to some elements to give the developer some more options in styles. Adding in some changes to the textbox to deal with selecting a section of text. * Adding in a few changes to deal with propagation down the GuiControl tree, this was added to most events. Also, adding in the idea of a form and submit button to deal with keyboard controls when inside of a form. This gives simalar behavier to how forms work in the browser. * Adding in the enter key skip for the textbox. * Fixing issue where GuiSystem would call initialize twice * Adding in a fix for Issue #428, by leveraging the propegation system to deal with hover styles. * Adding in some changes to seperate the global binding context and have it isolated in the screen. Also adding in code to deal with a global style binding as well. --- .../Controls/GuiControl.cs | 33 +++++++- .../Controls/GuiStackPanel.cs | 11 +-- .../Controls/GuiTextBox.cs | 3 +- .../MonoGame.Extended.Gui/GuiControlStyle.cs | 10 +-- Source/MonoGame.Extended.Gui/GuiElement.cs | 8 +- Source/MonoGame.Extended.Gui/GuiScreen.cs | 22 +++++ Source/MonoGame.Extended.Gui/GuiSystem.cs | 1 + .../Content/adventure-gui-button-screen.json | 80 +++++++++++++++++++ .../Sandbox/Content/adventure-gui-screen.json | 3 + .../Sandbox/Content/adventure-gui-skin.json | 26 ++++++ .../Sandbox/Experiments/BindingScreen.cs | 3 +- Source/Tests/Sandbox/Game1.cs | 53 +++++++++--- Source/Tests/Sandbox/Sandbox.csproj | 3 + 13 files changed, 224 insertions(+), 32 deletions(-) create mode 100644 Source/Tests/Sandbox/Content/adventure-gui-button-screen.json diff --git a/Source/MonoGame.Extended.Gui/Controls/GuiControl.cs b/Source/MonoGame.Extended.Gui/Controls/GuiControl.cs index 9d32768f..20561cae 100644 --- a/Source/MonoGame.Extended.Gui/Controls/GuiControl.cs +++ b/Source/MonoGame.Extended.Gui/Controls/GuiControl.cs @@ -60,6 +60,10 @@ namespace MonoGame.Extended.Gui.Controls [EditorBrowsable(EditorBrowsableState.Never)] public bool IsFocused { get; set; } + [JsonIgnore] + [EditorBrowsable(EditorBrowsableState.Never)] + public Guid Id { get; set; } = Guid.NewGuid(); + public Vector2 Offset { get; set; } public BitmapFont Font { get; set; } public Color TextColor { get; set; } @@ -150,8 +154,11 @@ namespace MonoGame.Extended.Gui.Controls get { return _isEnabled; } set { - _isEnabled = value; - DisabledStyle?.ApplyIf(this, !_isEnabled); + if (_isEnabled != value) + { + _isEnabled = value; + DisabledStyle?.ApplyIf(this, !_isEnabled); + } } } @@ -217,6 +224,28 @@ namespace MonoGame.Extended.Gui.Controls return Parent != null && (Parent == control || Parent.HasParent(control)); } + public override void SetBinding(string viewProperty, string viewModelProperty) + { + SetBindingToRoot(new Binding + { + Element = this, + ViewProperty = viewProperty, + ViewModelProperty = viewModelProperty + }); + } + + private void SetBindingToRoot(Binding binding) + { + if (Parent != null) + { + Parent.SetBindingToRoot(binding); + } + else + { + _bindings.Add(binding); + } + } + protected List FindControls() where T : GuiControl { diff --git a/Source/MonoGame.Extended.Gui/Controls/GuiStackPanel.cs b/Source/MonoGame.Extended.Gui/Controls/GuiStackPanel.cs index 859c10c5..8e9d486f 100644 --- a/Source/MonoGame.Extended.Gui/Controls/GuiStackPanel.cs +++ b/Source/MonoGame.Extended.Gui/Controls/GuiStackPanel.cs @@ -17,8 +17,8 @@ namespace MonoGame.Extended.Gui.Controls } public GuiOrientation Orientation { get; set; } = GuiOrientation.Vertical; - public Thickness Padding { get; set; } + public int Spacing { get; set; } = 0; protected override Size2 CalculateDesiredSize(IGuiContext context, Size2 availableSize) { @@ -44,8 +44,9 @@ namespace MonoGame.Extended.Gui.Controls } } - width += Padding.Left + Padding.Right; - height += Padding.Top + Padding.Bottom; + + width += Padding.Left + Padding.Right + (Orientation == GuiOrientation.Horizontal ? (Controls.Count - 1) * Spacing : 0); + height += Padding.Top + Padding.Bottom + (Orientation == GuiOrientation.Vertical ? (Controls.Count - 1) * Spacing : 0); return new Size2(width, height); } @@ -66,14 +67,14 @@ namespace MonoGame.Extended.Gui.Controls control.VerticalAlignment = VerticalAlignment.Top; PlaceControl(context, control, 0f, y, Width, desiredSize.Height); - y += desiredSize.Height; + y += desiredSize.Height + Spacing; availableSize.Height -= desiredSize.Height; break; case GuiOrientation.Horizontal: control.HorizontalAlignment = HorizontalAlignment.Left; PlaceControl(context, control, x, 0f, desiredSize.Width, Height); - x += desiredSize.Width; + x += desiredSize.Width + Spacing; availableSize.Height -= desiredSize.Height; break; default: diff --git a/Source/MonoGame.Extended.Gui/Controls/GuiTextBox.cs b/Source/MonoGame.Extended.Gui/Controls/GuiTextBox.cs index 9b22fd7f..0b53e582 100644 --- a/Source/MonoGame.Extended.Gui/Controls/GuiTextBox.cs +++ b/Source/MonoGame.Extended.Gui/Controls/GuiTextBox.cs @@ -26,9 +26,8 @@ namespace MonoGame.Extended.Gui.Controls protected override void OnTextChanged() { - if (SelectionStart > Text.Length) + if (!string.IsNullOrEmpty(Text) && SelectionStart > Text.Length) SelectionStart = Text.Length; - base.OnTextChanged(); } diff --git a/Source/MonoGame.Extended.Gui/GuiControlStyle.cs b/Source/MonoGame.Extended.Gui/GuiControlStyle.cs index f3ed5ec2..d045bede 100644 --- a/Source/MonoGame.Extended.Gui/GuiControlStyle.cs +++ b/Source/MonoGame.Extended.Gui/GuiControlStyle.cs @@ -9,7 +9,7 @@ namespace MonoGame.Extended.Gui { public class GuiControlStyle : IDictionary { - private Dictionary _previousState; + private Dictionary> _previousStates = new Dictionary>(); public GuiControlStyle(Type targetType) : this(targetType.FullName, targetType) @@ -38,7 +38,7 @@ namespace MonoGame.Extended.Gui public void Apply(GuiControl control) { - _previousState = _setters + _previousStates[control.Id] = _setters .ToDictionary(i => i.Key, i => TargetType.GetRuntimeProperty(i.Key)?.GetValue(control)); ChangePropertyValues(control, _setters); @@ -46,10 +46,10 @@ namespace MonoGame.Extended.Gui public void Revert(GuiControl control) { - if (_previousState != null) - ChangePropertyValues(control, _previousState); + if (_previousStates.ContainsKey(control.Id) && _previousStates[control.Id] != null) + ChangePropertyValues(control, _previousStates[control.Id]); - _previousState = null; + _previousStates[control.Id] = null; } private static void ChangePropertyValues(GuiControl control, Dictionary setters) diff --git a/Source/MonoGame.Extended.Gui/GuiElement.cs b/Source/MonoGame.Extended.Gui/GuiElement.cs index d44dcb1c..ac9045c5 100644 --- a/Source/MonoGame.Extended.Gui/GuiElement.cs +++ b/Source/MonoGame.Extended.Gui/GuiElement.cs @@ -27,7 +27,7 @@ namespace MonoGame.Extended.Gui } private object _bindingContext; - public object BindingContext + public virtual object BindingContext { get { return _bindingContext; } set @@ -74,16 +74,16 @@ namespace MonoGame.Extended.Gui } } - private struct Binding + protected struct Binding { public GuiElement Element; public string ViewProperty; public string ViewModelProperty; } - private static readonly List _bindings = new List(); + protected readonly List _bindings = new List(); - public void SetBinding(string viewProperty, string viewModelProperty) + public virtual void SetBinding(string viewProperty, string viewModelProperty) { _bindings.Add(new Binding { diff --git a/Source/MonoGame.Extended.Gui/GuiScreen.cs b/Source/MonoGame.Extended.Gui/GuiScreen.cs index b45d8e7b..14f477f1 100644 --- a/Source/MonoGame.Extended.Gui/GuiScreen.cs +++ b/Source/MonoGame.Extended.Gui/GuiScreen.cs @@ -9,8 +9,11 @@ using Newtonsoft.Json; namespace MonoGame.Extended.Gui { + public class GuiScreenRoot : GuiControl { } + public class GuiScreen : GuiElement, IDisposable { + private object _bindingContext; public GuiScreen(GuiSkin skin) { Skin = skin; @@ -27,6 +30,20 @@ namespace MonoGame.Extended.Gui [JsonIgnore] public GuiWindowCollection Windows { get; } + [JsonIgnore] + public override object BindingContext + { + get + { + return _bindingContext; + } + set + { + _bindingContext = value; + foreach (var control in Controls) control.BindingContext = _bindingContext; + } + } + public new float Width { get; private set; } public new float Height { get; private set; } public new Size2 Size => new Size2(Width, Height); @@ -94,6 +111,11 @@ namespace MonoGame.Extended.Gui renderer.DrawRectangle(BoundingRectangle, Color.Green); } + public override void SetBinding(string viewProperty, string viewModelProperty) + { + foreach (var control in Controls) control.SetBinding(viewProperty, viewModelProperty); + } + protected virtual void Dispose(bool isDisposing) { if (isDisposing) diff --git a/Source/MonoGame.Extended.Gui/GuiSystem.cs b/Source/MonoGame.Extended.Gui/GuiSystem.cs index 85021895..c6666a38 100644 --- a/Source/MonoGame.Extended.Gui/GuiSystem.cs +++ b/Source/MonoGame.Extended.Gui/GuiSystem.cs @@ -5,6 +5,7 @@ using MonoGame.Extended.Gui.Controls; using MonoGame.Extended.Input.InputListeners; using MonoGame.Extended.ViewportAdapters; using System; +using System.ComponentModel; namespace MonoGame.Extended.Gui { diff --git a/Source/Tests/Sandbox/Content/adventure-gui-button-screen.json b/Source/Tests/Sandbox/Content/adventure-gui-button-screen.json new file mode 100644 index 00000000..a48819f7 --- /dev/null +++ b/Source/Tests/Sandbox/Content/adventure-gui-button-screen.json @@ -0,0 +1,80 @@ +{ + "Skin": "Content/adventure-gui-skin.json", + "Name": "title-screen", + "Controls": [ + { + "Type": "GuiStackPanel", + "Name": "MainPanel", + "Style": "brown-panel-no-size", + "Padding": "20 50 20 10", + "Orientation": "Horizontal", + "Controls": [ + { + "Type": "GuiStackPanel", + "Name": "LogoPanel", + "Controls": [ + { + "Type": "GuiImage", + "Name": "Logo", + "Style": "monogame-title" + }, + { + "Type": "GuiLabel", + "Name": "Label", + "Text": "MonoGame.Extended is an open source collection of NuGet packages for MonoGame. A collection of classes and extensions to make it easier to make games with MonoGame.", + "Width": "500", + "Style": "label" + } + ] + }, + { + "Type": "GuiForm", + "Name": "ButtonPanel", + "Spacing": "10", + "Controls": [ + { + "Type": "GuiButton", + "Name": "Button1", + "Width": "200", + "Text": "Button 1", + "TextColor": "#ffffff", + "Style": "white-disable-button" + }, + { + "Type": "GuiButton", + "Name": "Button2", + "Width": "200", + "Text": "Button 2", + "TextColor": "#ffffff", + "Style": "white-disable-button" + }, + { + "Type": "GuiButton", + "Name": "Button3", + "Width": "200", + "Text": "Button 3", + "TextColor": "#ffffff", + "Style": "white-disable-button" + }, + { + "Type": "GuiButton", + "Name": "Button4", + "Width": "200", + "Text": "Button 4", + "TextColor": "#ffffff", + "Style": "white-disable-button" + }, + { + "Type": "GuiButton", + "Name": "Disable", + "Width": "200", + "Text": "Disable Buttons", + "TextColor": "#ffffff", + "Style": "white-button" + } + ] + } + ] + } + ] +} diff --git a/Source/Tests/Sandbox/Content/adventure-gui-screen.json b/Source/Tests/Sandbox/Content/adventure-gui-screen.json index cf5a77eb..63256494 100644 --- a/Source/Tests/Sandbox/Content/adventure-gui-screen.json +++ b/Source/Tests/Sandbox/Content/adventure-gui-screen.json @@ -20,6 +20,7 @@ }, { "Type": "GuiLabel", + "Name": "Label", "Text": "MonoGame.Extended is an open source collection of NuGet packages for MonoGame. A collection of classes and extensions to make it easier to make games with MonoGame.", "Width": "500", "Style": "label" @@ -29,6 +30,7 @@ { "Type": "GuiForm", "Name": "ButtonPanel", + "Spacing": "10", "Controls": [ { "Type": "GuiListBox", @@ -47,6 +49,7 @@ { "Type": "GuiComboBox", "Name": "ComboBox", + "Text": "Placeholder", "NameProperty": "Name", "Width": "200", "Style": "combo-box" diff --git a/Source/Tests/Sandbox/Content/adventure-gui-skin.json b/Source/Tests/Sandbox/Content/adventure-gui-skin.json index c90072a4..da83d401 100644 --- a/Source/Tests/Sandbox/Content/adventure-gui-skin.json +++ b/Source/Tests/Sandbox/Content/adventure-gui-skin.json @@ -41,6 +41,32 @@ "TextColor": "#ffffffff" } }, + { + "Name": "white-disable-button", + "Type": "GuiButton", + "Margin": "5 2", + "BackgroundRegion": "buttonLong_grey", + "TextOffset": "0 -2", + "TextColor": "#f4a460ff", + "Color": "#8b4513ff", + "HorizontalAlignment": "Center", + "VerticalAlignment": "Centre", + "PressedStyle": { + "Type": "GuiButton", + "BackgroundRegion": "buttonLong_grey_pressed", + "TextOffset": "0 2" + }, + "HoverStyle": { + "Type": "GuiButton", + "Color": "#9E4C16ff", + "TextColor": "#ffffffff" + }, + "DisabledStyle": { + "Type": "GuiButton", + "Color": "#edf3ff", + "TextColor": "#898d93" + } + }, { "Name": "white-submit", "Type": "GuiSubmit", diff --git a/Source/Tests/Sandbox/Experiments/BindingScreen.cs b/Source/Tests/Sandbox/Experiments/BindingScreen.cs index e68be057..0bfe5082 100644 --- a/Source/Tests/Sandbox/Experiments/BindingScreen.cs +++ b/Source/Tests/Sandbox/Experiments/BindingScreen.cs @@ -9,12 +9,13 @@ namespace Sandbox.Experiments : base(skin) { var button = new GuiButton(skin); + button.ClipPadding = new MonoGame.Extended.Thickness(15); Controls.Add(button); button.SetBinding(nameof(GuiButton.Text), nameof(viewModel.Name)); button.Clicked += (sender, args) => { - viewModel.Name = "alliestrasza"; + viewModel.Name = "alliestraszaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; }; BindingContext = viewModel; diff --git a/Source/Tests/Sandbox/Game1.cs b/Source/Tests/Sandbox/Game1.cs index c3c3d716..828e0858 100644 --- a/Source/Tests/Sandbox/Game1.cs +++ b/Source/Tests/Sandbox/Game1.cs @@ -59,6 +59,27 @@ namespace Sandbox Window.AllowUserResizing = true; } + private void LoadGuiButtonScreen() + { + _screen = GuiScreen.FromFile(Content, "Content/adventure-gui-button-screen.json", typeof(MyPanel)); + + var disable = _screen.FindControl("Disable"); + var disabled = false; + disable.Clicked += (sender, e) => + { + disabled = !disabled; + foreach(var selector in new List() { "Button1", "Button2", "Button3", "Button4" }) + { + var item = _screen.FindControl(selector); + if (item != null) + { + item.IsEnabled = !disabled; + } + } + }; + Window.ClientSizeChanged += OnClientSizeChanged; + } + protected override void LoadContent() { IsMouseVisible = false; @@ -71,25 +92,31 @@ namespace Sandbox var viewModel = new ViewModel(); + LoadGuiButtonScreen(); + //_screen = GuiScreen.FromFile(Content, "Content/test-addition-screen.json", typeof(MyPanel)); //Window.ClientSizeChanged += OnClientSizeChanged; - _screen = GuiScreen.FromFile(Content, "Content/adventure-gui-screen.json", typeof(MyPanel)); + //_screen = GuiScreen.FromFile(Content, "Content/adventure-gui-screen.json", typeof(MyPanel)); - var listBox = _screen.FindControl("Listbox"); - listBox.Items.Add(new { Name = "Hello World 1" }); - listBox.Items.Add(new { Name = "Hello World 2" }); - listBox.Items.Add(new { Name = "Hello World 3" }); - listBox.Items.Add(new { Name = "Hello World 4" }); + //var listBox = _screen.FindControl("Listbox"); + //listBox.Items.Add(new { Name = "Hello World 1" }); + //listBox.Items.Add(new { Name = "Hello World 2" }); + //listBox.Items.Add(new { Name = "Hello World 3" }); + //listBox.Items.Add(new { Name = "Hello World 4" }); - var comboBox = _screen.FindControl("ComboBox"); - comboBox.Items.Add(new { Name = "Hello World 1" }); - comboBox.Items.Add(new { Name = "Hello World 2" }); - comboBox.Items.Add(new { Name = "Hello World 3" }); - comboBox.Items.Add(new { Name = "Hello World 4" }); + //var comboBox = _screen.FindControl("ComboBox"); + //comboBox.Items.Add(new { Name = "Hello World 1" }); + //comboBox.Items.Add(new { Name = "Hello World 2" }); + //comboBox.Items.Add(new { Name = "Hello World 3" }); + //comboBox.Items.Add(new { Name = "Hello World 4" }); - var submit = _screen.FindControl("FormSubmit"); - submit.Clicked += OnFormSubmitClicked; + //var submit = _screen.FindControl("FormSubmit"); + //submit.SetBinding(nameof(GuiButton.Text), nameof(viewModel.Name)); + //submit.Clicked += OnFormSubmitClicked; + //submit.Clicked += (s, e) => { viewModel.Name = viewModel.Name == "Change" ? "Alistrasza" : "Change"; }; + + _screen.BindingContext = viewModel; _guiSystem = new GuiSystem(_viewportAdapter, guiRenderer) { diff --git a/Source/Tests/Sandbox/Sandbox.csproj b/Source/Tests/Sandbox/Sandbox.csproj index 385afc0f..7e45ab7b 100644 --- a/Source/Tests/Sandbox/Sandbox.csproj +++ b/Source/Tests/Sandbox/Sandbox.csproj @@ -119,6 +119,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest From 104667b7e2117c4e96f71bc5147ecb6ec38267ef Mon Sep 17 00:00:00 2001 From: Jon Seaman Date: Thu, 28 Dec 2017 05:22:55 -0500 Subject: [PATCH 04/13] Fix template manager (#446) * Fix Demo.SpaceGame aiming and spaceship control * Added ECS to template --- Source/Demos/Demo.SpaceGame/Entities/Spaceship.cs | 8 ++++---- Source/Demos/Demo.SpaceGame/Game1.cs | 4 ++-- Source/Demos/Demo.StarWarrior/packages.config | 1 + .../MonoGame.Extended.Entities/EntityComponentSystem.cs | 1 + 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Source/Demos/Demo.SpaceGame/Entities/Spaceship.cs b/Source/Demos/Demo.SpaceGame/Entities/Spaceship.cs index 2b30fcf0..08bce1b4 100644 --- a/Source/Demos/Demo.SpaceGame/Entities/Spaceship.cs +++ b/Source/Demos/Demo.SpaceGame/Entities/Spaceship.cs @@ -16,7 +16,7 @@ namespace Demo.SpaceGame.Entities private float _fireCooldown; public CircleF BoundingCircle; - public Vector2 Direction => Vector2.UnitX.Rotate(Rotation); + public Vector2 Direction => (-Vector2.UnitX).Rotate(-Rotation); public Vector2 Position { @@ -72,7 +72,7 @@ namespace Demo.SpaceGame.Entities public void LookAt(Vector2 point) { - Rotation = (float)Math.Atan2(point.Y - Position.Y, point.X - Position.X); + Rotation = (float)Math.Atan2(point.Y - Position.Y, Position.X - point.X); } public void Fire() @@ -83,8 +83,8 @@ namespace Demo.SpaceGame.Entities } var angle = Rotation + MathHelper.ToRadians(90); - var muzzle1Position = Position + new Vector2(14, 0).Rotate(angle); - var muzzle2Position = Position + new Vector2(-14, 0).Rotate(angle); + var muzzle1Position = Position + new Vector2(14, 0).Rotate(-angle); + var muzzle2Position = Position + new Vector2(-14, 0).Rotate(-angle); _bulletFactory.Create(muzzle1Position, Direction, angle, 550f); _bulletFactory.Create(muzzle2Position, Direction, angle, 550f); _fireCooldown = 0.2f; diff --git a/Source/Demos/Demo.SpaceGame/Game1.cs b/Source/Demos/Demo.SpaceGame/Game1.cs index afbe3acd..98376511 100644 --- a/Source/Demos/Demo.SpaceGame/Game1.cs +++ b/Source/Demos/Demo.SpaceGame/Game1.cs @@ -108,10 +108,10 @@ namespace Demo.SpaceGame _player.Accelerate(-acceleration); if (keyboardState.IsKeyDown(Keys.A) || keyboardState.IsKeyDown(Keys.Left)) - _player.Rotation -= deltaTime*3f; + _player.Rotation += deltaTime*3f; if (keyboardState.IsKeyDown(Keys.D) || keyboardState.IsKeyDown(Keys.Right)) - _player.Rotation += deltaTime*3f; + _player.Rotation -= deltaTime*3f; if (keyboardState.IsKeyDown(Keys.Space) || mouseState.LeftButton == ButtonState.Pressed) _player.Fire(); diff --git a/Source/Demos/Demo.StarWarrior/packages.config b/Source/Demos/Demo.StarWarrior/packages.config index 9b38dcf7..348c97ac 100644 --- a/Source/Demos/Demo.StarWarrior/packages.config +++ b/Source/Demos/Demo.StarWarrior/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file diff --git a/Source/MonoGame.Extended.Entities/EntityComponentSystem.cs b/Source/MonoGame.Extended.Entities/EntityComponentSystem.cs index c16ebe41..eb26b897 100644 --- a/Source/MonoGame.Extended.Entities/EntityComponentSystem.cs +++ b/Source/MonoGame.Extended.Entities/EntityComponentSystem.cs @@ -170,6 +170,7 @@ namespace MonoGame.Extended.Entities return; var entityTemplate = _dependencyResolver.Resolve(typeInfo.AsType()); + entityTemplate.Manager = this; EntityManager.AddEntityTemplate(entityTemplateAttribute.Name, entityTemplate); } } From cf028ef2a926da31ef7ee310718db7e1f2f38b42 Mon Sep 17 00:00:00 2001 From: Jon Seaman Date: Thu, 28 Dec 2017 05:26:06 -0500 Subject: [PATCH 05/13] Fix Demo.SpaceGame aiming and spaceship control (#444) From eb5fd93e9f83e7e963aa1d067ceb46c93d8ab581 Mon Sep 17 00:00:00 2001 From: Jon Seaman Date: Tue, 9 Jan 2018 22:36:20 -0500 Subject: [PATCH 06/13] Feature label styling (#454) * Added some basic tests for the ECS * Add test project for Nuclex Gui * Nuclex Gui project update * Added ability to style labels * Removed Nuclex Gui Test project for lack of tests --- .../Demos/Demo.NuclexGui/Content/Content.mgcb | 28 +++++++ .../Content/Fonts/Heading1.spritefont | 60 ++++++++++++++ .../Content/Fonts/Heading2.spritefont | 60 ++++++++++++++ .../Content/Fonts/Heading3.spritefont | 60 ++++++++++++++ .../Content/Fonts/Title.spritefont | 60 ++++++++++++++ .../Demo.NuclexGui/Demo.NuclexGui.csproj | 6 +- Source/Demos/Demo.NuclexGui/Game1.cs | 80 ++++++++++++++++++- .../Controls/GuiLabelControl.cs | 13 +++ .../Resources/Skins/SuaveSkin.json | 64 +++++++++++++++ .../Renderers/FlatLabelControlRenderer.cs | 8 +- Source/MonoGame.Extended.sln | 16 +++- .../EntityTemplateTests.cs | 54 +++++++++++++ .../Implementation/EntityComponentBasic.cs | 10 +++ .../Implementation/EntityTemplateBasic.cs | 15 ++++ .../EntityTemplateUsingManager.cs | 16 ++++ .../Implementation/README.md | 5 ++ .../MonoGame.Extended.Entities.Tests.csproj | 79 ++++++++++++++++++ .../Properties/AssemblyInfo.cs | 36 +++++++++ .../packages.config | 6 ++ 19 files changed, 671 insertions(+), 5 deletions(-) create mode 100644 Source/Demos/Demo.NuclexGui/Content/Fonts/Heading1.spritefont create mode 100644 Source/Demos/Demo.NuclexGui/Content/Fonts/Heading2.spritefont create mode 100644 Source/Demos/Demo.NuclexGui/Content/Fonts/Heading3.spritefont create mode 100644 Source/Demos/Demo.NuclexGui/Content/Fonts/Title.spritefont create mode 100644 Source/Tests/MonoGame.Extended.Entities.Tests/EntityTemplateTests.cs create mode 100644 Source/Tests/MonoGame.Extended.Entities.Tests/Implementation/EntityComponentBasic.cs create mode 100644 Source/Tests/MonoGame.Extended.Entities.Tests/Implementation/EntityTemplateBasic.cs create mode 100644 Source/Tests/MonoGame.Extended.Entities.Tests/Implementation/EntityTemplateUsingManager.cs create mode 100644 Source/Tests/MonoGame.Extended.Entities.Tests/Implementation/README.md create mode 100644 Source/Tests/MonoGame.Extended.Entities.Tests/MonoGame.Extended.Entities.Tests.csproj create mode 100644 Source/Tests/MonoGame.Extended.Entities.Tests/Properties/AssemblyInfo.cs create mode 100644 Source/Tests/MonoGame.Extended.Entities.Tests/packages.config diff --git a/Source/Demos/Demo.NuclexGui/Content/Content.mgcb b/Source/Demos/Demo.NuclexGui/Content/Content.mgcb index 7daae778..366e1d4e 100644 --- a/Source/Demos/Demo.NuclexGui/Content/Content.mgcb +++ b/Source/Demos/Demo.NuclexGui/Content/Content.mgcb @@ -52,3 +52,31 @@ /processorParam:TextureFormat=Compressed /build:TitleFont.spritefont +#begin Fonts/Heading1.spritefont +/importer:FontDescriptionImporter +/processor:FontDescriptionProcessor +/processorParam:PremultiplyAlpha=True +/processorParam:TextureFormat=Compressed +/build:Fonts/Heading1.spritefont + +#begin Fonts/Heading2.spritefont +/importer:FontDescriptionImporter +/processor:FontDescriptionProcessor +/processorParam:PremultiplyAlpha=True +/processorParam:TextureFormat=Compressed +/build:Fonts/Heading2.spritefont + +#begin Fonts/Heading3.spritefont +/importer:FontDescriptionImporter +/processor:FontDescriptionProcessor +/processorParam:PremultiplyAlpha=True +/processorParam:TextureFormat=Compressed +/build:Fonts/Heading3.spritefont + +#begin Fonts/Title.spritefont +/importer:FontDescriptionImporter +/processor:FontDescriptionProcessor +/processorParam:PremultiplyAlpha=True +/processorParam:TextureFormat=Compressed +/build:Fonts/Title.spritefont + diff --git a/Source/Demos/Demo.NuclexGui/Content/Fonts/Heading1.spritefont b/Source/Demos/Demo.NuclexGui/Content/Fonts/Heading1.spritefont new file mode 100644 index 00000000..5b854bd9 --- /dev/null +++ b/Source/Demos/Demo.NuclexGui/Content/Fonts/Heading1.spritefont @@ -0,0 +1,60 @@ + + + + + + + Corbel + + + 16 + + + 0 + + + true + + + + + + ? + + + + + + ~ + + + + diff --git a/Source/Demos/Demo.NuclexGui/Content/Fonts/Heading2.spritefont b/Source/Demos/Demo.NuclexGui/Content/Fonts/Heading2.spritefont new file mode 100644 index 00000000..562b8eaf --- /dev/null +++ b/Source/Demos/Demo.NuclexGui/Content/Fonts/Heading2.spritefont @@ -0,0 +1,60 @@ + + + + + + + Corbel + + + 13 + + + 0 + + + true + + + + + + ? + + + + + + ~ + + + + diff --git a/Source/Demos/Demo.NuclexGui/Content/Fonts/Heading3.spritefont b/Source/Demos/Demo.NuclexGui/Content/Fonts/Heading3.spritefont new file mode 100644 index 00000000..df6b506a --- /dev/null +++ b/Source/Demos/Demo.NuclexGui/Content/Fonts/Heading3.spritefont @@ -0,0 +1,60 @@ + + + + + + + Corbel + + + 12 + + + 0 + + + true + + + + + + ? + + + + + + ~ + + + + diff --git a/Source/Demos/Demo.NuclexGui/Content/Fonts/Title.spritefont b/Source/Demos/Demo.NuclexGui/Content/Fonts/Title.spritefont new file mode 100644 index 00000000..b9289591 --- /dev/null +++ b/Source/Demos/Demo.NuclexGui/Content/Fonts/Title.spritefont @@ -0,0 +1,60 @@ + + + + + + + Corbel + + + 28 + + + 0 + + + true + + + + + + ? + + + + + + ~ + + + + diff --git a/Source/Demos/Demo.NuclexGui/Demo.NuclexGui.csproj b/Source/Demos/Demo.NuclexGui/Demo.NuclexGui.csproj index 9e884695..428e7e0b 100644 --- a/Source/Demos/Demo.NuclexGui/Demo.NuclexGui.csproj +++ b/Source/Demos/Demo.NuclexGui/Demo.NuclexGui.csproj @@ -95,6 +95,10 @@ + + + + @@ -132,4 +136,4 @@ --> - + \ No newline at end of file diff --git a/Source/Demos/Demo.NuclexGui/Game1.cs b/Source/Demos/Demo.NuclexGui/Game1.cs index db0c8428..d13fbf67 100644 --- a/Source/Demos/Demo.NuclexGui/Game1.cs +++ b/Source/Demos/Demo.NuclexGui/Game1.cs @@ -1,4 +1,5 @@ -using System.Linq; +using System; +using System.Linq; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; @@ -7,6 +8,7 @@ using MonoGame.Extended.Input.InputListeners; using MonoGame.Extended.Sprites; using MonoGame.Extended.ViewportAdapters; using MonoGame.Extended.NuclexGui; +using MonoGame.Extended.NuclexGui.Controls; using MonoGame.Extended.NuclexGui.Controls.Desktop; namespace Demo.NuclexGui @@ -65,14 +67,90 @@ namespace Demo.NuclexGui Bounds = new UniRectangle(new UniScalar(20), new UniScalar(80), new UniScalar(120), new UniScalar(50)), Text = "Open Window" }; + var button3 = new GuiButtonControl() + { + Name = "button3", + Bounds = new UniRectangle(new UniScalar(20), new UniScalar(140), new UniScalar(120), new UniScalar(50)), + Text = "Show Labels", + }; // Attach relevant events button.Pressed += Button_Pressed; button2.Pressed += Button2_Pressed; + button3.Pressed += Button3_Pressed; // And finally, attach controls to the parent control. In this case, desktop screen. _gui.Screen.Desktop.Children.Add(button); _gui.Screen.Desktop.Children.Add(button2); + _gui.Screen.Desktop.Children.Add(button3); + } + + private void Button3_Pressed(object sender, EventArgs e) + { + if (_gui.Screen.Desktop.Children.Any(i => i.Name == "window")) + return; + + var window = new GuiWindowControl + { + Name = "window", + Bounds = new UniRectangle(new UniVector(new UniScalar(0.5f, -100), new UniScalar(0.5f, -60)), new UniVector(new UniScalar(200), new UniScalar(160))), + Title = "Labels with Styles", + EnableDragging = true + }; + + var labelTitle = new GuiLabelControl + { + Name = "label-title", + Bounds = new UniRectangle(new UniScalar(10), new UniScalar(45), new UniScalar(10), new UniScalar(10)), + Text = "Title", + Style = "label-title" + }; + var label1 = new GuiLabelControl + { + Name = "label1", + Bounds = new UniRectangle(new UniScalar(0.0f, 10), new UniScalar(0.0f, 70), new UniScalar(10), new UniScalar(10)), + Text = "Heading 1", + Style = "label-h1", + }; + var label2 = new GuiLabelControl + { + Name = "label2", + Bounds = new UniRectangle(new UniScalar(0.0f, 10), new UniScalar(0.0f, 90), new UniScalar(10), new UniScalar(10)), + Text = "Heading 2", + Style = "label-h2", + }; + var label3 = new GuiLabelControl + { + Name = "label3", + Bounds = new UniRectangle(new UniScalar(0.0f, 10), new UniScalar(0.0f, 105), new UniScalar(10), new UniScalar(10)), + Text = "Heading 3", + Style = "label-h3" + }; + + var button1 = new GuiButtonControl + { + Name = "confirm", + Bounds = new UniRectangle(new UniScalar(0.0f, 10), new UniScalar(1.0f, -40), new UniScalar(0f, 80), new UniScalar(0f, 30)), + Text = "Confirm" + }; + var button2 = new GuiButtonControl + { + Name = "cancel", + Bounds = new UniRectangle(new UniScalar(1.0f, -90), new UniScalar(1.0f, -40), new UniScalar(0f, 80), new UniScalar(0f, 30)), + Text = "Cancel" + }; + + button1.Pressed += DialogueConfirm_Pressed; + button2.Pressed += DialogueCancel_Pressed; + + window.Children.Add(labelTitle); + window.Children.Add(label1); + window.Children.Add(label2); + window.Children.Add(label3); + window.Children.Add(button1); + window.Children.Add(button2); + + _gui.Screen.Desktop.Children.Add(window); } private void Button2_Pressed(object sender, System.EventArgs e) diff --git a/Source/MonoGame.Extended.NuclexGui/Controls/GuiLabelControl.cs b/Source/MonoGame.Extended.NuclexGui/Controls/GuiLabelControl.cs index eb67ff61..d287e493 100644 --- a/Source/MonoGame.Extended.NuclexGui/Controls/GuiLabelControl.cs +++ b/Source/MonoGame.Extended.NuclexGui/Controls/GuiLabelControl.cs @@ -6,6 +6,19 @@ /// Text to be rendered in the control's frame public string Text; + /// + /// Gets or sets the style to be used with this label when drawing. + /// + /// + /// + /// If you are using the FlatGuiVisualizer, this style + /// corresponds to the 'Frames' used in + /// + /// The style can be customized in the skin's json file. + /// + /// + public string Style { get; set; } + /// Initializes a new label control with an empty string public GuiLabelControl() : this(string.Empty) { diff --git a/Source/MonoGame.Extended.NuclexGui/Resources/Skins/SuaveSkin.json b/Source/MonoGame.Extended.NuclexGui/Resources/Skins/SuaveSkin.json index c3936ce4..47ef2f87 100644 --- a/Source/MonoGame.Extended.NuclexGui/Resources/Skins/SuaveSkin.json +++ b/Source/MonoGame.Extended.NuclexGui/Resources/Skins/SuaveSkin.json @@ -9,6 +9,22 @@ { "name": "default", "contentPath": "DefaultFont" + }, + { + "name": "heading1", + "contentPath": "Fonts/Heading1" + }, + { + "name": "heading2", + "contentPath": "Fonts/Heading2" + }, + { + "name": "heading3", + "contentPath": "Fonts/Heading3" + }, + { + "name": "label-title", + "contentPath": "Fonts/Title" } ], "bitmap": [ @@ -133,6 +149,54 @@ } ] }, + { + "name": "label-h1", + "text": [ + { + "font": "heading1", + "hplacement": "left", + "vplacement": "center", + "yoffset": 0, + "color": "#3F3F3F" + } + ] + }, + { + "name": "label-h2", + "text": [ + { + "font": "heading2", + "hplacement": "left", + "vplacement": "center", + "yoffset": 0, + "color": "#3F3F3F" + } + ] + }, + { + "name": "label-h3", + "text": [ + { + "font": "heading3", + "hplacement": "left", + "vplacement": "center", + "yoffset": 0, + "color": "#3F3F3F" + } + ] + }, + { + "name": "label-title", + "text": [ + { + "font": "label-title", + "hplacement": "left", + "vplacement": "center", + "yoffset": 0, + "color": "#3F3F3F" + } + ] + }, { "name": "progress", "region": [ diff --git a/Source/MonoGame.Extended.NuclexGui/Visuals/Flat/Renderers/FlatLabelControlRenderer.cs b/Source/MonoGame.Extended.NuclexGui/Visuals/Flat/Renderers/FlatLabelControlRenderer.cs index 22042376..9e99f4bc 100644 --- a/Source/MonoGame.Extended.NuclexGui/Visuals/Flat/Renderers/FlatLabelControlRenderer.cs +++ b/Source/MonoGame.Extended.NuclexGui/Visuals/Flat/Renderers/FlatLabelControlRenderer.cs @@ -1,4 +1,5 @@ -using MonoGame.Extended.NuclexGui.Controls; +using System; +using MonoGame.Extended.NuclexGui.Controls; namespace MonoGame.Extended.NuclexGui.Visuals.Flat.Renderers { @@ -14,7 +15,10 @@ namespace MonoGame.Extended.NuclexGui.Visuals.Flat.Renderers /// public void Render(GuiLabelControl control, IFlatGuiGraphics graphics) { - graphics.DrawString("label", control.GetAbsoluteBounds(), control.Text); + var frameName = "label"; + if (control.Style != null) frameName = control.Style; + + graphics.DrawString(frameName, control.GetAbsoluteBounds(), control.Text); } } } \ No newline at end of file diff --git a/Source/MonoGame.Extended.sln b/Source/MonoGame.Extended.sln index 04670910..94e65d6e 100644 --- a/Source/MonoGame.Extended.sln +++ b/Source/MonoGame.Extended.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.12 +VisualStudioVersion = 15.0.27130.2010 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGame.Extended", "MonoGame.Extended\MonoGame.Extended.csproj", "{41724C52-3D50-45BB-81EB-3C8A247EAFD1}" EndProject @@ -107,6 +107,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sandbox", "Tests\Sandbox\Sa {28CD24BD-432C-4987-9E9D-65CFCF120EA0} = {28CD24BD-432C-4987-9E9D-65CFCF120EA0} EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGame.Extended.Entities.Tests", "Tests\MonoGame.Extended.Entities.Tests\MonoGame.Extended.Entities.Tests.csproj", "{5B993DD9-A9B8-434C-B444-F1CFFB947F79}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -323,6 +325,14 @@ Global {9A920A4D-3794-4AB4-9A76-3C19407A1C5F}.Release|Any CPU.Build.0 = Release|Any CPU {9A920A4D-3794-4AB4-9A76-3C19407A1C5F}.Release|x86.ActiveCfg = Release|Any CPU {9A920A4D-3794-4AB4-9A76-3C19407A1C5F}.Release|x86.Build.0 = Release|Any CPU + {5B993DD9-A9B8-434C-B444-F1CFFB947F79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5B993DD9-A9B8-434C-B444-F1CFFB947F79}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5B993DD9-A9B8-434C-B444-F1CFFB947F79}.Debug|x86.ActiveCfg = Debug|Any CPU + {5B993DD9-A9B8-434C-B444-F1CFFB947F79}.Debug|x86.Build.0 = Debug|Any CPU + {5B993DD9-A9B8-434C-B444-F1CFFB947F79}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5B993DD9-A9B8-434C-B444-F1CFFB947F79}.Release|Any CPU.Build.0 = Release|Any CPU + {5B993DD9-A9B8-434C-B444-F1CFFB947F79}.Release|x86.ActiveCfg = Release|Any CPU + {5B993DD9-A9B8-434C-B444-F1CFFB947F79}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -342,5 +352,9 @@ Global {57C47653-BC51-43BA-98F4-1D0EEE78782D} = {932F8931-4A8D-4205-BFCF-98E794207786} {BDAEDFAF-2EDA-4BCA-9675-3625456FAB78} = {932F8931-4A8D-4205-BFCF-98E794207786} {9A920A4D-3794-4AB4-9A76-3C19407A1C5F} = {E5A148A1-DE7B-4D17-ABE8-831B9673B863} + {5B993DD9-A9B8-434C-B444-F1CFFB947F79} = {E5A148A1-DE7B-4D17-ABE8-831B9673B863} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8ED5A62D-25EC-4331-9F99-BDD1E10C02A0} EndGlobalSection EndGlobal diff --git a/Source/Tests/MonoGame.Extended.Entities.Tests/EntityTemplateTests.cs b/Source/Tests/MonoGame.Extended.Entities.Tests/EntityTemplateTests.cs new file mode 100644 index 00000000..9d49b2e8 --- /dev/null +++ b/Source/Tests/MonoGame.Extended.Entities.Tests/EntityTemplateTests.cs @@ -0,0 +1,54 @@ +using System; +using Microsoft.Xna.Framework; +using MonoGame.Extended.Entities; +using MonoGame.Extended.Gui.Tests.Implementation; +using NUnit.Framework; + +namespace MonoGame.Extended.Gui.Tests +{ + [TestFixture] + public class EntityTemplateTests + { + [Test] + public void ECS_CreateEntityFromTemplate_Basic_Test() + { + // Seems to work with null. + var ecs = new EntityComponentSystem(null); + ecs.Scan(typeof(EntityTemplateBasic).Assembly); + var manager = ecs.EntityManager; + Entity entity = null; + try + { + entity = manager.CreateEntityFromTemplate(EntityTemplateBasic.Name); + } + catch (Exception e) + { + Assert.Fail("Failed to create entity from template.\n" + e.StackTrace); + } + + Assert.NotNull(entity); + Assert.NotNull(entity.Get()); + } + + [Test] + public void ECS_CreateEntityFromTemplate_UsingManager_Test() + { + // Seems to work with null. + var ecs = new EntityComponentSystem(null); + ecs.Scan(typeof(EntityTemplateUsingManager).Assembly); + var manager = ecs.EntityManager; + Entity entity = null; + try + { + entity = manager.CreateEntityFromTemplate(EntityTemplateUsingManager.Name); + } + catch (Exception e) + { + Assert.Fail("Failed to create entity from template.\n" + e.StackTrace); + } + + Assert.NotNull(entity); + Assert.NotNull(entity.Get()); + } + } +} \ No newline at end of file diff --git a/Source/Tests/MonoGame.Extended.Entities.Tests/Implementation/EntityComponentBasic.cs b/Source/Tests/MonoGame.Extended.Entities.Tests/Implementation/EntityComponentBasic.cs new file mode 100644 index 00000000..3161781c --- /dev/null +++ b/Source/Tests/MonoGame.Extended.Entities.Tests/Implementation/EntityComponentBasic.cs @@ -0,0 +1,10 @@ +using MonoGame.Extended.Entities; + +namespace MonoGame.Extended.Gui.Tests.Implementation +{ + [EntityComponent] + public class EntityComponentBasic : TransformComponent2D + { + public int Number { get; set; } + } +} \ No newline at end of file diff --git a/Source/Tests/MonoGame.Extended.Entities.Tests/Implementation/EntityTemplateBasic.cs b/Source/Tests/MonoGame.Extended.Entities.Tests/Implementation/EntityTemplateBasic.cs new file mode 100644 index 00000000..a4d7bfe6 --- /dev/null +++ b/Source/Tests/MonoGame.Extended.Entities.Tests/Implementation/EntityTemplateBasic.cs @@ -0,0 +1,15 @@ +using MonoGame.Extended.Entities; + +namespace MonoGame.Extended.Gui.Tests.Implementation +{ + [EntityTemplate(Name)] + public class EntityTemplateBasic : EntityTemplate + { + public const string Name = nameof(EntityTemplateBasic); + + protected override void Build(Entity entity) + { + entity.Attach(); + } + } +} \ No newline at end of file diff --git a/Source/Tests/MonoGame.Extended.Entities.Tests/Implementation/EntityTemplateUsingManager.cs b/Source/Tests/MonoGame.Extended.Entities.Tests/Implementation/EntityTemplateUsingManager.cs new file mode 100644 index 00000000..260345e1 --- /dev/null +++ b/Source/Tests/MonoGame.Extended.Entities.Tests/Implementation/EntityTemplateUsingManager.cs @@ -0,0 +1,16 @@ +using MonoGame.Extended.Entities; + +namespace MonoGame.Extended.Gui.Tests.Implementation +{ + [EntityTemplate(Name)] + public class EntityTemplateUsingManager : EntityTemplate + { + public const string Name = nameof(EntityTemplateUsingManager); + + protected override void Build(Entity entity) + { + var num = Manager.EntityManager.TotalEntitiesCount; + entity.Attach(c => c.Number = num); + } + } +} \ No newline at end of file diff --git a/Source/Tests/MonoGame.Extended.Entities.Tests/Implementation/README.md b/Source/Tests/MonoGame.Extended.Entities.Tests/Implementation/README.md new file mode 100644 index 00000000..d5356ff1 --- /dev/null +++ b/Source/Tests/MonoGame.Extended.Entities.Tests/Implementation/README.md @@ -0,0 +1,5 @@ + +# Implementation + +This folder is for making a testable implementation using the ECS library. +This implementation is used in the unit tests in this project. \ No newline at end of file diff --git a/Source/Tests/MonoGame.Extended.Entities.Tests/MonoGame.Extended.Entities.Tests.csproj b/Source/Tests/MonoGame.Extended.Entities.Tests/MonoGame.Extended.Entities.Tests.csproj new file mode 100644 index 00000000..b0e1f265 --- /dev/null +++ b/Source/Tests/MonoGame.Extended.Entities.Tests/MonoGame.Extended.Entities.Tests.csproj @@ -0,0 +1,79 @@ + + + + + Debug + AnyCPU + {5B993DD9-A9B8-434C-B444-F1CFFB947F79} + Library + Properties + MonoGame.Extended.Gui.Tests + MonoGame.Extended.Gui.Tests + v4.5.2 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\packages\MonoGame.Framework.WindowsDX.3.6.0.1625\lib\net40\MonoGame.Framework.dll + True + + + ..\..\packages\NSubstitute.1.10.0.0\lib\net45\NSubstitute.dll + True + + + ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll + True + + + + + + + + + + + + + + + + + + + + + + + + {35fd1f05-af04-469a-b37a-f9b36c34401c} + MonoGame.Extended.Entities + + + + + \ No newline at end of file diff --git a/Source/Tests/MonoGame.Extended.Entities.Tests/Properties/AssemblyInfo.cs b/Source/Tests/MonoGame.Extended.Entities.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..07a0c3c0 --- /dev/null +++ b/Source/Tests/MonoGame.Extended.Entities.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("MonoGame.Extended.Entities.Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("MonoGame.Extended.Entities.Tests")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("EFE3C251-67A7-4BBF-A4B8-A7659F460920")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Source/Tests/MonoGame.Extended.Entities.Tests/packages.config b/Source/Tests/MonoGame.Extended.Entities.Tests/packages.config new file mode 100644 index 00000000..fa95cfc0 --- /dev/null +++ b/Source/Tests/MonoGame.Extended.Entities.Tests/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From 46895cf600a60fd08c3d3c488fe9a455fbf8482f Mon Sep 17 00:00:00 2001 From: Michael Delz Date: Sun, 21 Jan 2018 06:03:24 +0100 Subject: [PATCH 07/13] fixed swapped power values in EasingFunctions issue 456 (#457) --- Source/MonoGame.Extended.Tweening/EasingFunctions.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/MonoGame.Extended.Tweening/EasingFunctions.cs b/Source/MonoGame.Extended.Tweening/EasingFunctions.cs index 2eee1a5b..5827a57c 100644 --- a/Source/MonoGame.Extended.Tweening/EasingFunctions.cs +++ b/Source/MonoGame.Extended.Tweening/EasingFunctions.cs @@ -9,13 +9,13 @@ namespace MonoGame.Extended.Tweening { public static float Linear(float value) => value; - public static float CubicEaseIn(float value) => Power.EaseIn(value, 2); - public static float CubicEaseOut(float value) => Power.EaseOut(value, 2); - public static float CubicEaseInOut(float value) => Power.EaseInOut(value, 2); + public static float CubicEaseIn(float value) => Power.EaseIn(value, 3); + public static float CubicEaseOut(float value) => Power.EaseOut(value, 3); + public static float CubicEaseInOut(float value) => Power.EaseInOut(value, 3); - public static float QuadraticEaseIn(float value) => Power.EaseIn(value, 3); - public static float QuadraticEaseOut(float value) => Power.EaseOut(value, 3); - public static float QuadraticEaseInOut(float value) => Power.EaseInOut(value, 3); + public static float QuadraticEaseIn(float value) => Power.EaseIn(value, 2); + public static float QuadraticEaseOut(float value) => Power.EaseOut(value, 2); + public static float QuadraticEaseInOut(float value) => Power.EaseInOut(value, 2); public static float QuarticEaseIn(float value) => Power.EaseIn(value, 4); public static float QuarticEaseOut(float value) => Power.EaseOut(value, 4); From 5470a52e05f75fded033294a9597daaf1d278b75 Mon Sep 17 00:00:00 2001 From: Jon Seaman Date: Thu, 1 Feb 2018 05:14:59 -0500 Subject: [PATCH 08/13] Added XML docs to NuGet (#460) --- .../MonoGame.Extended.Animations.csproj | 2 ++ .../MonoGame.Extended.Collisions.csproj | 2 ++ .../MonoGame.Extended.Content.Pipeline.csproj | 2 ++ .../MonoGame.Extended.Entities.csproj | 2 ++ .../MonoGame.Extended.Graphics.csproj | 2 ++ Source/MonoGame.Extended.Gui/MonoGame.Extended.Gui.csproj | 2 ++ Source/MonoGame.Extended.Input/MonoGame.Extended.Input.csproj | 2 ++ .../MonoGame.Extended.NuclexGui.csproj | 2 ++ .../MonoGame.Extended.Particles.csproj | 2 ++ .../MonoGame.Extended.SceneGraphs.csproj | 2 ++ Source/MonoGame.Extended.Tiled/MonoGame.Extended.Tiled.csproj | 2 ++ .../MonoGame.Extended.Tweening.csproj | 2 ++ Source/MonoGame.Extended/MonoGame.Extended.csproj | 2 ++ Source/NuGet/MonoGame.Extended.Animations.nuspec | 1 + Source/NuGet/MonoGame.Extended.Entities.nuspec | 1 + Source/NuGet/MonoGame.Extended.Graphics.nuspec | 1 + Source/NuGet/MonoGame.Extended.Gui.nuspec | 1 + Source/NuGet/MonoGame.Extended.Input.nuspec | 1 + Source/NuGet/MonoGame.Extended.NuclexGui.nuspec | 1 + Source/NuGet/MonoGame.Extended.Particles.nuspec | 1 + Source/NuGet/MonoGame.Extended.SceneGraphs.nuspec | 1 + Source/NuGet/MonoGame.Extended.Tiled.nuspec | 1 + Source/NuGet/MonoGame.Extended.Tweening.nuspec | 1 + Source/NuGet/MonoGame.Extended.nuspec | 1 + 24 files changed, 37 insertions(+) diff --git a/Source/MonoGame.Extended.Animations/MonoGame.Extended.Animations.csproj b/Source/MonoGame.Extended.Animations/MonoGame.Extended.Animations.csproj index fcd345da..d7930cdf 100644 --- a/Source/MonoGame.Extended.Animations/MonoGame.Extended.Animations.csproj +++ b/Source/MonoGame.Extended.Animations/MonoGame.Extended.Animations.csproj @@ -24,6 +24,7 @@ prompt 4 6 + bin\Debug\MonoGame.Extended.Animations.XML pdbonly @@ -32,6 +33,7 @@ TRACE prompt 4 + bin\Release\MonoGame.Extended.Animations.XML diff --git a/Source/MonoGame.Extended.Collisions/MonoGame.Extended.Collisions.csproj b/Source/MonoGame.Extended.Collisions/MonoGame.Extended.Collisions.csproj index 4e03c217..5cb93752 100644 --- a/Source/MonoGame.Extended.Collisions/MonoGame.Extended.Collisions.csproj +++ b/Source/MonoGame.Extended.Collisions/MonoGame.Extended.Collisions.csproj @@ -25,6 +25,7 @@ prompt 4 6 + bin\Debug\MonoGame.Extended.Collisions.XML pdbonly @@ -33,6 +34,7 @@ TRACE prompt 4 + bin\Release\MonoGame.Extended.Collisions.XML diff --git a/Source/MonoGame.Extended.Content.Pipeline/MonoGame.Extended.Content.Pipeline.csproj b/Source/MonoGame.Extended.Content.Pipeline/MonoGame.Extended.Content.Pipeline.csproj index b22bc4e5..0989c39b 100644 --- a/Source/MonoGame.Extended.Content.Pipeline/MonoGame.Extended.Content.Pipeline.csproj +++ b/Source/MonoGame.Extended.Content.Pipeline/MonoGame.Extended.Content.Pipeline.csproj @@ -23,6 +23,7 @@ 4 true 6 + bin\MonoGame.Extended.Content.Pipeline.xml pdbonly @@ -31,6 +32,7 @@ TRACE prompt 4 + bin\MonoGame.Extended.Content.Pipeline.xml diff --git a/Source/MonoGame.Extended.Entities/MonoGame.Extended.Entities.csproj b/Source/MonoGame.Extended.Entities/MonoGame.Extended.Entities.csproj index 971d00c9..635f3595 100644 --- a/Source/MonoGame.Extended.Entities/MonoGame.Extended.Entities.csproj +++ b/Source/MonoGame.Extended.Entities/MonoGame.Extended.Entities.csproj @@ -24,6 +24,7 @@ prompt 4 6 + bin\Debug\MonoGame.Extended.Entities.XML pdbonly @@ -32,6 +33,7 @@ TRACE prompt 4 + bin\Release\MonoGame.Extended.Entities.XML diff --git a/Source/MonoGame.Extended.Graphics/MonoGame.Extended.Graphics.csproj b/Source/MonoGame.Extended.Graphics/MonoGame.Extended.Graphics.csproj index 94c448fb..15f50280 100644 --- a/Source/MonoGame.Extended.Graphics/MonoGame.Extended.Graphics.csproj +++ b/Source/MonoGame.Extended.Graphics/MonoGame.Extended.Graphics.csproj @@ -26,6 +26,7 @@ 4 true 6 + bin\Debug\MonoGame.Extended.Graphics.XML pdbonly @@ -35,6 +36,7 @@ prompt 4 true + bin\Release\MonoGame.Extended.Graphics.XML diff --git a/Source/MonoGame.Extended.Gui/MonoGame.Extended.Gui.csproj b/Source/MonoGame.Extended.Gui/MonoGame.Extended.Gui.csproj index da111049..c2104557 100644 --- a/Source/MonoGame.Extended.Gui/MonoGame.Extended.Gui.csproj +++ b/Source/MonoGame.Extended.Gui/MonoGame.Extended.Gui.csproj @@ -25,6 +25,7 @@ prompt 4 6 + bin\Debug\MonoGame.Extended.Gui.XML pdbonly @@ -33,6 +34,7 @@ TRACE prompt 4 + bin\Release\MonoGame.Extended.Gui.XML diff --git a/Source/MonoGame.Extended.Input/MonoGame.Extended.Input.csproj b/Source/MonoGame.Extended.Input/MonoGame.Extended.Input.csproj index 62e5db79..f735933a 100644 --- a/Source/MonoGame.Extended.Input/MonoGame.Extended.Input.csproj +++ b/Source/MonoGame.Extended.Input/MonoGame.Extended.Input.csproj @@ -23,6 +23,7 @@ DEBUG;TRACE prompt 4 + bin\Debug\MonoGame.Extended.Input.XML pdbonly @@ -31,6 +32,7 @@ TRACE prompt 4 + bin\Release\MonoGame.Extended.Input.XML diff --git a/Source/MonoGame.Extended.NuclexGui/MonoGame.Extended.NuclexGui.csproj b/Source/MonoGame.Extended.NuclexGui/MonoGame.Extended.NuclexGui.csproj index 17e5a69d..9192d566 100644 --- a/Source/MonoGame.Extended.NuclexGui/MonoGame.Extended.NuclexGui.csproj +++ b/Source/MonoGame.Extended.NuclexGui/MonoGame.Extended.NuclexGui.csproj @@ -24,6 +24,7 @@ prompt 4 6 + bin\Debug\MonoGame.Extended.NuclexGui.XML pdbonly @@ -32,6 +33,7 @@ TRACE prompt 4 + bin\Release\MonoGame.Extended.NuclexGui.XML diff --git a/Source/MonoGame.Extended.Particles/MonoGame.Extended.Particles.csproj b/Source/MonoGame.Extended.Particles/MonoGame.Extended.Particles.csproj index 33b6e3a4..ec0b3cfd 100644 --- a/Source/MonoGame.Extended.Particles/MonoGame.Extended.Particles.csproj +++ b/Source/MonoGame.Extended.Particles/MonoGame.Extended.Particles.csproj @@ -25,6 +25,7 @@ 4 6 true + bin\Debug\MonoGame.Extended.Particles.XML pdbonly @@ -34,6 +35,7 @@ prompt 4 true + bin\Release\MonoGame.Extended.Particles.XML diff --git a/Source/MonoGame.Extended.SceneGraphs/MonoGame.Extended.SceneGraphs.csproj b/Source/MonoGame.Extended.SceneGraphs/MonoGame.Extended.SceneGraphs.csproj index 6a45fd79..c3a81093 100644 --- a/Source/MonoGame.Extended.SceneGraphs/MonoGame.Extended.SceneGraphs.csproj +++ b/Source/MonoGame.Extended.SceneGraphs/MonoGame.Extended.SceneGraphs.csproj @@ -23,6 +23,7 @@ DEBUG;TRACE prompt 4 + bin\Debug\MonoGame.Extended.SceneGraphs.XML pdbonly @@ -31,6 +32,7 @@ TRACE prompt 4 + bin\Release\MonoGame.Extended.SceneGraphs.XML diff --git a/Source/MonoGame.Extended.Tiled/MonoGame.Extended.Tiled.csproj b/Source/MonoGame.Extended.Tiled/MonoGame.Extended.Tiled.csproj index 2ae5acca..9f14c91c 100644 --- a/Source/MonoGame.Extended.Tiled/MonoGame.Extended.Tiled.csproj +++ b/Source/MonoGame.Extended.Tiled/MonoGame.Extended.Tiled.csproj @@ -26,6 +26,7 @@ 4 true 6 + bin\Debug\MonoGame.Extended.Tiled.XML pdbonly @@ -35,6 +36,7 @@ prompt 4 true + bin\Release\MonoGame.Extended.Tiled.XML diff --git a/Source/MonoGame.Extended.Tweening/MonoGame.Extended.Tweening.csproj b/Source/MonoGame.Extended.Tweening/MonoGame.Extended.Tweening.csproj index e6012fb9..166aeff4 100644 --- a/Source/MonoGame.Extended.Tweening/MonoGame.Extended.Tweening.csproj +++ b/Source/MonoGame.Extended.Tweening/MonoGame.Extended.Tweening.csproj @@ -23,6 +23,7 @@ DEBUG;TRACE prompt 4 + bin\Debug\MonoGame.Extended.Tweening.XML pdbonly @@ -31,6 +32,7 @@ TRACE prompt 4 + bin\Release\MonoGame.Extended.Tweening.XML diff --git a/Source/MonoGame.Extended/MonoGame.Extended.csproj b/Source/MonoGame.Extended/MonoGame.Extended.csproj index 8a1c13ec..2165dd57 100644 --- a/Source/MonoGame.Extended/MonoGame.Extended.csproj +++ b/Source/MonoGame.Extended/MonoGame.Extended.csproj @@ -26,6 +26,7 @@ 4 false 6 + bin\Debug\MonoGame.Extended.XML pdbonly @@ -35,6 +36,7 @@ prompt 4 false + bin\Release\MonoGame.Extended.XML diff --git a/Source/NuGet/MonoGame.Extended.Animations.nuspec b/Source/NuGet/MonoGame.Extended.Animations.nuspec index 96d56a34..f5b070f1 100644 --- a/Source/NuGet/MonoGame.Extended.Animations.nuspec +++ b/Source/NuGet/MonoGame.Extended.Animations.nuspec @@ -30,6 +30,7 @@ + diff --git a/Source/NuGet/MonoGame.Extended.Entities.nuspec b/Source/NuGet/MonoGame.Extended.Entities.nuspec index c98aeba4..735dc7e9 100644 --- a/Source/NuGet/MonoGame.Extended.Entities.nuspec +++ b/Source/NuGet/MonoGame.Extended.Entities.nuspec @@ -32,6 +32,7 @@ + diff --git a/Source/NuGet/MonoGame.Extended.Graphics.nuspec b/Source/NuGet/MonoGame.Extended.Graphics.nuspec index b959f6cf..fbd7038b 100644 --- a/Source/NuGet/MonoGame.Extended.Graphics.nuspec +++ b/Source/NuGet/MonoGame.Extended.Graphics.nuspec @@ -32,6 +32,7 @@ + diff --git a/Source/NuGet/MonoGame.Extended.Gui.nuspec b/Source/NuGet/MonoGame.Extended.Gui.nuspec index f23b8028..b95f5ab5 100644 --- a/Source/NuGet/MonoGame.Extended.Gui.nuspec +++ b/Source/NuGet/MonoGame.Extended.Gui.nuspec @@ -31,6 +31,7 @@ + diff --git a/Source/NuGet/MonoGame.Extended.Input.nuspec b/Source/NuGet/MonoGame.Extended.Input.nuspec index 8b75b9db..6b231559 100644 --- a/Source/NuGet/MonoGame.Extended.Input.nuspec +++ b/Source/NuGet/MonoGame.Extended.Input.nuspec @@ -30,6 +30,7 @@ + diff --git a/Source/NuGet/MonoGame.Extended.NuclexGui.nuspec b/Source/NuGet/MonoGame.Extended.NuclexGui.nuspec index 41e3c8b4..92ce249b 100644 --- a/Source/NuGet/MonoGame.Extended.NuclexGui.nuspec +++ b/Source/NuGet/MonoGame.Extended.NuclexGui.nuspec @@ -31,6 +31,7 @@ + diff --git a/Source/NuGet/MonoGame.Extended.Particles.nuspec b/Source/NuGet/MonoGame.Extended.Particles.nuspec index 80f4851f..7ae79255 100644 --- a/Source/NuGet/MonoGame.Extended.Particles.nuspec +++ b/Source/NuGet/MonoGame.Extended.Particles.nuspec @@ -30,6 +30,7 @@ + diff --git a/Source/NuGet/MonoGame.Extended.SceneGraphs.nuspec b/Source/NuGet/MonoGame.Extended.SceneGraphs.nuspec index b4a5ebc6..390833eb 100644 --- a/Source/NuGet/MonoGame.Extended.SceneGraphs.nuspec +++ b/Source/NuGet/MonoGame.Extended.SceneGraphs.nuspec @@ -30,6 +30,7 @@ + diff --git a/Source/NuGet/MonoGame.Extended.Tiled.nuspec b/Source/NuGet/MonoGame.Extended.Tiled.nuspec index 70f231d3..ff48a7a3 100644 --- a/Source/NuGet/MonoGame.Extended.Tiled.nuspec +++ b/Source/NuGet/MonoGame.Extended.Tiled.nuspec @@ -31,6 +31,7 @@ + diff --git a/Source/NuGet/MonoGame.Extended.Tweening.nuspec b/Source/NuGet/MonoGame.Extended.Tweening.nuspec index 94fdcbca..9074be6f 100644 --- a/Source/NuGet/MonoGame.Extended.Tweening.nuspec +++ b/Source/NuGet/MonoGame.Extended.Tweening.nuspec @@ -31,6 +31,7 @@ + diff --git a/Source/NuGet/MonoGame.Extended.nuspec b/Source/NuGet/MonoGame.Extended.nuspec index 6891f502..a7a4d6d3 100644 --- a/Source/NuGet/MonoGame.Extended.nuspec +++ b/Source/NuGet/MonoGame.Extended.nuspec @@ -31,6 +31,7 @@ + From bcfb64fe35f49d1cae3baaad7692165613df9db8 Mon Sep 17 00:00:00 2001 From: Mason11987 Date: Wed, 7 Feb 2018 05:44:02 -0500 Subject: [PATCH 09/13] Implemented Size3 and Point3. Fixed bug in Point2. (#466) * Implemented Size3 and Point3. Fixed bug in Point2. Documentation listed Point2, but code took in Vector2. Changed to Point2 * Adding missed project references --- .../MonoGame.Extended.csproj | 2 + Source/MonoGame.Extended/Point2.cs | 2 +- Source/MonoGame.Extended/Point3.cs | 379 ++++++++++++++++++ Source/MonoGame.Extended/Size3.cs | 289 +++++++++++++ 4 files changed, 671 insertions(+), 1 deletion(-) create mode 100644 Source/MonoGame.Extended/Point3.cs create mode 100644 Source/MonoGame.Extended/Size3.cs diff --git a/Source/MonoGame.Extended/MonoGame.Extended.csproj b/Source/MonoGame.Extended/MonoGame.Extended.csproj index 2165dd57..a7b4952a 100644 --- a/Source/MonoGame.Extended/MonoGame.Extended.csproj +++ b/Source/MonoGame.Extended/MonoGame.Extended.csproj @@ -46,6 +46,7 @@ + @@ -53,6 +54,7 @@ + diff --git a/Source/MonoGame.Extended/Point2.cs b/Source/MonoGame.Extended/Point2.cs index 735fff25..5f8de925 100644 --- a/Source/MonoGame.Extended/Point2.cs +++ b/Source/MonoGame.Extended/Point2.cs @@ -320,7 +320,7 @@ namespace MonoGame.Extended /// The the that contains the maximal coordinate values from two /// structures. /// - public static Point2 Maximum(Vector2 first, Vector2 second) + public static Point2 Maximum(Point2 first, Point2 second) { return new Point2(first.X > second.X ? first.X : second.X, first.Y > second.Y ? first.Y : second.Y); diff --git a/Source/MonoGame.Extended/Point3.cs b/Source/MonoGame.Extended/Point3.cs new file mode 100644 index 00000000..cb7b2493 --- /dev/null +++ b/Source/MonoGame.Extended/Point3.cs @@ -0,0 +1,379 @@ +using System; +using System.Diagnostics; +using Microsoft.Xna.Framework; + +namespace MonoGame.Extended +{ + /// + /// A three-dimensional point defined by a 3-tuple of real numbers, (x, y, z). + /// + /// + /// + /// A point is a position in three-dimensional space, the location of which is described in terms of a + /// three-dimensional coordinate system, given by a reference point, called the origin, and three coordinate axes. + /// + /// + /// A common three-dimensional coordinate system is the Cartesian (or rectangular) coordinate system where the + /// coordinate axes, conventionally denoted the X axis, Y axis and Z axis, are perpindicular to each other. + /// + /// + /// + /// + [DebuggerDisplay("{DebugDisplayString,nq}")] + public struct Point3 : IEquatable, IEquatableByRef + { + /// + /// Returns a with and equal to 0.0f. + /// + public static readonly Point3 Zero = new Point3(); + + /// + /// Returns a with and set to not a number. + /// + public static readonly Point3 NaN = new Point3(float.NaN, float.NaN, float.NaN); + + /// + /// The x-coordinate of this . + /// + public float X; + + /// + /// The y-coordinate of this . + /// + public float Y; + + /// + /// The z-coordinate of this . + /// + public float Z; + + /// + /// Initializes a new instance of the structure from the specified coordinates. + /// + /// The x-coordinate. + /// The y-coordinate. + /// The z-coordinate. + public Point3(float x, float y, float z) + { + X = x; + Y = y; + Z = z; + } + + /// + /// Compares two structures. The result specifies + /// whether the values of the and + /// fields of the two + /// structures are equal. + /// + /// The first point. + /// The second point. + /// + /// true if the and + /// fields of the two + /// structures are equal; otherwise, false. + /// + public static bool operator ==(Point3 first, Point3 second) + { + return first.Equals(ref second); + } + + /// + /// Indicates whether this is equal to another . + /// + /// The point. + /// + /// true if this is equal to the ; otherwise, + /// false. + /// + public bool Equals(Point3 point) + { + return Equals(ref point); + } + + /// + /// Indicates whether this is equal to another . + /// + /// The point. + /// + /// true if this is equal to the parameter; otherwise, + /// false. + /// + public bool Equals(ref Point3 point) + { + // ReSharper disable CompareOfFloatsByEqualityOperator + return (point.X == X) && (point.Y == Y) && (point.Z == Z); + // ReSharper restore CompareOfFloatsByEqualityOperator + } + + /// + /// Returns a value indicating whether this is equal to a specified object. + /// + /// The object to make the comparison with. + /// + /// true if this is equal to ; otherwise, false. + /// + public override bool Equals(object obj) + { + if (obj is Point3) + return Equals((Point3) obj); + return false; + } + + /// + /// Compares two structures. The result specifies + /// whether the values of the or + /// fields of the two + /// structures are unequal. + /// + /// The first point. + /// The second point. + /// + /// true if the or + /// fields of the two + /// structures are unequal; otherwise, false. + /// + public static bool operator !=(Point3 first, Point3 second) + { + return !(first == second); + } + + /// + /// Calculates the representing the addition of a and a + /// . + /// + /// The point. + /// The vector. + /// + /// The representing the addition of a and a . + /// + public static Point3 operator +(Point3 point, Vector3 vector) + { + return Add(point, vector); + } + + /// + /// Calculates the representing the addition of a and a + /// . + /// + /// The point. + /// The vector. + /// + /// The representing the addition of a and a . + /// + public static Point3 Add(Point3 point, Vector3 vector) + { + Point3 p; + p.X = point.X + vector.X; + p.Y = point.Y + vector.Y; + p.Z = point.Z + vector.Z; + return p; + } + + /// + /// Calculates the representing the subtraction of a and a + /// . + /// + /// The point. + /// The vector. + /// + /// The representing the substraction of a and a . + /// + public static Point3 operator -(Point3 point, Vector3 vector) + { + return Subtract(point, vector); + } + + /// + /// Calculates the representing the addition of a and a + /// . + /// + /// The point. + /// The vector. + /// + /// The representing the substraction of a and a . + /// + public static Point3 Subtract(Point3 point, Vector3 vector) + { + Point3 p; + p.X = point.X - vector.X; + p.Y = point.Y - vector.Y; + p.Z = point.Z - vector.Z; + return p; + } + + /// + /// Calculates the representing the displacement of two structures. + /// + /// The second point. + /// The first point. + /// + /// The representing the displacement of two structures. + /// + public static Vector3 operator -(Point3 point1, Point3 point2) + { + return Displacement(point1, point2); + } + + /// + /// Calculates the representing the displacement of two structures. + /// + /// The second point. + /// The first point. + /// + /// The representing the displacement of two structures. + /// + public static Vector3 Displacement(Point3 point2, Point3 point1) + { + Vector3 vector; + vector.X = point2.X - point1.X; + vector.Y = point2.Y - point1.Y; + vector.Z = point2.Z - point1.Z; + return vector; + } + + /// + /// Translates a by a given . + /// + /// The point. + /// The size. + /// + /// The result of the operator. + /// + public static Point3 operator +(Point3 point, Size3 size) + { + return Add(point, size); + } + + /// + /// Translates a by a given . + /// + /// The point. + /// The size. + /// + /// The result of the operator. + /// + public static Point3 Add(Point3 point, Size3 size) + { + return new Point3(point.X + size.Width, point.Y + size.Height, point.Z + size.Depth); + } + + /// + /// Translates a by the negative of a given . + /// + /// The point. + /// The size. + /// + /// The result of the operator. + /// + public static Point3 operator -(Point3 point, Size3 size) + { + return Subtract(point, size); + } + + /// + /// Translates a by the negative of a given . + /// + /// The point. + /// The size. + /// + /// The result of the operator. + /// + public static Point3 Subtract(Point3 point, Size3 size) + { + return new Point3(point.X - size.Width, point.Y - size.Height, point.Z - size.Depth); + } + + /// + /// Returns a hash code of this suitable for use in hashing algorithms and data + /// structures like a hash table. + /// + /// + /// A hash code of this . + /// + public override int GetHashCode() + { + unchecked + { + int hash = 17; + hash = hash * 23 + X.GetHashCode(); + hash = hash * 23 + Y.GetHashCode(); + hash = hash * 23 + Z.GetHashCode(); + return hash; + } + } + + /// + /// Calculates the that contains the minimal coordinate values from two + /// structures. + /// structures. + /// + /// The first point. + /// The second point. + /// + /// The the that contains the minimal coordinate values from two + /// structures. + /// + public static Point3 Minimum(Point3 first, Point3 second) + { + return new Point3(first.X < second.X ? first.X : second.X, + first.Y < second.Y ? first.Y : second.Y, + first.Z < second.Z ? first.Z : second.Z); + } + + /// + /// Calculates the that contains the maximal coordinate values from two + /// structures. + /// structures. + /// + /// The first point. + /// The second point. + /// + /// The the that contains the maximal coordinate values from two + /// structures. + /// + public static Point3 Maximum(Point3 first, Point3 second) + { + return new Point3(first.X > second.X ? first.X : second.X, + first.Y > second.Y ? first.Y : second.Y, + first.Z > second.Z ? first.Z : second.Z); + } + + /// + /// Performs an implicit conversion from a to a position . + /// + /// The point. + /// + /// The resulting . + /// + public static implicit operator Vector3(Point3 point) + { + return new Vector3(point.X, point.Y, point.Z); + } + + /// + /// Performs an implicit conversion from a to a position . + /// + /// The vector. + /// + /// The resulting . + /// + public static implicit operator Point3(Vector3 vector) + { + return new Point3(vector.X, vector.Y, vector.Z); + } + + /// + /// Returns a that represents this . + /// + /// + /// A that represents this . + /// + public override string ToString() + { + return $"({X}, {Y}, {Z})"; + } + + internal string DebugDisplayString => ToString(); + } +} \ No newline at end of file diff --git a/Source/MonoGame.Extended/Size3.cs b/Source/MonoGame.Extended/Size3.cs new file mode 100644 index 00000000..9872aee6 --- /dev/null +++ b/Source/MonoGame.Extended/Size3.cs @@ -0,0 +1,289 @@ +using System; +using Microsoft.Xna.Framework; + +namespace MonoGame.Extended +{ + /// + /// A three dimensional size defined by two real numbers, a width a height and a depth. + /// + /// + /// + /// A size is a subspace of three-dimensional space, the area of which is described in terms of a three-dimensional + /// coordinate system, given by a reference point and three coordinate axes. + /// + /// + /// + /// + public struct Size3 : IEquatable, IEquatableByRef + { + /// + /// Returns a with and equal to 0.0f. + /// + public static readonly Size3 Empty = new Size3(); + + /// + /// The horizontal component of this . + /// + public float Width; + + /// + /// The vertical component of this . + /// + public float Height; + + /// + /// The vertical component of this . + /// + public float Depth; + + /// + /// Gets a value that indicates whether this is empty. + /// + // ReSharper disable CompareOfFloatsByEqualityOperator + public bool IsEmpty => (Width == 0) && (Height == 0) && (Depth == 0); + + // ReSharper restore CompareOfFloatsByEqualityOperator + + /// + /// Initializes a new instance of the structure from the specified dimensions. + /// + /// The width. + /// The height. + /// The depth. + public Size3(float width, float height, float depth) + { + Width = width; + Height = height; + Depth = depth; + } + + /// + /// Compares two structures. The result specifies + /// whether the values of the and + /// fields of the two structures are equal. + /// + /// The first size. + /// The second size. + /// + /// true if the and + /// fields of the two structures are equal; otherwise, false. + /// + public static bool operator ==(Size3 first, Size3 second) + { + return first.Equals(ref second); + } + + /// + /// Indicates whether this is equal to another . + /// + /// The size. + /// + /// true if this is equal to the parameter; otherwise, + /// false. + /// + public bool Equals(Size3 size) + { + return Equals(ref size); + } + + /// + /// Indicates whether this is equal to another . + /// + /// The size. + /// + /// true if this is equal to the ; otherwise, + /// false. + /// + public bool Equals(ref Size3 size) + { + // ReSharper disable CompareOfFloatsByEqualityOperator + return (Width == size.Width) && (Height == size.Height) && (Depth == size.Depth); + // ReSharper restore CompareOfFloatsByEqualityOperator + } + + /// + /// Returns a value indicating whether this is equal to a specified object. + /// + /// The object to make the comparison with. + /// + /// true if this is equal to ; otherwise, false. + /// + public override bool Equals(object obj) + { + if (obj is Size3) + return Equals((Size3) obj); + return false; + } + + /// + /// Compares two structures. The result specifies + /// whether the values of the or + /// fields of the two structures are unequal. + /// + /// The first size. + /// The second size. + /// + /// true if the or + /// fields of the two structures are unequal; otherwise, false. + /// + public static bool operator !=(Size3 first, Size3 second) + { + return !(first == second); + } + + /// + /// Calculates the representing the vector addition of two structures as if + /// they were structures. + /// + /// The first size. + /// The second size. + /// + /// The representing the vector addition of two structures as if they + /// were structures. + /// + public static Size3 operator +(Size3 first, Size3 second) + { + return Add(first, second); + } + + /// + /// Calculates the representing the vector addition of two structures. + /// + /// The first size. + /// The second size. + /// + /// The representing the vector addition of two structures. + /// + public static Size3 Add(Size3 first, Size3 second) + { + Size3 size; + size.Width = first.Width + second.Width; + size.Height = first.Height + second.Height; + size.Depth = first.Depth + second.Depth; + return size; + } + + /// + /// Calculates the representing the vector subtraction of two structures. + /// + /// The first size. + /// The second size. + /// + /// The representing the vector subtraction of two structures. + /// + public static Size3 operator -(Size3 first, Size3 second) + { + return Subtract(first, second); + } + + public static Size3 operator /(Size3 size, float value) + { + return new Size3(size.Width / value, size.Height / value, size.Depth / value); + } + + public static Size3 operator *(Size3 size, float value) + { + return new Size3(size.Width * value, size.Height * value, size.Depth * value); + } + + /// + /// Calculates the representing the vector subtraction of two structures. + /// + /// The first size. + /// The second size. + /// + /// The representing the vector subtraction of two structures. + /// + public static Size3 Subtract(Size3 first, Size3 second) + { + Size3 size; + size.Width = first.Width - second.Width; + size.Height = first.Height - second.Height; + size.Depth = first.Depth - second.Depth; + return size; + } + + /// + /// Returns a hash code of this suitable for use in hashing algorithms and data + /// structures like a hash table. + /// + /// + /// A hash code of this . + /// + public override int GetHashCode() + { + unchecked + { + unchecked + { + int hash = 17; + hash = hash * 23 + Width.GetHashCode(); + hash = hash * 23 + Height.GetHashCode(); + hash = hash * 23 + Depth.GetHashCode(); + return hash; + } + } + } + + /// + /// Performs an implicit conversion from a to a . + /// + /// The point. + /// + /// The resulting . + /// + public static implicit operator Size3(Point3 point) + { + return new Size3(point.X, point.Y, point.Z); + } + + /// + /// Performs an implicit conversion from a to a . + /// + /// The size. + /// + /// The resulting . + /// + public static implicit operator Point3(Size3 size) + { + return new Point3(size.Width, size.Height, size.Depth); + } + + /// + /// Performs an implicit conversion from a to a . + /// + /// The size. + /// + /// The resulting . + /// + public static implicit operator Vector3(Size3 size) + { + return new Vector3(size.Width, size.Height, size.Depth); + } + + /// + /// Performs an implicit conversion from a to a . + /// + /// The vector. + /// + /// The resulting . + /// + public static implicit operator Size3(Vector3 vector) + { + return new Size3(vector.X, vector.Y, vector.Z); + } + + /// + /// Returns a that represents this . + /// + /// + /// A that represents this . + /// + public override string ToString() + { + return $"Width: {Width}, Height: {Height}, Depth: {Depth}"; + } + + internal string DebugDisplayString => ToString(); + } +} \ No newline at end of file From fa3ec93ae2696a5fd4626457014a84a8a0e0a630 Mon Sep 17 00:00:00 2001 From: SenpaiSharp <36146858+SenpaiSharp@users.noreply.github.com> Date: Wed, 7 Feb 2018 07:00:04 -0500 Subject: [PATCH 10/13] Apply kerning to the current glyph. (#465) Kerning value 'amount' wasn't being applied to the '_currentGlyph.Position.X' in either MoveNext() methods, only '_positionDelta.X'. Both are needed for proper positioning. --- Source/MonoGame.Extended/BitmapFonts/BitmapFont.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/MonoGame.Extended/BitmapFonts/BitmapFont.cs b/Source/MonoGame.Extended/BitmapFonts/BitmapFont.cs index 5836ffd7..618d5029 100644 --- a/Source/MonoGame.Extended/BitmapFonts/BitmapFont.cs +++ b/Source/MonoGame.Extended/BitmapFonts/BitmapFont.cs @@ -187,7 +187,10 @@ namespace MonoGame.Extended.BitmapFonts { int amount; if (_previousGlyph.Value.FontRegion.Kernings.TryGetValue(character, out amount)) + { _positionDelta.X += amount; + _currentGlyph.Position.X += amount; + } } _previousGlyph = _currentGlyph; @@ -302,7 +305,10 @@ namespace MonoGame.Extended.BitmapFonts { int amount; if (_previousGlyph.Value.FontRegion.Kernings.TryGetValue(character, out amount)) + { _positionDelta.X += amount; + _currentGlyph.Position.X += amount; + } } _previousGlyph = _currentGlyph; @@ -343,4 +349,4 @@ namespace MonoGame.Extended.BitmapFonts public Vector2 Position; public BitmapFontRegion FontRegion; } -} \ No newline at end of file +} From 596d0b865c606fd66ecac3e0fa10c45ffe70b5a9 Mon Sep 17 00:00:00 2001 From: Mason11987 Date: Wed, 7 Feb 2018 07:01:37 -0500 Subject: [PATCH 11/13] Screen Desktop defaulted to being width of 1, and height of 1, instead of width of 100%, and height of 100% (#462) --- Source/MonoGame.Extended.NuclexGui/GuiScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/MonoGame.Extended.NuclexGui/GuiScreen.cs b/Source/MonoGame.Extended.NuclexGui/GuiScreen.cs index fb41a001..06c59314 100644 --- a/Source/MonoGame.Extended.NuclexGui/GuiScreen.cs +++ b/Source/MonoGame.Extended.NuclexGui/GuiScreen.cs @@ -75,7 +75,7 @@ namespace MonoGame.Extended.NuclexGui // By default, the desktop control will cover the whole drawing area _desktopControl = new GuiDesktopControl { - Bounds = new UniRectangle(new UniVector(0, 0), new UniVector(1, 1)) + Bounds = new UniRectangle(new UniVector(0, 0), new UniVector(new UniScalar(1, 0), new UniScalar(1, 0))) }; _desktopControl.SetScreen(this); From d94e78802789848ecbc6db2597cd3d82af2295f8 Mon Sep 17 00:00:00 2001 From: Mason11987 Date: Wed, 7 Feb 2018 07:01:52 -0500 Subject: [PATCH 12/13] Implemented GuiResizableControl (#461) * Implemented GuiResizableControl, and made GuiWindowControl inherit from it. GuiResizableControl is a control that can be resized. GuiResizableControl calls SetCursorForResize(_resizingSides), which can be overriden to provide platform specific mouse cursor implementation depending on where on the edge of the control your mouse is. * Including class reference in project --- .../Controls/Desktop/GuiResizableControl.cs | 247 ++++++++++++++++++ .../Controls/Desktop/GuiSliderControl.cs | 2 +- .../Controls/Desktop/GuiWindowControl.cs | 9 +- .../Controls/GuiControl.cs | 2 +- .../Controls/GuiControlInput.cs | 16 +- .../Controls/GuiPressableControl.cs | 2 +- .../MonoGame.Extended.NuclexGui.csproj | 1 + 7 files changed, 267 insertions(+), 12 deletions(-) create mode 100644 Source/MonoGame.Extended.NuclexGui/Controls/Desktop/GuiResizableControl.cs diff --git a/Source/MonoGame.Extended.NuclexGui/Controls/Desktop/GuiResizableControl.cs b/Source/MonoGame.Extended.NuclexGui/Controls/Desktop/GuiResizableControl.cs new file mode 100644 index 00000000..545eb9e6 --- /dev/null +++ b/Source/MonoGame.Extended.NuclexGui/Controls/Desktop/GuiResizableControl.cs @@ -0,0 +1,247 @@ +using MonoGame.Extended.Input.InputListeners; +using MonoGame.Extended; +using System; +using Microsoft.Xna.Framework.Input; + +namespace MonoGame.Extended.NuclexGui.Controls.Desktop +{ + [Flags] + public enum ResizingSides + { + None = 0, + Top = 1, + Right = 2, + TopRight = 3, + Bottom = 4, + BottomRight = 6, + Left = 8, + TopLeft = 9, + BottomLeft = 12, + + } + + [Flags] + public enum ResizingDirections + { + None = 0, + Vertical = 1, + Horizontal = 2, + Both = 3 + } + + // Properties: + // Boundaries (for constraining a control to a region) + // Resizable (turn moveability on or off) + + /// Control the user can drag around with the mouse + public abstract class GuiResizableControl : GuiDraggableControl + { + /// Which sides are being resized + private ResizingSides _resizingSides = ResizingSides.None; + + /// Which Directions are being resized/summary> + private ResizingDirections _resizingDirections = ResizingDirections.None; + + /// Whether the control is currently being dragged + private bool _beingResized; + + /// Whether the control can be dragged + private bool _enableResizing; + + /// X coordinate at which the control was grabbed + private float _grabX; + + /// Y coordinate at which the control was grabbed + private float _grabY; + + /// Width of Border + private float _borderThickness = 8; + + /// Initializes a new draggable control + public GuiResizableControl() + { + EnableResizing = true; + } + + /// Initializes a new draggable control + /// Whether the control can obtain the input focus + public GuiResizableControl(bool canGetFocus) : base(canGetFocus) + { + EnableResizing = true; + } + + + + /// Whether the control can be dragged with the mouse + protected bool EnableResizing + { + get { return _enableResizing; } + set + { + _enableResizing = value; + _beingResized &= value; + } + } + + protected override void OnMouseLeft(float x, float y) + { + if (_beingResized) + { + ResizeTo(x, y); + } + else + { + base.OnMouseLeft(x, y); + _resizingSides = ResizingSides.None; + SetCursorForResize(_resizingSides); + } + + } + + /// Called when the mouse position is updated + /// X coordinate of the mouse cursor on the GUI + /// Y coordinate of the mouse cursor on the GUI + protected override void OnMouseMoved(float x, float y) + { + base.OnMouseMoved(x, y); + if (_beingResized) + { + ResizeTo(x, y); + } + else + { + // Remember the current mouse position so we know where the user picked + // up the control when a drag operation begins + _grabX = x; + _grabY = y; + } + + if (IsMouseOnBorder(x, y) && !_beingResized && _enableResizing) + { + SetResizingDirection(); + } + else if (_resizingSides != ResizingSides.None && !_beingResized) + { + _resizingSides = ResizingSides.None; + SetCursorForResize(_resizingSides); + } + } + + private void ResizeTo(float x, float y) + { + var OldBounds = Bounds; + var diffX = x - _grabX; + var diffY = y - _grabY; + var boundsX = Bounds.Size.X; + var boundsY = Bounds.Size.Y; + var locX = Bounds.Location.X; + var locY = Bounds.Location.Y; + + if (_resizingSides.HasFlag(ResizingSides.Right)) + { + boundsX = new UniScalar(boundsX.Fraction, boundsX.Offset + diffX); + } + if (_resizingSides.HasFlag(ResizingSides.Left)) + { + boundsX = new UniScalar(boundsX.Fraction, boundsX.Offset - diffX); + locX = new UniScalar(locX.Fraction, locX.Offset + diffX); + } + if (_resizingSides.HasFlag(ResizingSides.Bottom)) + { + boundsY = new UniScalar(boundsY.Fraction, boundsY.Offset + diffY); + } + if (_resizingSides.HasFlag(ResizingSides.Top)) + { + boundsY = new UniScalar(boundsY.Fraction, boundsY.Offset - diffY); + locY = new UniScalar(locY.Fraction, locY.Offset + diffY); + } + + Bounds = new UniRectangle(new UniVector(locX, locY), new UniVector(boundsX, boundsY)); + + if (GetAbsoluteBounds().Size.Width < 20 || GetAbsoluteBounds().Size.Height < 20) //Too Small + { + Bounds = OldBounds; + } + else + { + if (_resizingSides.HasFlag(ResizingSides.Right)) + _grabX = x; + if (_resizingSides.HasFlag(ResizingSides.Bottom)) + _grabY = y; + OnResize(OldBounds); + } + + + } + + public virtual void OnResize(UniRectangle oldBounds) + { + + } + + public virtual void SetCursorForResize(ResizingSides resizingSides) + { + //No Default behavior + } + + private void SetResizingDirection() + { + var _oldResizingSides = _resizingSides; + _resizingDirections = ResizingDirections.None; + _resizingSides = ResizingSides.None; + if (_grabX >= GetAbsoluteBounds().Size.Width - _borderThickness) + { + _resizingDirections |= ResizingDirections.Horizontal; + _resizingSides |= ResizingSides.Right; + } + if (_grabX <= _borderThickness) + { + _resizingDirections |= ResizingDirections.Horizontal; + _resizingSides |= ResizingSides.Left; + } + if (_grabY >= GetAbsoluteBounds().Size.Height - _borderThickness) + { + _resizingDirections |= ResizingDirections.Vertical; + _resizingSides |= ResizingSides.Bottom; + } + if (_grabY <= _borderThickness) + { + _resizingDirections |= ResizingDirections.Vertical; + _resizingSides |= ResizingSides.Top; + } + if (_oldResizingSides != _resizingSides) + { + SetCursorForResize(_resizingSides); + } + } + + private bool IsMouseOnBorder(float x, float y) + { + var absoluteSize = GetAbsoluteBounds().Size; + return x < _borderThickness || y < _borderThickness || x > absoluteSize.Width - _borderThickness || y > absoluteSize.Height - _borderThickness; + } + + /// Called when a mouse button has been pressed down + /// Index of the button that has been pressed + protected override void OnMousePressed(MouseButton button) + { + if (button == MouseButton.Left && IsMouseOnBorder(_grabX, _grabY)) + { + _beingResized = EnableResizing; + } + else + { + base.OnMousePressed(button); + } + } + + /// Called when a mouse button has been released again + /// Index of the button that has been released + protected override void OnMouseReleased(MouseButton button) + { + base.OnMouseReleased(button); + if (button == MouseButton.Left) + _beingResized = false; + } + } +} \ No newline at end of file diff --git a/Source/MonoGame.Extended.NuclexGui/Controls/Desktop/GuiSliderControl.cs b/Source/MonoGame.Extended.NuclexGui/Controls/Desktop/GuiSliderControl.cs index 3a8bb714..9c2bc3a3 100644 --- a/Source/MonoGame.Extended.NuclexGui/Controls/Desktop/GuiSliderControl.cs +++ b/Source/MonoGame.Extended.NuclexGui/Controls/Desktop/GuiSliderControl.cs @@ -103,7 +103,7 @@ namespace MonoGame.Extended.NuclexGui.Controls.Desktop /// /// Called when the mouse has left the control and is no longer hovering over it /// - protected override void OnMouseLeft() + protected override void OnMouseLeft(float x, float y) { _mouseOverThumb = false; } diff --git a/Source/MonoGame.Extended.NuclexGui/Controls/Desktop/GuiWindowControl.cs b/Source/MonoGame.Extended.NuclexGui/Controls/Desktop/GuiWindowControl.cs index 9e716033..7524ef4d 100644 --- a/Source/MonoGame.Extended.NuclexGui/Controls/Desktop/GuiWindowControl.cs +++ b/Source/MonoGame.Extended.NuclexGui/Controls/Desktop/GuiWindowControl.cs @@ -1,7 +1,7 @@ namespace MonoGame.Extended.NuclexGui.Controls.Desktop { /// A window for hosting other controls - public class GuiWindowControl : GuiDraggableControl + public class GuiWindowControl : GuiResizableControl { /// Text in the title bar of the window public string Title; @@ -21,6 +21,13 @@ set { base.EnableDragging = value; } } + /// Whether the window can be resized with the mouse + public new bool EnableResizing + { + get { return base.EnableResizing; } + set { base.EnableResizing = value; } + } + /// Closes the window public void Close() { diff --git a/Source/MonoGame.Extended.NuclexGui/Controls/GuiControl.cs b/Source/MonoGame.Extended.NuclexGui/Controls/GuiControl.cs index ce955da1..2c649f8b 100644 --- a/Source/MonoGame.Extended.NuclexGui/Controls/GuiControl.cs +++ b/Source/MonoGame.Extended.NuclexGui/Controls/GuiControl.cs @@ -252,7 +252,7 @@ namespace MonoGame.Extended.NuclexGui.Controls /// /// Called when the mouse has left the control and is no longer hovering over it /// - protected virtual void OnMouseLeft() + protected virtual void OnMouseLeft(float x, float y) { } diff --git a/Source/MonoGame.Extended.NuclexGui/Controls/GuiControlInput.cs b/Source/MonoGame.Extended.NuclexGui/Controls/GuiControlInput.cs index 70b7f4f3..eeb63fb6 100644 --- a/Source/MonoGame.Extended.NuclexGui/Controls/GuiControlInput.cs +++ b/Source/MonoGame.Extended.NuclexGui/Controls/GuiControlInput.cs @@ -124,7 +124,7 @@ namespace MonoGame.Extended.NuclexGui.Controls /// /// Called when the mouse has left the control and is no longer hovering over it /// - internal void ProcessMouseLeave() + internal void ProcessMouseLeave(float x, float y) { // Because the mouse has left us, if we have a mouse-over control, it also // cannot be over one of our children Children leaving the parent container @@ -136,9 +136,9 @@ namespace MonoGame.Extended.NuclexGui.Controls if (_mouseOverControl != null) { if (_mouseOverControl != this) - _mouseOverControl.ProcessMouseLeave(); + _mouseOverControl.ProcessMouseLeave(x, y); else - OnMouseLeft(); + OnMouseLeft(x, y); _mouseOverControl = null; } @@ -271,7 +271,7 @@ namespace MonoGame.Extended.NuclexGui.Controls // Is the mouse over this child? if (childBounds.Contains(new Point2(x, y))) { - SwitchMouseOverControl(control); + SwitchMouseOverControl(control, x, y); // Hand over the mouse movement data to the child control the mouse is // hovering over. If this is the mouse-press control, do nothing because @@ -293,7 +293,7 @@ namespace MonoGame.Extended.NuclexGui.Controls (y >= 0.0f) && (y < size.Y) ) { - SwitchMouseOverControl(this); + SwitchMouseOverControl(this, x, y); // If we weren't pressed, we didn't deliver the out-of-order update to // our implementation. Send our implementation a normal ordered update. @@ -303,7 +303,7 @@ namespace MonoGame.Extended.NuclexGui.Controls else { // redundant - our parent handles this - but convenient for unit tests - ProcessMouseLeave(); + ProcessMouseLeave(x, y); } } @@ -441,14 +441,14 @@ namespace MonoGame.Extended.NuclexGui.Controls /// Switches the mouse over control to a different control /// New control the mouse is hovering over - private void SwitchMouseOverControl(GuiControl newMouseOverControl) + private void SwitchMouseOverControl(GuiControl newMouseOverControl, float x, float y) { if (_mouseOverControl != newMouseOverControl) { // Tell the previous mouse-over control that the mouse is no longer // hovering over it if (_mouseOverControl != null) - _mouseOverControl.ProcessMouseLeave(); + _mouseOverControl.ProcessMouseLeave(x, y); _mouseOverControl = newMouseOverControl; diff --git a/Source/MonoGame.Extended.NuclexGui/Controls/GuiPressableControl.cs b/Source/MonoGame.Extended.NuclexGui/Controls/GuiPressableControl.cs index c5b2e469..9265261b 100644 --- a/Source/MonoGame.Extended.NuclexGui/Controls/GuiPressableControl.cs +++ b/Source/MonoGame.Extended.NuclexGui/Controls/GuiPressableControl.cs @@ -80,7 +80,7 @@ namespace MonoGame.Extended.NuclexGui.Controls /// /// Called when the mouse has left the control and is no longer hovering over it /// - protected override void OnMouseLeft() + protected override void OnMouseLeft(float x, float y) { // Intentionally not calling OnActivated() here because the user has moved // the mouse away from the command while holding the mouse button down - diff --git a/Source/MonoGame.Extended.NuclexGui/MonoGame.Extended.NuclexGui.csproj b/Source/MonoGame.Extended.NuclexGui/MonoGame.Extended.NuclexGui.csproj index 9192d566..8bf82ad8 100644 --- a/Source/MonoGame.Extended.NuclexGui/MonoGame.Extended.NuclexGui.csproj +++ b/Source/MonoGame.Extended.NuclexGui/MonoGame.Extended.NuclexGui.csproj @@ -50,6 +50,7 @@ + From ad03ad3251a467b7ce6bf2966df1ae91ce6d9573 Mon Sep 17 00:00:00 2001 From: Dylan Wilson Date: Wed, 7 Feb 2018 22:13:43 +1000 Subject: [PATCH 13/13] removed most of the compiler warnings about missing XML docs --- .../Demo.Features.WindowsDirectX.csproj | 1 + .../Demo.Features.WindowsOpenGL.csproj | 1 + Source/Demos/Demo.Features/Demo.Features.csproj | 1 + Source/Demos/Demo.NuclexGui/Demo.NuclexGui.csproj | 1 + Source/Demos/Demo.Platformer/Demo.Platformer.csproj | 1 + Source/Demos/Demo.SpaceGame/Demo.SpaceGame.csproj | 3 ++- Source/Demos/Demo.StarWarrior/Demo.StarWarrior.csproj | 1 + .../MonoGame.Extended.Animations.csproj | 1 + .../MonoGame.Extended.Collisions.csproj | 1 + .../MonoGame.Extended.Content.Pipeline.csproj | 1 + .../MonoGame.Extended.Entities.csproj | 1 + .../MonoGame.Extended.Graphics.csproj | 1 + Source/MonoGame.Extended.Gui/MonoGame.Extended.Gui.csproj | 1 + .../MonoGame.Extended.Input.csproj | 1 + .../MonoGame.Extended.NuclexGui.csproj | 1 + .../MonoGame.Extended.NuclexGui/Visuals/Flat/GuiSkin.cs | 8 +++++--- .../MonoGame.Extended.Particles.csproj | 1 + .../MonoGame.Extended.SceneGraphs.csproj | 1 + .../MonoGame.Extended.Tiled.csproj | 1 + .../MonoGame.Extended.Tweening.csproj | 1 + .../MonoGame.Extended/BitmapFonts/BitmapFontExtensions.cs | 4 ++-- Source/MonoGame.Extended/MonoGame.Extended.csproj | 1 + Source/MonoGame.Extended/TextureAtlases/TextureAtlas.cs | 2 +- 23 files changed, 29 insertions(+), 7 deletions(-) diff --git a/Source/Demos/Demo.Features.Windows/Demo.Features.WindowsDirectX.csproj b/Source/Demos/Demo.Features.Windows/Demo.Features.WindowsDirectX.csproj index 7da0f8f9..5651630f 100644 --- a/Source/Demos/Demo.Features.Windows/Demo.Features.WindowsDirectX.csproj +++ b/Source/Demos/Demo.Features.Windows/Demo.Features.WindowsDirectX.csproj @@ -25,6 +25,7 @@ false 4 6 + 1591 bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\ diff --git a/Source/Demos/Demo.Features.Windows/Demo.Features.WindowsOpenGL.csproj b/Source/Demos/Demo.Features.Windows/Demo.Features.WindowsOpenGL.csproj index a8ea9bdf..1e065169 100644 --- a/Source/Demos/Demo.Features.Windows/Demo.Features.WindowsOpenGL.csproj +++ b/Source/Demos/Demo.Features.Windows/Demo.Features.WindowsOpenGL.csproj @@ -25,6 +25,7 @@ false 4 6 + 1591 bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\ diff --git a/Source/Demos/Demo.Features/Demo.Features.csproj b/Source/Demos/Demo.Features/Demo.Features.csproj index 6e9c5fc3..b14cf650 100644 --- a/Source/Demos/Demo.Features/Demo.Features.csproj +++ b/Source/Demos/Demo.Features/Demo.Features.csproj @@ -24,6 +24,7 @@ prompt 4 6 + 1591 pdbonly diff --git a/Source/Demos/Demo.NuclexGui/Demo.NuclexGui.csproj b/Source/Demos/Demo.NuclexGui/Demo.NuclexGui.csproj index 428e7e0b..0cbfeb23 100644 --- a/Source/Demos/Demo.NuclexGui/Demo.NuclexGui.csproj +++ b/Source/Demos/Demo.NuclexGui/Demo.NuclexGui.csproj @@ -24,6 +24,7 @@ false false 6 + 1591 true diff --git a/Source/Demos/Demo.Platformer/Demo.Platformer.csproj b/Source/Demos/Demo.Platformer/Demo.Platformer.csproj index 08a106ff..2c4da4a0 100644 --- a/Source/Demos/Demo.Platformer/Demo.Platformer.csproj +++ b/Source/Demos/Demo.Platformer/Demo.Platformer.csproj @@ -24,6 +24,7 @@ false false 6 + 1591 true diff --git a/Source/Demos/Demo.SpaceGame/Demo.SpaceGame.csproj b/Source/Demos/Demo.SpaceGame/Demo.SpaceGame.csproj index e3dabe5b..74db2136 100644 --- a/Source/Demos/Demo.SpaceGame/Demo.SpaceGame.csproj +++ b/Source/Demos/Demo.SpaceGame/Demo.SpaceGame.csproj @@ -24,6 +24,7 @@ false false 6 + 1591 true @@ -160,4 +161,4 @@ --> - + \ No newline at end of file diff --git a/Source/Demos/Demo.StarWarrior/Demo.StarWarrior.csproj b/Source/Demos/Demo.StarWarrior/Demo.StarWarrior.csproj index 90ba80db..cde684ce 100644 --- a/Source/Demos/Demo.StarWarrior/Demo.StarWarrior.csproj +++ b/Source/Demos/Demo.StarWarrior/Demo.StarWarrior.csproj @@ -24,6 +24,7 @@ false false 6 + 1591 true diff --git a/Source/MonoGame.Extended.Animations/MonoGame.Extended.Animations.csproj b/Source/MonoGame.Extended.Animations/MonoGame.Extended.Animations.csproj index d7930cdf..0f00a43f 100644 --- a/Source/MonoGame.Extended.Animations/MonoGame.Extended.Animations.csproj +++ b/Source/MonoGame.Extended.Animations/MonoGame.Extended.Animations.csproj @@ -25,6 +25,7 @@ 4 6 bin\Debug\MonoGame.Extended.Animations.XML + 1591 pdbonly diff --git a/Source/MonoGame.Extended.Collisions/MonoGame.Extended.Collisions.csproj b/Source/MonoGame.Extended.Collisions/MonoGame.Extended.Collisions.csproj index 5cb93752..089cdcf4 100644 --- a/Source/MonoGame.Extended.Collisions/MonoGame.Extended.Collisions.csproj +++ b/Source/MonoGame.Extended.Collisions/MonoGame.Extended.Collisions.csproj @@ -26,6 +26,7 @@ 4 6 bin\Debug\MonoGame.Extended.Collisions.XML + 1591 pdbonly diff --git a/Source/MonoGame.Extended.Content.Pipeline/MonoGame.Extended.Content.Pipeline.csproj b/Source/MonoGame.Extended.Content.Pipeline/MonoGame.Extended.Content.Pipeline.csproj index 0989c39b..1ffce0f3 100644 --- a/Source/MonoGame.Extended.Content.Pipeline/MonoGame.Extended.Content.Pipeline.csproj +++ b/Source/MonoGame.Extended.Content.Pipeline/MonoGame.Extended.Content.Pipeline.csproj @@ -24,6 +24,7 @@ true 6 bin\MonoGame.Extended.Content.Pipeline.xml + 1591 pdbonly diff --git a/Source/MonoGame.Extended.Entities/MonoGame.Extended.Entities.csproj b/Source/MonoGame.Extended.Entities/MonoGame.Extended.Entities.csproj index 635f3595..d2cf9027 100644 --- a/Source/MonoGame.Extended.Entities/MonoGame.Extended.Entities.csproj +++ b/Source/MonoGame.Extended.Entities/MonoGame.Extended.Entities.csproj @@ -25,6 +25,7 @@ 4 6 bin\Debug\MonoGame.Extended.Entities.XML + 1591 pdbonly diff --git a/Source/MonoGame.Extended.Graphics/MonoGame.Extended.Graphics.csproj b/Source/MonoGame.Extended.Graphics/MonoGame.Extended.Graphics.csproj index 15f50280..7d0d8d88 100644 --- a/Source/MonoGame.Extended.Graphics/MonoGame.Extended.Graphics.csproj +++ b/Source/MonoGame.Extended.Graphics/MonoGame.Extended.Graphics.csproj @@ -27,6 +27,7 @@ true 6 bin\Debug\MonoGame.Extended.Graphics.XML + 1591 pdbonly diff --git a/Source/MonoGame.Extended.Gui/MonoGame.Extended.Gui.csproj b/Source/MonoGame.Extended.Gui/MonoGame.Extended.Gui.csproj index c2104557..5b0fb2e1 100644 --- a/Source/MonoGame.Extended.Gui/MonoGame.Extended.Gui.csproj +++ b/Source/MonoGame.Extended.Gui/MonoGame.Extended.Gui.csproj @@ -26,6 +26,7 @@ 4 6 bin\Debug\MonoGame.Extended.Gui.XML + 1591 pdbonly diff --git a/Source/MonoGame.Extended.Input/MonoGame.Extended.Input.csproj b/Source/MonoGame.Extended.Input/MonoGame.Extended.Input.csproj index f735933a..e5a423ce 100644 --- a/Source/MonoGame.Extended.Input/MonoGame.Extended.Input.csproj +++ b/Source/MonoGame.Extended.Input/MonoGame.Extended.Input.csproj @@ -24,6 +24,7 @@ prompt 4 bin\Debug\MonoGame.Extended.Input.XML + 1591 pdbonly diff --git a/Source/MonoGame.Extended.NuclexGui/MonoGame.Extended.NuclexGui.csproj b/Source/MonoGame.Extended.NuclexGui/MonoGame.Extended.NuclexGui.csproj index 8bf82ad8..14cfc186 100644 --- a/Source/MonoGame.Extended.NuclexGui/MonoGame.Extended.NuclexGui.csproj +++ b/Source/MonoGame.Extended.NuclexGui/MonoGame.Extended.NuclexGui.csproj @@ -25,6 +25,7 @@ 4 6 bin\Debug\MonoGame.Extended.NuclexGui.XML + 1591 pdbonly diff --git a/Source/MonoGame.Extended.NuclexGui/Visuals/Flat/GuiSkin.cs b/Source/MonoGame.Extended.NuclexGui/Visuals/Flat/GuiSkin.cs index 5fc3337b..45e06189 100644 --- a/Source/MonoGame.Extended.NuclexGui/Visuals/Flat/GuiSkin.cs +++ b/Source/MonoGame.Extended.NuclexGui/Visuals/Flat/GuiSkin.cs @@ -47,13 +47,15 @@ namespace MonoGame.Extended.NuclexGui.Visuals.Flat Center } - [JsonProperty("name")] public string Name; + [JsonProperty("name")] + public string Name; /// Regions that need to be drawn to render the frame - [JsonProperty("region")] public Region[] Regions; + [JsonProperty("region")] + public Region[] Regions; - [JsonProperty("text")] /// Locations where text can be drawn into the frame + [JsonProperty("text")] public Text[] Texts; /// Initializes a new frame diff --git a/Source/MonoGame.Extended.Particles/MonoGame.Extended.Particles.csproj b/Source/MonoGame.Extended.Particles/MonoGame.Extended.Particles.csproj index ec0b3cfd..cc910fc9 100644 --- a/Source/MonoGame.Extended.Particles/MonoGame.Extended.Particles.csproj +++ b/Source/MonoGame.Extended.Particles/MonoGame.Extended.Particles.csproj @@ -26,6 +26,7 @@ 6 true bin\Debug\MonoGame.Extended.Particles.XML + 1591 pdbonly diff --git a/Source/MonoGame.Extended.SceneGraphs/MonoGame.Extended.SceneGraphs.csproj b/Source/MonoGame.Extended.SceneGraphs/MonoGame.Extended.SceneGraphs.csproj index c3a81093..32125f1f 100644 --- a/Source/MonoGame.Extended.SceneGraphs/MonoGame.Extended.SceneGraphs.csproj +++ b/Source/MonoGame.Extended.SceneGraphs/MonoGame.Extended.SceneGraphs.csproj @@ -24,6 +24,7 @@ prompt 4 bin\Debug\MonoGame.Extended.SceneGraphs.XML + 1591 pdbonly diff --git a/Source/MonoGame.Extended.Tiled/MonoGame.Extended.Tiled.csproj b/Source/MonoGame.Extended.Tiled/MonoGame.Extended.Tiled.csproj index 9f14c91c..b88760ac 100644 --- a/Source/MonoGame.Extended.Tiled/MonoGame.Extended.Tiled.csproj +++ b/Source/MonoGame.Extended.Tiled/MonoGame.Extended.Tiled.csproj @@ -27,6 +27,7 @@ true 6 bin\Debug\MonoGame.Extended.Tiled.XML + 1591 pdbonly diff --git a/Source/MonoGame.Extended.Tweening/MonoGame.Extended.Tweening.csproj b/Source/MonoGame.Extended.Tweening/MonoGame.Extended.Tweening.csproj index 166aeff4..65ae9b2d 100644 --- a/Source/MonoGame.Extended.Tweening/MonoGame.Extended.Tweening.csproj +++ b/Source/MonoGame.Extended.Tweening/MonoGame.Extended.Tweening.csproj @@ -24,6 +24,7 @@ prompt 4 bin\Debug\MonoGame.Extended.Tweening.XML + 1591 pdbonly diff --git a/Source/MonoGame.Extended/BitmapFonts/BitmapFontExtensions.cs b/Source/MonoGame.Extended/BitmapFonts/BitmapFontExtensions.cs index be392a6a..6a656df7 100644 --- a/Source/MonoGame.Extended/BitmapFonts/BitmapFontExtensions.cs +++ b/Source/MonoGame.Extended/BitmapFonts/BitmapFontExtensions.cs @@ -105,8 +105,8 @@ namespace MonoGame.Extended.BitmapFonts /// /// objects are loaded from the Content Manager. See the class for /// more information. - /// Before any calls to you must call . Once all calls to - /// are complete, call . + /// Before any calls to you must call . Once all calls + /// are complete, call . /// Use a newline character (\n) to draw more than one line of text. /// /// diff --git a/Source/MonoGame.Extended/MonoGame.Extended.csproj b/Source/MonoGame.Extended/MonoGame.Extended.csproj index a7b4952a..bace4b95 100644 --- a/Source/MonoGame.Extended/MonoGame.Extended.csproj +++ b/Source/MonoGame.Extended/MonoGame.Extended.csproj @@ -27,6 +27,7 @@ false 6 bin\Debug\MonoGame.Extended.XML + 1591 pdbonly diff --git a/Source/MonoGame.Extended/TextureAtlases/TextureAtlas.cs b/Source/MonoGame.Extended/TextureAtlases/TextureAtlas.cs index 0e5a8bef..71757042 100644 --- a/Source/MonoGame.Extended/TextureAtlases/TextureAtlas.cs +++ b/Source/MonoGame.Extended/TextureAtlases/TextureAtlas.cs @@ -212,7 +212,7 @@ namespace MonoGame.Extended.TextureAtlases int index; if (_regionMap.TryGetValue(name, out index)) - return (T) GetRegion(index); + return (T)GetRegion(index); throw new KeyNotFoundException(name); }