Unigine integration
Posted: 25 Mar 2018, 14:33
Hi,
A few weeks back I was implemented NoesisGUI 2.1.0 RC3 into Unigine 2.6.1.1 engine (viewtopic.php?f=3&t=1170&p=7700&hilit=unigine#p7700).
In the middle of time I updated NoesisGUI into final 2.1 release. I created a base library project to integrate NoesisGUI 2.1 with Unigine 2.6.1.1 (it works from Starter version).
I would like to share it with you. But I hope that Noesis team will check and improve it. I give all rights for Noesis Team to use, modify and share it (just take it and make it better and share for everyone).
After update to 2.1 release version and migrate implementation from main app file to AppSystemLogic in Unigine (to work GUI in Editor2 as I described later in this topic) there is a problem that each rendered frame of NoesisGUI contains last frame too, I think soo. The problem is that transparency object of NoesisGUI is transparent just for a few first frames and then stay more opaque and full opaque at last. Also when I hide Noesis gui object it is still displayed in the GUI (as set Visibility as Collapsed for Grid object). So I need a help to resolve it as well. You will see it when you will add simple xaml file with transparent object in it.
I attach this project. Because of license agreement I do not include D3D11RenderDevice.h, D3D11RenderDevice.cpp and Render.D3D11RenderDevice.cpp files which you can add from NoesisGUI download pack (such files are not modified).
To use it just add this project to your solution in C++ of Unigine project. You have 2 option to use it:
1. in main.cpp file (but it will not work in Editor2):
2. or in AppSystemLogic file:
Example of us this library to load a new gui and implement button action:
A few weeks back I was implemented NoesisGUI 2.1.0 RC3 into Unigine 2.6.1.1 engine (viewtopic.php?f=3&t=1170&p=7700&hilit=unigine#p7700).
In the middle of time I updated NoesisGUI into final 2.1 release. I created a base library project to integrate NoesisGUI 2.1 with Unigine 2.6.1.1 (it works from Starter version).
I would like to share it with you. But I hope that Noesis team will check and improve it. I give all rights for Noesis Team to use, modify and share it (just take it and make it better and share for everyone).
After update to 2.1 release version and migrate implementation from main app file to AppSystemLogic in Unigine (to work GUI in Editor2 as I described later in this topic) there is a problem that each rendered frame of NoesisGUI contains last frame too, I think soo. The problem is that transparency object of NoesisGUI is transparent just for a few first frames and then stay more opaque and full opaque at last. Also when I hide Noesis gui object it is still displayed in the GUI (as set Visibility as Collapsed for Grid object). So I need a help to resolve it as well. You will see it when you will add simple xaml file with transparent object in it.
I attach this project. Because of license agreement I do not include D3D11RenderDevice.h, D3D11RenderDevice.cpp and Render.D3D11RenderDevice.cpp files which you can add from NoesisGUI download pack (such files are not modified).
To use it just add this project to your solution in C++ of Unigine project. You have 2 option to use it:
1. in main.cpp file (but it will not work in Editor2):
Code: Select all
#include "NoesisGUI.h"
#ifdef _WIN32
int wmain(int argc, wchar_t *argv[]) {
#else
int main(int argc, char *argv[]) {
#endif
Unigine::Engine* pEngine = Unigine::Engine::init(UNIGINE_VERSION, argc, argv);
...
NoesisGUI* noesisGUI = &NoesisGUI::getInstance();
noesisGUI->Initialize();
while (!pEngine->isDone())
{
noesisGUI->Update();
pEngine->update();
pEngine->render();
noesisGUI->Render();
pEngine->swap();
//noesisGUI->Clear();
pEngine->swap();
}
noesisGUI->Shutdown();
...
return 0;
}
2. or in AppSystemLogic file:
Code: Select all
#include "NoesisGUI.h"
NoesisGUI* noesisGUI;
int AppSystemLogic::init() {
{
noesisGUI = &NoesisGUI::getInstance();
noesisGUI->Initialize();
}
int AppSystemLogic::update() {
noesisGUI->Update();
return 1;
}
int AppSystemLogic::render() {
noesisGUI->Render();
return 1;
}
Code: Select all
NoesisGUI* noesisGUI = &NoesisGUI::getInstance();
noesisGUI->LoadUI("my_file.xaml");
// garaz
Noesis::Button* button1 = noesisGUI->xaml->FindName<Noesis::Button>("button_quit");
button1->Click() += [](BaseComponent* sender, const RoutedEventArgs& args)
{
App::get()->exit();
};
...