Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
e1b73d0
WIP refactor of PropertyGrid to be type user-extendable.
Bamboy Jan 31, 2026
b2138fc
Widespread refactors in PropertyGrid to enable anonymous C# property …
Bamboy Feb 8, 2026
f25a605
Inspector sample
Bamboy Feb 8, 2026
8a16ca1
Improve inspector sample for better testing
Bamboy Feb 9, 2026
f5cc40e
Code cleanup
Bamboy Feb 9, 2026
6eb284c
Merge branch 'master'
Bamboy Feb 9, 2026
2341ccd
Merge into local fork. Fix version dependency for AssetManagementBase
Bamboy Feb 10, 2026
c293bf5
Merge branch 'master'
Bamboy Feb 10, 2026
1bc981c
Fix build when PLATFORM_AGNOSTIC is on
Bamboy Feb 10, 2026
a46f1d8
Merge branch 'master'
Bamboy Feb 10, 2026
22e2666
Structures to support generic numbers through Record, misc
Bamboy Feb 12, 2026
3bf1302
Add Generic.Math library
Bamboy Feb 12, 2026
69bb02a
SpinButton now uses a generic data type.
Bamboy Feb 12, 2026
062aa2e
Refactor SpinButton ToString method to fit generic numbers, new MathH…
Bamboy Feb 13, 2026
9ed2c9e
Merge branch 'rds1983:master' into master
Bamboy Feb 18, 2026
f2128b6
Misc comments
Bamboy Feb 18, 2026
65ab368
Merge branch 'master'
Bamboy Feb 18, 2026
e6b94bb
Merge branch 'rds1983:master' into inspector
Bamboy Feb 19, 2026
d47171e
MyraPad can now load legacy non-generic SpinButton type, and when loa…
Bamboy Feb 19, 2026
6c20bb4
MyraPad now auto-fills the generic type arg for SpinButton
Bamboy Feb 19, 2026
9a5aea6
NumericPropertyEditor now handles nullables properly, misc
Bamboy Feb 20, 2026
6887c5e
EnumPropertyEditor is now working, more misc
Bamboy Feb 20, 2026
bee3e97
Real-time updating of property values
Bamboy Feb 20, 2026
477dc2b
Added compatibility for .net/keyword string-type conversion in TypeHe…
Bamboy Feb 21, 2026
720d01b
Update prior MyraPad code-generated files, misc
Bamboy Feb 22, 2026
19095ea
MyraPad now converts numeric type literals better depending on destin…
Bamboy Feb 22, 2026
6ea2d3f
Re-enable prior property grid drawing features
Bamboy Feb 22, 2026
b12032c
fix generated file
Bamboy Feb 22, 2026
96bc199
Organize files, add compiler directives
Bamboy Feb 23, 2026
3d13d71
Interface math and compiler directive in MathHelper
Bamboy Feb 23, 2026
6a3e97d
Conditional .csproj
Bamboy Feb 23, 2026
f410d27
Copied conditionals to other .csproj files
Bamboy Feb 23, 2026
ac155f0
Code organization, renaming and merging classes, files, etc
Bamboy Feb 23, 2026
069b291
More organizing
Bamboy Feb 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions samples/Myra.Samples.AllWidgets/AllWidgets.Generated.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated by MyraPad at 12/6/2023 3:29:08 AM */
/* Generated by MyraPad at 2/21/2026 7:18:26 AM */
using Myra;
using Myra.Graphics2D;
using Myra.Graphics2D.TextureAtlases;
Expand Down Expand Up @@ -129,9 +129,8 @@ private void BuildUI()
_buttonSaveFile.Id = "_buttonSaveFile";
Grid.SetColumn(_buttonSaveFile, 1);
_buttonSaveFile.Content = horizontalStackPanel1;
_buttonSaveFile.MouseCursor = MouseCursorType.Hand;

_textSaveFile = new TextBox();
_textSaveFile = new TextBox();
_textSaveFile.Id = "_textSaveFile";
Grid.SetColumn(_textSaveFile, 2);

Expand Down Expand Up @@ -272,8 +271,9 @@ private void BuildUI()
label16.Text = "Spin Button:";
Grid.SetRow(label16, 9);

var spinButton1 = new SpinButton();
spinButton1.Value = 1;
var spinButton1 = new SpinButton<int>();
spinButton1.Value = 5;
spinButton1.DecimalPlaces = 0;
spinButton1.Width = 100;
Grid.SetColumn(spinButton1, 1);
Grid.SetRow(spinButton1, 9);
Expand Down Expand Up @@ -376,6 +376,7 @@ private void BuildUI()
_gridRight.Widgets.Add(label22);

var scrollViewer1 = new ScrollViewer();
scrollViewer1.ScrollMultiplier = 10;
scrollViewer1.ShowHorizontalScrollBar = false;
scrollViewer1.Content = _gridRight;

Expand Down
2 changes: 1 addition & 1 deletion samples/Myra.Samples.AllWidgets/AllWidgets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public AllWidgets()
Content = imageButtonContent
});
node3.AddSubNode(new HorizontalSlider());
node3.AddSubNode(new SpinButton());
node3.AddSubNode(new SpinButton<float>());

var imageButtonContent2 = new HorizontalStackPanel
{
Expand Down
4 changes: 2 additions & 2 deletions samples/Myra.Samples.AllWidgets/allControls.xmmp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</MenuItem>
</HorizontalMenu>
<HorizontalSplitPane StackPanel.ProportionType="Fill">
<ScrollViewer ShowHorizontalScrollBar="False">
<ScrollViewer ScrollMultiplier="10" ShowHorizontalScrollBar="False">
<Grid ColumnSpacing="8" RowSpacing="8" Id="_gridRight">
<Grid.DefaultRowProportion Type="Auto" />
<Grid.ColumnsProportions>
Expand Down Expand Up @@ -77,7 +77,7 @@
<Label Text="Text Field:" Grid.Row="8" />
<TextBox Grid.Column="1" Grid.Row="8" Grid.ColumnSpan="2" />
<Label Text="Spin Button:" Grid.Row="9" />
<SpinButton Value="1" Width="100" Grid.Column="1" Grid.Row="9" />
<SpinButton GenericTypeArg="int" Value="5" DecimalPlaces="0" Width="100" Grid.Column="1" Grid.Row="9" />
<Label Text="List View:" Grid.Row="10" />
<ListView Width="200" Grid.Column="1" Grid.Row="10" Grid.ColumnSpan="2">
<Label Text="Red" TextColor="#FF0000FF" />
Expand Down
4 changes: 2 additions & 2 deletions samples/Myra.Samples.GridContainer/GridGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,10 @@ protected override void LoadContent()

grid.Widgets.Add(textField);

var spinButton2 = new SpinButton
var spinButton2 = new SpinButton<int>
{
Width = 100,
Integer = true
Value = 0,
};
Grid.SetColumn(spinButton2, 5);
Grid.SetRow(spinButton2, 2);
Expand Down
36 changes: 36 additions & 0 deletions samples/Myra.Samples.Inspector/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-mgcb": {
"version": "3.8.3",
"commands": [
"mgcb"
]
},
"dotnet-mgcb-editor": {
"version": "3.8.3",
"commands": [
"mgcb-editor"
]
},
"dotnet-mgcb-editor-linux": {
"version": "3.8.3",
"commands": [
"mgcb-editor-linux"
]
},
"dotnet-mgcb-editor-windows": {
"version": "3.8.3",
"commands": [
"mgcb-editor-windows"
]
},
"dotnet-mgcb-editor-mac": {
"version": "3.8.3",
"commands": [
"mgcb-editor-mac"
]
}
}
}
14 changes: 14 additions & 0 deletions samples/Myra.Samples.Inspector/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "C#: Myra.Samples.Inspector Debug",
"type": "dotnet",
"request": "launch",
"projectPath": "${workspaceFolder}/Myra.Samples.Inspector.csproj"
}
],
}
86 changes: 86 additions & 0 deletions samples/Myra.Samples.Inspector/Input.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

namespace Myra.Samples.Inspector
{
public class Input
{
public int SelectedIndex => selectedIndex;
public int TextInfoIndex => infoIndex;

private int selectedIndex, infoIndex;
private bool lastDown, lastUp, lastLeft, lastRight;

private readonly Func<int> _maxSelectionsGetter;
private readonly Func<int> _maxInfosGetter;

public Action<int> OnSelectionChanged;
public Action<int> OnTextInfoChanged;

public Input(Func<int> maxSelectionsGetter, Func<int> maxInfosGetter)
{
_maxSelectionsGetter = maxSelectionsGetter;
_maxInfosGetter = maxInfosGetter;
}

public void Update(KeyboardState state)
{
// Prevent spam cycling by only triggering an input change once.
bool thisDown = state[Keys.Down] == KeyState.Down;
bool thisUp = state[Keys.Up] == KeyState.Down;
bool thisLeft = state[Keys.Left] == KeyState.Down;
bool thisRight = state[Keys.Right] == KeyState.Down;

if (thisDown & !lastDown)
CycleSelection(false);
else if(thisUp & !lastUp)
CycleSelection(true);

if (thisLeft & !lastLeft)
CycleInfo(false);
else if(thisRight & !lastRight)
CycleInfo(true);

lastDown = thisDown;
lastUp = thisUp;
lastLeft = thisLeft;
lastRight = thisRight;
}

private void CycleSelection(bool forward)
{
if (forward)
{
selectedIndex++;
if (selectedIndex >= _maxSelectionsGetter.Invoke())
selectedIndex = 0;
}
else
{
selectedIndex--;
if (selectedIndex < 0)
selectedIndex = _maxSelectionsGetter.Invoke() - 1;
}
OnSelectionChanged?.Invoke(selectedIndex); //widgets.Inspect( widgets.inspectables[selectedIndex] );
}

private void CycleInfo(bool forward)
{
if (forward)
{
infoIndex++;
if (infoIndex >= _maxInfosGetter.Invoke())
infoIndex = 0;
}
else
{
infoIndex--;
if (infoIndex < 0)
infoIndex = _maxInfosGetter.Invoke() - 1;
}
OnTextInfoChanged?.Invoke(infoIndex);
}
}

}
118 changes: 118 additions & 0 deletions samples/Myra.Samples.Inspector/InspectGame.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
using Myra.Graphics2D.UI;

#if !STRIDE
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
#if ANDROID
#endif
#else
using System.Threading.Tasks;
using Stride.Engine;
using Stride.Games;
using Stride.Graphics;
using Stride.Core.Mathematics;
#endif

namespace Myra.Samples.Inspector
{
public class InspectGame : Game
{
#if !STRIDE
private readonly GraphicsDeviceManager _graphics;
#endif

private Input _input;
private RootWidgets _widgets;
private Desktop _desktop;

public static InspectGame Instance { get; private set; }

public InspectGame()
{
Instance = this;
#if !STRIDE
_graphics = new GraphicsDeviceManager(this)
{
PreferredBackBufferWidth = 1200,
PreferredBackBufferHeight = 800
};
Window.AllowUserResizing = false;
#else
#endif

IsMouseVisible = true;
}

#if STRIDE
protected override Task LoadContent()
{
MyraEnvironment.Game = this;

_widgets = new RootWidgets();

_desktop = new Desktop();
_desktop.Widgets.Add(_allWidgets);

return base.LoadContent();
}
#else
protected override void LoadContent()
{
base.LoadContent();

MyraEnvironment.Game = this;
MyraEnvironment.EnableModalDarkening = true;

// Stylesheet.Current = DefaultAssets.DefaultStylesheet2X;

_widgets = new RootWidgets();

_desktop = new Desktop();
_desktop.Root = _widgets;

_input = new Input(() => _widgets.inspectables.Count, () => _widgets.infos.Count)
{
OnSelectionChanged = (int i) => { _widgets.SetSelectedIndex(i); },
OnTextInfoChanged = (int i) => { _widgets.SetInfoIndex(i); },
};

#if MONOGAME && !ANDROID
// Inform Myra that external text input is available
// So it stops translating Keys to chars
_desktop.HasExternalTextInput = true;

// Provide that text input
Window.TextInput += (s, a) =>
{
_desktop.OnChar(a.Character);
};
#endif
}
#endif
protected override void Update(GameTime gameTime)
{
base.Update(gameTime);
_input.Update(Keyboard.GetState());
_widgets.Update(gameTime);
}

protected override void Draw(GameTime gameTime)
{
base.Draw(gameTime);

#if !STRIDE
GraphicsDevice.Clear(Color.Black);
#else
// Clear screen
GraphicsContext.CommandList.Clear(GraphicsDevice.Presenter.BackBuffer, Color.Black);
GraphicsContext.CommandList.Clear(GraphicsDevice.Presenter.DepthStencilBuffer, DepthStencilClearOptions.DepthBuffer | DepthStencilClearOptions.Stencil);

// Set render target
GraphicsContext.CommandList.SetRenderTargetAndViewport(GraphicsDevice.Presenter.DepthStencilBuffer, GraphicsDevice.Presenter.BackBuffer);
#endif
_widgets.OnPreRender();
_desktop.Render();
}
}
}
22 changes: 22 additions & 0 deletions samples/Myra.Samples.Inspector/Myra.Samples.Inspector.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>$(AppTargetFramework)</TargetFramework>
<OutputPath>bin\MonoGame\$(Configuration)</OutputPath>
<LangVersion>9</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="$(AppMonoGameVersion)" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Myra\Myra.MonoGame.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="Myra">
<HintPath>..\..\src\Myra\bin\MonoGame\Debug\netstandard2.0\Myra.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
16 changes: 16 additions & 0 deletions samples/Myra.Samples.Inspector/Myra.Samples.Inspector.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Myra.Samples.Inspector", "Myra.Samples.Inspector.csproj", "{916D1C19-828B-4324-926F-6409D096DBA8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{916D1C19-828B-4324-926F-6409D096DBA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{916D1C19-828B-4324-926F-6409D096DBA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{916D1C19-828B-4324-926F-6409D096DBA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{916D1C19-828B-4324-926F-6409D096DBA8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
2 changes: 2 additions & 0 deletions samples/Myra.Samples.Inspector/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
using var game = new Myra.Samples.Inspector.InspectGame();
game.Run();
Loading
Loading