neborak_a Posted October 5, 2018 Share Posted October 5, 2018 How can I change the system menu, which is called by pressing ESC? I would like to show the user my menu. In order to check the button pressing I use this function: bool Utils::checkKeyPressed(int _key) { if (Console::get()->getActivity()) { return false; } if (App::get()->getKeyState(_key)) { App::get()->clearKeyState(_key); return true; } return false; } This feature correctly displays the pressing of many keys but does not operate when pressing ESC void MainGui::update() { if (!gui) { init(); } if(Utils::checkKeyPressed(App::KEY_ESC)) { static int i = 0; Log::message("Esc pressed %d\n", i++); } } What am I doing wrong? How to catch the ESC key pressing and cancel the display of the standard system menu? Link to comment
silent Posted October 8, 2018 Share Posted October 8, 2018 Hi, There is a section in core system script that handles the ESC key pressing (data\core\scripts\system\system.h). You can pass MENU_USER define on engine start-up to disable menu by ESC. Please, refer also to the following forum threads: https://developer.unigine.com/forum/topic/2896-solved-how-to-disable-the-esc-key-menu/ https://developer.unigine.com/forum/topic/3029-solved-how-to-disable-the-cursor-hidden-and-option-dialog/ Thanks! 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
neborak_a Posted October 8, 2018 Author Share Posted October 8, 2018 (edited) I pass -extern_define MENU_USER as argument to engine and this helps to handle ESC button. But how i can show/hide this system menu from my cpp code? Can I modify system menu? I try modify <sdk\data\core\scripts\system\system.h>, but it has no effect. Edited October 8, 2018 by neborak_a Link to comment
Recommended Posts