christian.wolf2 Posted November 15, 2019 Share Posted November 15, 2019 Hello, for shipping one of the projects I worked for, we needed to customize the application startup window. Goal is to modify the splash screen and window title+logo to fit our custom needs. Currently, there are only two ways (I have discovered so far). First is changing the application setting in the AppSystem-Class but as mentioned as in the documentation, the default configuration will be loaded first and any customizations afterwards. For that case the documentation links to the page to write your own custom App-class. But for this second way, not only the functions for rendering/updating needs to be modified, but all other virtual ones (Mouse, AppText e.g.). This implementation is perfect to integrate into other projects (like the samples shown for QT and SDL) but not for a simple modification of above mentioned use-case. Are there any other to improvements that can be made for the C++-Customization of the Application before startup? Best Christian Link to comment
fox Posted November 18, 2019 Share Posted November 18, 2019 Hi Christian, Have you tried something like this (seems to be enough for your case): // AppSystemLogic.cpp #include <UnigineSplash.h> #include <UnigineApp.h> #include <UnigineImage.h> // ... using namespace Unigine; int AppSystemLogic::init() { // ... // define new transform for splash screen Unigine::Math::vec4 transform = Unigine::Math::vec4(1.0f, 1.0f, 0.0f, 0.0f); // get the splash and app instances (as they're designed as singletons) Unigine::Splash* splash = Unigine::Splash::get(); Unigine::App* app = Unigine::App::get(); // set a custom icon for the application window ImagePtr icon = Image::create("my_window_icon.png"); app->setIcon(icon->getPixels2D(), icon->getWidth()); // set a custom title for the application window app->setTitle("Custom Window Title"); // set transform to the system and world splash screens splash->setSystemTransform(transform); splash->setWorldTransform(transform); // compute the aspect ratio to show corresponding texture float aspect_ratio = (float)app->getWidth() / (float)app->getHeight(); // if the aspect ratio is 4:3 show these splash screens // during application and world load if (aspect_ratio < 1.5f) { splash->setSystem("splash_4x3_system.png"); splash->setWorld("splash_4x3_world.png"); } else { // if the aspect ratio is 16:9 show these splash screens // during application and world load splash->setSystem("splash_16x9_system.png"); splash->setWorld("splash_16x9_world.png"); } return 1; } Hope this helps! Thanks! 1 Link to comment
christian.wolf2 Posted November 18, 2019 Author Share Posted November 18, 2019 Hello fox, thanks for the reply. This indeed solved the problem about the splashscreen. But the window title still remains unchanged until the AppSystemLogic-class is called and is therefor visible for 2-3 seconds. Regards Christian Link to comment
fox Posted November 19, 2019 Share Posted November 19, 2019 Hi Christian, You're welcome! As for the window title, without a custom App class instance passed, the default title is set inside Engine::init() and therefore is displayed during the Engine initialization phase. So, I'm afraid there is no other simple option except for the custom App-class. Best regards! Link to comment
christian.wolf2 Posted November 19, 2019 Author Share Posted November 19, 2019 Hi fox, 2 hours ago, fox said: As for the window title, without a custom App class instance passed, the default title is set inside Engine::init() and therefore is displayed during the Engine initialization phase. So, I'm afraid there is no other simple option except for the custom App-class. not a problem that there isn't an easy out-of-the-box-solution. Thats why I am posting it to the suggestion forum. :) I am just wondering how the other users handle that topic when shipping their solution to the end user. Maybe if we can add an additional parameter to the bat file as a startup-configuration or just simply using the project name would be a better approach. Best Christian Link to comment
silent Posted November 20, 2019 Share Posted November 20, 2019 I've created a feature request regarding this (right now with a minor priority) in our internal bug tracker. I hope that it should be a easy feature to implement :) How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
davide445 Posted January 14, 2020 Share Posted January 14, 2020 Hi @silent this is a minor feature but important for showing to customers our work. Any news to got this implemented? Being easy to do need to be fast, maybe as minor 2.10 release :-) Link to comment
silent Posted January 14, 2020 Share Posted January 14, 2020 The current architecture and logics system works that way - when AppSystemLogic::init() hits the engine itself already launched and default title is used. New approach will require some research and that may shift the feature release to the Q2 2020. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
silent Posted March 16, 2020 Share Posted March 16, 2020 Since 2.11 version it's now possible to set up the engine title on init (without delay): Unigine::EnginePtr engine(UNIGINE_VERSION, "Custom Window Title", argc, argv); App::setTitle will work as before. 1 How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
Recommended Posts