Myra - UI Library for the MonoGame

Any reason why when I change textbox’s textverticalalignment to centered the cursor does not also go in the same spot?

Probably a bug.

What is the proper way to render a scene to a control in Myra?

What is the difference between a SplitPane, StackPanel and Panel?

When should each be used?

By making a custom control. There’s a sample demonstrating that: Myra/samples/Myra.Samples.CustomWidgets at master · rds1983/Myra (github.com)

1 Like

Myra.Samples.SplitPaneContainer sample demonstrates what SplitPane is.
As for StackPanel & Panel, see the docs:
Basic Layout and Panel · rds1983/Myra Wiki (github.com)
StackPanel Layout · rds1983/Myra Wiki (github.com)

Is there a way to set a widget’s position by its center’s coordinates instead of its upper left corner’s coordinates?

I know I can set a widget’s Left property to something like center.x - widget.Bounds.Width / 2, but since a widget only update its size when render, the widget.Bounds will only update until the next frame. For example, if I change a label’s text when updating, its size property won’t be recalculated until it’s drawn. So, there will be a frame where the label’s size has already changed but its position has not yet been updated.

This is important to me because I’m trying to use Myra to draw a hud for my game. For example, I want to place a label right above a character. Or maybe using a GUI library to draw a hud isn’t really a good choice?


I just found that the method UpdateArrange can force recalculate widgets’ size or other properties, and it’s public. Sorry for bothering.