MonoGame 3.8 and Noesis GUI 3.1.1 integration example
Posted: 03 Oct 2021, 17:49
Hello
The awsome MonoGame integration project from AtomicTorchStudios (https://github.com/AtomicTorchStudio/No ... ameWrapper) is not directly working with the current Noesis GUI version (it was implemented for version 2). Even after adapting everything for the latest version, I got issues with using fonts and some other things.
That's why I decided to first create a minimal example of a Noesis GUI 3 integration for the latest MonoGame version for DirectX. The minimal example is more or less the same as it was provided for pure C# inside the official Noesis Tutorial Samples (https://github.com/Noesis/Tutorials/tre ... ionSharpDX) just that it integrates with MonoGame.
For the mouse event handling and the render state recovery, I used heavenly the code from the older integration provided from AtomicTorchStudios.
In the end the example is not especially fancy or advanced, it should be as simple as possible to give a good and easy to understand starting point for a more advanced integration.
You can find it here: https://github.com/Netzeband/noesis_monogame
Since I'm not an expert for DirectX, I still have some questions:
1.) The old integration from AtomicTorchStudio (Noesis GUI 2) has saved and restored the render state several times: When the device for Noesis GUI was created, during the offscreen render-step and also for the real render step. When I was looking at your documentation (https://www.noesisengine.com/docs/Gui.C ... Guide.html) it seams that this is only needed for the offscreen-render-step. Is this correct, or did I understand it wrong?
2.) Is there a list of render-state variables for DirectX, which are changed by Noesis GUI? The old example for Noesis GUI 2, from AtomicTorchStudios stored and resets a very huge list of variables. But the official DirectX integration from noesis just restores little variables. What is the right approach here?
3.) Unrelated to DirectX. In all C# examples of Noesis GUI, I see that the entry-point is decorated with the [STAThread] attribute. Since this attribute might lead to issues in other usecases, i was wondering if this is really necessary for Noesis GUI?
I hope my code example helps anyone who also want to integrate Noesis GUI with MonoGame. Maybe some time later I will provide a more advance implementation with real XAML providers, hot reloading, keyboard event handling and so on.
The awsome MonoGame integration project from AtomicTorchStudios (https://github.com/AtomicTorchStudio/No ... ameWrapper) is not directly working with the current Noesis GUI version (it was implemented for version 2). Even after adapting everything for the latest version, I got issues with using fonts and some other things.
That's why I decided to first create a minimal example of a Noesis GUI 3 integration for the latest MonoGame version for DirectX. The minimal example is more or less the same as it was provided for pure C# inside the official Noesis Tutorial Samples (https://github.com/Noesis/Tutorials/tre ... ionSharpDX) just that it integrates with MonoGame.
For the mouse event handling and the render state recovery, I used heavenly the code from the older integration provided from AtomicTorchStudios.
In the end the example is not especially fancy or advanced, it should be as simple as possible to give a good and easy to understand starting point for a more advanced integration.
You can find it here: https://github.com/Netzeband/noesis_monogame
Since I'm not an expert for DirectX, I still have some questions:
1.) The old integration from AtomicTorchStudio (Noesis GUI 2) has saved and restored the render state several times: When the device for Noesis GUI was created, during the offscreen render-step and also for the real render step. When I was looking at your documentation (https://www.noesisengine.com/docs/Gui.C ... Guide.html) it seams that this is only needed for the offscreen-render-step. Is this correct, or did I understand it wrong?
2.) Is there a list of render-state variables for DirectX, which are changed by Noesis GUI? The old example for Noesis GUI 2, from AtomicTorchStudios stored and resets a very huge list of variables. But the official DirectX integration from noesis just restores little variables. What is the right approach here?
3.) Unrelated to DirectX. In all C# examples of Noesis GUI, I see that the entry-point is decorated with the [STAThread] attribute. Since this attribute might lead to issues in other usecases, i was wondering if this is really necessary for Noesis GUI?
I hope my code example helps anyone who also want to integrate Noesis GUI with MonoGame. Maybe some time later I will provide a more advance implementation with real XAML providers, hot reloading, keyboard event handling and so on.