karim.salama Posted February 13, 2023 Share Posted February 13, 2023 Hi all, We're currently upgrading our codebase to be able to use the latest version of the Unigine SDK (2.16.1). And I've just realized that the Unigine::Controls::setButtonReleaseCallback function in no longer part of the Unigine SDK. In C++, I could Unigine::Input::addCallback(Unigine::Input::CALLBACK_MOUSE_UP, Unigine::MakeCallback(...));. But in my case, this is implemented in UnigineScript, and it turns out that the addCallback function is not available in UnigineScript. Is there any workaround that adds an immediate callback upon a mouse event in UnigineScript without making an event filter function? We are totally aware that the UnigineScript language is kind of deprecated and we aim to port all our existing scripts into C++, but first, we must port our current build to the latest version of the Unigine SDK. Thanks in advance, Karim Link to comment
karpych11 Posted February 15, 2023 Share Posted February 15, 2023 Hello, The callback setup functions are still available in the script. Here is an example that works in version 2.16.1: int on_button_press(int button) { log.message("press: %d\n", button); return 0; } int on_button_release(int button) { log.message("release: %d\n", button); return 0; } int init() { engine.controls.setButtonPressCallback(functionid(on_button_press)); engine.controls.setButtonReleaseCallback(functionid(on_button_release)); return 1; } 1 Link to comment
karim.salama Posted February 15, 2023 Author Share Posted February 15, 2023 Hi karpych11, Thanks! I didn't know that this function still exists in the SDK. If you search for "setButtonReleaseCallback" in the documentation, you won't get any results. Link to comment
silent Posted February 15, 2023 Share Posted February 15, 2023 Yep, UnigineScript documentation is not updated anymore (as it was marked as deprecated), but methods may be still available. 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