videogamers0 / mgui Goto Github PK
View Code? Open in Web Editor NEWUI framework for MonoGame game engine.
License: MIT License
UI framework for MonoGame game engine.
License: MIT License
I have a exception KeyNotFoundException when i using a special character like "é" or "è". I have set the spritefont end character region to 383. Monogame displays them however by modifying the spritefont.
Help would be appreciated thank you very much.
I wasnt sure how to contact you directly, I am trying to design the layout of my UI using the xaml designer in visual studio 2022, but visual studio is having some issues and puts a message "SomePage.xaml cannot be edited in the Design View." I was wondering if there were any tips to get this working? Or if you have any suggestions on a good designer, I am all ears! Thanks! I see on your profile you are in Florida, nice I am in Palm Bay / Melbourne area myself.
I tried your library with the latest monogame in visual studio 2022, but the projects refuse to build. Here is the output for the test project I tried making:
Severity Code Description Project File Line Suppression State
Error MSB3073 The command "dotnet C:\Users\DankM\.nuget\packages\monogame.content.builder.task\3.8.0.1641\build\\..\tools\netcoreapp3.1\any\mgcb.dll /quiet /@:"C:\Users\DankM\source\repos\Erm\MGUI\MGUI.Shared\Content\MGUI.Shared.Content.mgcb" /platform:DesktopGL /outputDir:"C:/Users/DankM/source/repos/Erm/MGUI/MGUI.Shared/Content/bin/DesktopGL/MGUI.Shared.Content" /intermediateDir:"C:/Users/DankM/source/repos/Erm/MGUI/MGUI.Shared/Content/obj/DesktopGL/MGUI.Shared.Content" /workingDir:"C:/Users/DankM/source/repos/Erm/MGUI/MGUI.Shared/Content/"" exited with code -2147450730. MGUI.Shared C:\Users\DankM\.nuget\packages\monogame.content.builder.task\3.8.0.1641\build\MonoGame.Content.Builder.Task.targets 138
Error MSB3073 The command "dotnet C:\Users\DankM\.nuget\packages\monogame.content.builder.task\3.8.0.1641\build\\..\tools\netcoreapp3.1\any\mgcb.dll /quiet /@:"C:\Users\DankM\source\repos\Erm\Erm\Content\Content.mgcb" /platform:DesktopGL /outputDir:"C:/Users/DankM/source/repos/Erm/Erm/Content/bin/DesktopGL/Content" /intermediateDir:"C:/Users/DankM/source/repos/Erm/Erm/Content/obj/DesktopGL/Content" /workingDir:"C:/Users/DankM/source/repos/Erm/Erm/Content/"" exited with code -2147450730. Erm C:\Users\DankM\.nuget\packages\monogame.content.builder.task\3.8.0.1641\build\MonoGame.Content.Builder.Task.targets 138
Error MSB3073 The command "dotnet C:\Users\DankM\.nuget\packages\monogame.content.builder.task\3.8.0.1641\build\\..\tools\netcoreapp3.1\any\mgcb.dll /quiet /@:"C:\Users\DankM\source\repos\Erm\MGUI\MGUI.Core\Content\MGUI.Core.Content.mgcb" /platform:DesktopGL /outputDir:"C:/Users/DankM/source/repos/Erm/MGUI/MGUI.Core/Content/bin/DesktopGL/MGUI.Core.Content" /intermediateDir:"C:/Users/DankM/source/repos/Erm/MGUI/MGUI.Core/Content/obj/DesktopGL/MGUI.Core.Content" /workingDir:"C:/Users/DankM/source/repos/Erm/MGUI/MGUI.Core/Content/"" exited with code -2147450730. MGUI.Core C:\Users\DankM\.nuget\packages\monogame.content.builder.task\3.8.0.1641\build\MonoGame.Content.Builder.Task.targets 138
I even tried downgrading the monogame version in the main project to match the mgui version, but still no luck. I also tried fiddling with the .NET core versions, again no luck.
Any help would be great!
There are currently 2 bugs related to how MGComponent<TElementType>
instances are measured:
Content
Suppose you created a control called MGHeaderFooterPresenter
which was structured something like this (but using MGComponent<TElementType>
to apply the layout instead of actually using an MGDockPanel
):
<DockPanel>
<ContentPresenter Name="HeaderPresenter" Dock="Top" />
<ContentPresenter Name="FooterPresenter" Dock="Bottom" />
<ContentPresenter Name="ContentPresenter" />
</DockPanel>
If the HeaderPresenter
and FooterPresenter
are both components of the control, the total width of the control would need to be:
int Width = Max(HeaderWidth, FooterWidth, ContentWidth);
MGComponent<TElementType>
allows a component to share its width with the control's Content
, but does NOT allow it to share width with other components inside that same control. So you end up with an incorrect measurement that's something like this:
int Width = Max(Sum(components that share width with content), ContentWidth);
Currently, the only control that this seems to affect is MGListBox
which has 2 components, 1 for the title header, and 1 for the rows of content. MGListBox
intentionally does not measure the title's width when measuring itself in order to avoid this bug (which in turn means the MGListBox
might not be wide enough in cases where the title would normally be wider than the rows)
Padding
If the component does not use the owner's Padding
for its measurements (MGComponentBase.UsesOwnersPadding = false
, such as for the tab headers of an MGTabControl
where the Padding
of the MGTabControl
only affects the content region), then the measurement logic may incorrectly add the Padding
to the end result in cases where it shouldn't.
Suppose we're measuring an MGTabControl
where the tab headers are docked to the top. If the tab headers are 100px wide, the tab content is 50px wide, and the Padding
is 20px, the total width should be:
int Width = Max(100, 50+20);
But the Padding
is being automatically applied to the result before any components are measured, so we currently end up with:
int Padding = 20;
int UnpaddedWidth = Max(100, 50);
int TotalWidth = Padding + UnpaddedWidth;
Meaning we get an incorrect result in cases where the component shares width with the content, AND the component is wider than the content, AND the component does not respect the control's Padding
.
To demonstrate this issue, create a window with the following layout:
<Window xmlns="clr-namespace:MGUI.Core.UI.XAML;assembly=MGUI.Core"
SizeToContent="WidthAndHeight" WindowStyle="None">
<TabControl TabHeaderPosition="Left" Padding="20">
<TabItem Header="Tab Header">
<Rectangle Fill="Red" Height="10" Width="10" />
</TabItem>
</TabControl>
</Window>
Result:
The TabControl
ends up being 42px too tall. (40px of the Padding
's Top+Bottom, and 2px of the BorderThickness
Top+Bottom)
To fix these bugs, the following methods should be refactored:
MGElement.MeasureSelf(Size, Thickness)
MGElement.UpdateLayout(Rectangle)
MGComponentBase.Arrange(Thickness)
After fixing these bugs, we should also modify MGListBox<TITemType>
's constructor to set the title component's ConsumesLeftSpace
to true
since listboxes currently don't account for the title bar's width when measuring their entire width:
Before bugfix:
this.TitleComponent = new(TitleBorder, true, false, false, true, false, false, false,
(AvailableBounds, ComponentSize) => ApplyAlignment(AvailableBounds, HorizontalAlignment.Stretch, VerticalAlignment.Top, ComponentSize.Size));
After bugfix:
this.TitleComponent = new(TitleBorder, true, false, true, true, false, false, false,
(AvailableBounds, ComponentSize) => ApplyAlignment(AvailableBounds, HorizontalAlignment.Stretch, VerticalAlignment.Top, ComponentSize.Size));
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.