I had no luck so far, I hope that someone else can try this project and confirm my experience.
This is a very simple project that makes use only of the imgui demo window, and I get the same error message that I have in every other project I tried using imgui on android.
They work in windows desktop player, but when I run them on android player they stop working as soon as I touch the screen; I even tried using a bluetooth mouse on the phone: as soon as I click the left button the player crashes
my workaround is that i propagate the mouse/touch events manually to the imgui within ontouches begin/move/end/cancel events, and there i do something like this to change value 0 to 1 before sending to imgui:
if event.touch.mouseButton==0then event.touch.mouseButton=1end
IO:setMouseDown(event.touch.mouseButton, true)
(you need to disable automatic handling of mouse events to make this work, that is, you should initialize the gui like this:
I found out that I was using gideros TOUCHES_BEGIN/END events, while I had to use ImGui events, and now it is almost working.
-EDIT: partially answered my own question, removed the second question to keep forum cleaner. I cannot remove the not working attached example, therefore I will make a new post.
The attached file is an almost working example for imgui android touch: buttons are selected on the first click/touch and need a second click/touch to act. @rraptor@keszegh do you know if I can change this behaviour and let them act as soon as they are pressed?
Thank you @keszegh this indeed works in a clean project, so my issue has probably to do with how I built my imgui based app until now It's faster to rewrite it than trying to discover what the issue was exactly.
For the records my ui and IO instances were returned through a function from a local variable instanced in another lua file, but this approach didn't show any issue until now.
i'm glad it works. and also hope that this strange thing with event.touch.mouseButton returning 0 will be corrected. overall, imgui is really cool (along with gideros).
i'm glad it works. and also hope that this strange thing with event.touch.mouseButton returning 0 will be corrected. overall, imgui is really cool (along with gideros).
What do you want it to return instead of 0? I may have a look if I understand the issue, do you have gideros forum threads where you explain this?
Comments
This is a very simple project that makes use only of the imgui demo window, and I get the same error message that I have in every other project I tried using imgui on android.
They work in windows desktop player, but when I run them on android player they stop working as soon as I touch the screen; I even tried using a bluetooth mouse on the phone: as soon as I click the left button the player crashes
thank you
https://forum.giderosmobile.com/discussion/8399/imgui-new-thread/p20
Comment 67327
my workaround is that i propagate the mouse/touch events manually to the imgui within ontouches begin/move/end/cancel events, and there i do something like this to change value 0 to 1 before sending to imgui:
Likes: pie, MoKaLux
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Fragmenter - animated loop machine and IKONOMIKON - the memory game
-EDIT: partially answered my own question, removed the second question to keep forum cleaner. I cannot remove the not working attached example, therefore I will make a new post.
@rraptor @keszegh do you know if I can change this behaviour and let them act as soon as they are pressed?
Likes: pie, MoKaLux
Fragmenter - animated loop machine and IKONOMIKON - the memory game
For the records my ui and IO instances were returned through a function from a local variable instanced in another lua file, but this approach didn't show any issue until now.
and also hope that this strange thing with event.touch.mouseButton returning 0 will be corrected.
overall, imgui is really cool (along with gideros).
Fragmenter - animated loop machine and IKONOMIKON - the memory game
I may have a look if I understand the issue, do you have gideros forum threads where you explain this?
Likes: pie
Fragmenter - animated loop machine and IKONOMIKON - the memory game