diff --git a/GeonBit.UI.Examples/GeonBitUI_Examples.cs b/GeonBit.UI.Examples/GeonBitUI_Examples.cs
index b7fa751..89bd5e6 100644
--- a/GeonBit.UI.Examples/GeonBitUI_Examples.cs
+++ b/GeonBit.UI.Examples/GeonBitUI_Examples.cs
@@ -26,6 +26,7 @@
using GeonBit.UI.Entities.TextValidators;
using GeonBit.UI.DataTypes;
using GeonBit.UI.Utils.Forms;
+using System.Diagnostics;
namespace GeonBit.UI.Examples
{
@@ -141,13 +142,21 @@ protected void InitExamplesAndUI()
Button showGitButton = new Button("Git Repo", ButtonSkin.Fancy, Anchor.TopCenter, new Vector2(280, topPanelHeight));
showGitButton.OnClick = (Entity btn) =>
{
+ var url = "https://github.com/RonenNess/GeonBit.UI";
try
{
- System.Diagnostics.Process.Start("https://github.com/RonenNess/GeonBit.UI");
+ Process.Start(url);
}
catch
{
- System.Diagnostics.Process.Start("IExplore", "https://github.com/RonenNess/GeonBit.UI");
+ try
+ {
+ Process.Start("IExplore", url);
+ }
+ catch
+ {
+ Process.Start(new ProcessStartInfo(url) { UseShellExecute = true });
+ }
}
};
topPanel.AddChild(showGitButton);
diff --git a/GeonBit.UI/Source/Input/DefaultInputProvider.cs b/GeonBit.UI/Source/Input/DefaultInputProvider.cs
index 226375a..f54ffb2 100644
--- a/GeonBit.UI/Source/Input/DefaultInputProvider.cs
+++ b/GeonBit.UI/Source/Input/DefaultInputProvider.cs
@@ -7,6 +7,7 @@
// Since: 2016.
//-----------------------------------------------------------------------------
#endregion
+using GeonBit.UI.Entities;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
@@ -64,6 +65,9 @@ public class DefaultInputProvider : IMouseInput, IKeyboardInput
///
public int MouseWheelChange { get; private set; }
+ // if true, will perform a click event next update
+ bool _clickNextUpdate = false;
+
///
/// Create the input helper.
///
@@ -109,6 +113,12 @@ public void Update(GameTime gameTime)
_newMouseState = Mouse.GetState();
_newKeyboardState = Keyboard.GetState();
+ // perform click emulation
+ if (_clickNextUpdate) {
+ _newMouseState = new MouseState(_newMouseState.X, _newMouseState.Y, _newMouseState.ScrollWheelValue, ButtonState.Pressed, _newMouseState.MiddleButton, _newMouseState.RightButton, _newMouseState.XButton1, _newMouseState.XButton2, _newMouseState.HorizontalScrollWheelValue);
+ _clickNextUpdate = false;
+ }
+
// get mouse position
_oldMousePos = _newMousePos;
_newMousePos = new Vector2(_newMouseState.X, _newMouseState.Y);
@@ -148,6 +158,14 @@ public void Update(GameTime gameTime)
}
}
+ ///
+ /// Perform click next update frame.
+ ///
+ public void DoClick()
+ {
+ _clickNextUpdate = true;
+ }
+
///
/// Move the cursor to be at the center of the screen.
///
diff --git a/GeonBit.UI/Source/Input/IMouseInput.cs b/GeonBit.UI/Source/Input/IMouseInput.cs
index 5b8c7da..6cd39b4 100644
--- a/GeonBit.UI/Source/Input/IMouseInput.cs
+++ b/GeonBit.UI/Source/Input/IMouseInput.cs
@@ -116,6 +116,11 @@ public interface IMouseInput
/// True if any mouse button was released.
bool AnyMouseButtonReleased();
+ ///
+ /// Perform click next update frame.
+ ///
+ void DoClick();
+
///
/// Current mouse wheel value.
///
diff --git a/GeonBit.UI/Source/UserInterface.cs b/GeonBit.UI/Source/UserInterface.cs
index cba756c..a54c378 100644
--- a/GeonBit.UI/Source/UserInterface.cs
+++ b/GeonBit.UI/Source/UserInterface.cs
@@ -94,7 +94,7 @@ public enum BuiltinThemes
public class UserInterface : System.IDisposable
{
/// Current GeonBit.UI version identifier.
- public const string VERSION = "4.3.0.2";
+ public const string VERSION = "4.3.0.3";
///
/// The currently active user interface instance.
diff --git a/README.md b/README.md
index 471e3a3..f730ebf 100644
--- a/README.md
+++ b/README.md
@@ -2106,6 +2106,11 @@ If you want to use the new files dialog, you must include the new textures that
- Fixed number validators to not allow spaces.
- Added example for text validators.
+### 4.3.0.3
+
+- Added option to emulate mouse click via the mouse input provider.
+- Fixed repo link in demo project.
+
## Credits
GeonBit.UI was written by Ronen Ness, but uses some free textures made by awesome people who share their work for free.