UI Library for MonoGame, FNA and Stride
Additional stylesheet that is similar to default one, but 2 times bigger. It is intended to be used on 4k monitors. It could be turned on using following code:
Stylesheet.Current = DefaultAssets.DefaultStylesheet2X;
New style classes had been added: FileDialogStyle and ColorPickerDialogStyle
Also it's possible to style it through json: https://github.com/rds1983/Myra/blob/6df22cd92e04b414c5c905190aed808b9c8f20a0/src/Myra/Resources/default_ui_skin.xmms#L145
If you made custom stylesheet, then make sure the texture atlas contains "white" region, which is basically single white pixel. Existance of "white" region is required for the custom stylesheet to work properly. You can grab such image here: https://github.com/rds1983/Myra/blob/master/assets-raw/1x/white.png
The new widget ListView aims to replace ListBox. ListView allows arbitrary content. Example creation code:
var label1 = new Label();
label1.Text = "Item1";
var label2 = new Label();
label2.Text = "Item2";
var horizontalSeparator1 = new HorizontalSeparator();
var label3 = new Label();
label3.Text = "Item4";
var label4 = new Label();
label4.Text = "Item5";
var verticalStackPanel1 = new VerticalStackPanel();
verticalStackPanel1.Widgets.Add(label3);
verticalStackPanel1.Widgets.Add(label4);
var listView1 = new ListView();
listView1.Widgets.Add(label1);
listView1.Widgets.Add(label2);
listView1.Widgets.Add(horizontalSeparator1);
listView1.Widgets.Add(verticalStackPanel1);
It is equivalent to the following MML:
<ListView>
<Label Text="Item1" />
<Label Text="Item2" />
<HorizontalSeparator />
<VerticalStackPanel>
<Label Text="Item4" />
<Label Text="Item5" />
</VerticalStackPanel>
</ListView>
It'll render following:
https://github.com/rds1983/Myra/assets/1057289/6baa5715-f165-4dba-9157-37c957db5fdc
The new widget ComboView aims to replace ComboBox. It also allows arbitraty content. It's usage is similar to the ListView.
https://github.com/rds1983/Myra/assets/1057289/feed246f-6be6-419c-b17f-115c4662104b
#439: Feature Request: ListView widget(aka ListBox with arbitrary content) #440: Feature Request: ComboView Widget that allows arbitrary widgets
Finally, Widget got Tooltip property.
https://github.com/rds1983/Myra/assets/1057289/f7609704-0192-4843-bd13-293d77a502b7
It understands the FontStashSharp RTF Syntax. I.e. if Tooltip is set to "E=mc/v[-8]2/n/vdMass–energy equivalence.", then it would show:
The tooltip creation could be customized through MyraEnvironment.TooltipCreator.
It's optional feature that is turned on by setting MyraEnvironment.EnableModalDarkening to true. Then every window that is modal(shown through ShowModal) would darken the background.
https://github.com/rds1983/Myra/assets/1057289/fb080d1b-a0a7-451c-82b6-d35364dc415b
https://github.com/rds1983/Myra/assets/1057289/4310b20a-b814-461b-83f4-08b64bc540da
#57 - Feature Request: Tooltip Widget #436 - Add optional ability to windows to darken the background when shown #437 - Feature Request: RadioButton with the arbitrary content
CheckButton widget that is intended to replace the CheckBox and allows the atrbitraty content.
https://github.com/rds1983/Myra/assets/1057289/f6f3344a-5697-4139-9c09-c6af852b5457
TreeView widget that is intended to replace the Tree and also allows the arbitraty content as nodes.
https://github.com/rds1983/Myra/assets/1057289/99462505-7721-462d-ad45-250e76cc7dad
#427 - Feature Request: CheckButton widget #428 - Feature Request: TreeView widget that allows arbitrary content at nodes #429 - Feature Request: Create a UWP package #430 - Downgrade minimum MG version to 3.8.0
Again this release contains a lot of internal refactoring. Particularly the entire input system had been rewritten. However there are new features.
There's new property Widget.MouseCursorType that allows to set one of the stock mouse cursors types:
https://github.com/rds1983/Myra/assets/1057289/eb369722-2165-45df-aa26-10bf68cf52de
Two new widgets had been added: Button & ToggleButton, that can have arbitrary content(which can be set through the Content Property):
https://github.com/rds1983/Myra/assets/1057289/e2172bed-18eb-43df-b81f-b49ddfd01fdb
It's recommended to move from old ImageButton and TextButton to the new classes. Hence older classes had been attributed as obsolete.
#413 - Feature Request: Cursors #414 - Feature Request: Button class with arbitrary Content #419 - Refactoring: Merge Widget.Children & InputHelper #421 - Documentation: Update Stride tutorial so it matches the latest Stride version #422 - Make public classes at Utility - internal #423 - Input overhaul #424 - Fix Desktop.IsMouseOverGUI #426 - Refactoring: Introduce ILayout
Generally the new release contains a lot of internal refactoring that wont affect the end user in any way. However there are still some API changes, new features and bug fixes. Way more changes are planned.
Starting from the new version, setting Widget's Grid* properties should be done through the new api. I.e. old code:
widget.GridRow = 2;
widget.GridColumn = 3;
widget.GridRowSpan = 4;
Widget.GridRowColumn = 5;
Should be replaced with:
Grid.SetRow(widget, 2);
Grid.SetColumn(widget, 3);
Grid.SetRowSpan(widget, 4);
Grid.SetColumnSpan(widget, 5);
Respectively old MML code:
<TextBlock GridRow="2" GridColumn="3" GridRowSpan="4" GridColumnSpan="5"/>
Should be replaced with:
<TextBlock Grid.Row="2" Grid.Column="3" Grid.RowSpan="4" Grid.ColumnSpan="5"/>
It's possible to update MML files automatically by loading them in the MyraPad, press Ctrl+F(Format Source) and Save.
Let's say we want to make StackPanel with 4 TextBlocks. And we want 3rd to fill all remaining space from 1st, 2nd and 4th. Old code to archieve that is:
var stackPanel = new HorizontalStackPanel();
stackPanel.Proportions.Add(Propotion.Auto);
stackPanel.Proportions.Add(Propotion.Auto);
stackPanel.Proportions.Add(Propotion.Fill);
stackPanel.Proportions.Add(Propotion.Auto);
stackPanel.Widgets.Add(textBlock1);
stackPanel.Widgets.Add(textBlock2);
stackPanel.Widgets.Add(textBlock3);
stackPanel.Widgets.Add(textBlock4);
Now it could be done with following code:
var stackPanel = new HorizontalStackPanel();
StackPanel.SetProportionType(textBlock3, ProportionType.Fill);
stackPanel.Widgets.Add(textBlock1);
stackPanel.Widgets.Add(textBlock2);
stackPanel.Widgets.Add(textBlock3);
stackPanel.Widgets.Add(textBlock4);
Respectively old MML code:
<HorizontalStackPanel>
<Proportions>
<Proportion Type="Auto" />
<Proportion Type="Auto" />
<Proportion Type="Fill" />
<Proportion Type="Auto" />
</Propotions>
<TextBlock Id="textBlock1"/>
<TextBlock Id="textBlock2"/>
<TextBlock Id="textBlock3"/>
<TextBlock Id="textBlock4"/>
</HorizontalStackPanel>
Now it could be done with following:
<HorizontalStackPanel>
<TextBlock Id="textBlock1"/>
<TextBlock Id="textBlock2"/>
<TextBlock Id="textBlock3" StackPanel.ProportionType="Fill"/>
<TextBlock Id="textBlock4"/>
</HorizontalStackPanel>
Similarly the MML could be automatically updated through the MyraPad.
#382 - Feature Request: Support custom widgets for property grid. #392 - Fix memory leak #401 - Myra doesnt properly restore ScissorRectangle if the window gets resized #403 - Monogame CustomWidget drawline with (thickness > 1), the line is not drawing from center. #405 - New asset management #406 - Move onto FontStashSharp 1.3.0 #408 - Add attached properties #409 - TextBox: When the text is selected via touch, the scrolling should follow the touch position #411 - Refactoring: StackPanel should inherit from MultipleItemsContainerBase #415 - Refactoring: Move all Grid layout code into separate class GridLayout #416 - Refactoring: SplitPane should inherit from MultipleItemsContainerBase #417 - Refactoring: Add ObservableCollection<Widget> RealChildren to Widget class
New Features: Improvements and new samples for the Myra.PlatformAgnostic. See wiki entry for the details: https://github.com/rds1983/Myra/wiki/Using-platform-agnostic-version-of-Myra
Myrapad Changes Now Myrapad stores its configuration file(Myrapad.config) in the same folder as the Myrapad.exe. Before it was stored in the users' Documents folder.
Closed Issues & Merged Pull Requests:
New Features: Support of the new FontStashSharp rich text syntax: https://github.com/rds1983/Myra/wiki/Rich-Text
Closed Issues: Move to the latest FontStashSharp with Rich Text support TextBox Bug: when going down through Down key, the caret moves by additional symbol PropertyGrid: Add special attribute that would open file dialog for string properties MyraPad rich text support