If the dimensions of the 'stage' change (the main window is resized) - how do you update imgui to reflect this? It seems to clip to the original dimensions.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
If the dimensions of the 'stage' change (the main window is resized) - how do you update imgui to reflect this? It seems to clip to the original dimensions.
In short:
local IO = imgui:getIO()
IO:setDisplaySize(1280, 720)
-- if scale mode is not "noScale", but you want to ignore built-in scaling:local minX, minY, maxX, maxY = application:getLogicalBounds()local sx = application:getLogicalScaleX()local sy = application:getLogicalScaleY()
imgui:setScale(1/ sx, 1/ sy)
imgui:setPosition(minX, minY)local IO = imgui:getIO()
IO:setDisplaySize((maxX - minX)* sx, (maxY - minY)* sy)
Font scaling:
IO:setFontGlobalScale(number)
Actually, there is a hidden listener for window resize that suppose to set correct imgui display size but... It does not work for whatever reason. You can remove it using
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
When I send to Android, if I touch the screen then it crashes (that's without my resize code) - is this a known issue?
(desktop and html5 work fine)
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Chatted to @hgy29 about it, he suggests it is 'Probably touch handling issue, but mouse ok' - what do you think @rrraptor ?
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Tried ImGui.new(false, false, false) and then it works.
Also tried imgui:removeAllListeners() and that also works.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
I'll let you know once @hgy29 makes a new build...
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
It's odd though that removing the existing listeners fixed the problem? You would think that it would have worked previously, but touch would just be missing?
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
I need to create a pull request, so he dont need to copy pasta my code
Also you can use this useful feature:
local IO = ui:getIO()
IO:addConfigFlags(ImGui.ConfigFlags_IsTouchScreen)-- enable touch padding-- set paddinglocal Style = ImGui:getStyle()
Style:setTouchExtraPadding(10, 10)-- expands all hitboxes, I guess
With imgui, on android, when the screen is touched, it says:
"Incorrect button index stack traceback:"
Then resent back to the player, waiting for a new upload - which would be a pretty nice thing to add as a API function @hgy29 ...
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
@rrraptor, I just had a look at your changes and I spotted two issues: - First if the project has 'touch to mouse' or 'mouse to touch' enabled, they you'll end up handling the events twice. Since you handle touch natively, you should check if the event was a 'converted' one or not - Second, and maybe Android specific, it can happen that some touch move events are reported without any finger (weird!), and Gideros translates this to mouse_move event without buttons, which causes the crash @SinisterSoft is experiencing.
I think both issues can be fixed at the same time, by disregarding converted events. Trouble is there doesn't seem to be a way to distinguish them currently, so maybe do one of the following things: - Add a flag to tell if touch or mouse should be listened to (and let the developer decide) - Do what is appropriate automatically based on the platform - Handle the case where a button value of 0 (GINPUT_NO_BUTTONS) is given in MOUSE_MOVE, maybe processing it as it to a MOUSE_HOVER instead
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
In order to tell ImGui which mouse button is pressed you need to set MouseDown value. Gideros buttons are: - 0: none - 1: left - 2: right - 4: middle - 8: extra button - 16: extra button
ImGui: - 0: left - 1: right - 2: middle - 3: extra button (unused in my binding) - 4: extra button (unused in my binding)
probably it does not matter, but don't forget about pen behaviour to work well too.
Which event type is that?)
I can add custom function, so you can fill correct values for ImGui on your own. And if something went wrong, you can debug the issue without recompiling the plugin
whatever, i don't exactly understand your idea but probably it's useful.
in any case i just remember this issue still being open: https://github.com/gideros/gideros/issues/228 and sounds like the current issue with imgui might somehow breed another problem related to pen events, so i thought i shall warn you.
Ideally, both should work - as you can plug a mouse into Android - or they may be running on Chrome. You could also have touch on Windows.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
If @hgy29 gets time to make a test built, I'll test it asap.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
@hgy29 I have a problem with something (sound weird, sorry ) Ive changed fonts API a little bit to be able to add custom glyph ranges.
Im using MaterialIcons font for icons (you can check glyphs here: https://fontdrop.info/). In order to add specific icons to ImGui I decided to stick with this structure:
local FontAtlas =io:getFonts()local icons = FontAtlas:addFont("MaterialIcons-Regular.ttf", 16, {
glyphs ={
ranges ={-- multiple ranges{0xE3A2,0xE3A5},
--ImGui.GlyphRanges_XXX -- any set of available constants},
chars ={-- single char codes
0xE872, -- trash
0xE8F4, -- on
0xE8F5, -- off
0xE3C9, -- pen
0xE161, -- save
0xE05E, -- new
0xE3A5, -- particles
0xE14C, -- X},
},
oversampleH =2,
oversampleV =1,
glyphOffsetX = -1,
glyphOffsetY =4,
pixelSnapH =true,
mergeMode =true,
})
FontAtlas:bake()-- ranges structure is a table where if value is a table then it is a custom range, if number then it is GlyphRanges_XXX constant, otherwise - error.
The problem is that my code SOMETIMES works and sometimes it doesn't. For example, I launch a project and see "?" Instead of icons, and sometimes everything is fine. Maybe there is a problem somewhere in the loading of glyphs? Or that "ImGui" is a static library and when restarting the project, you need to clear the memory, but I do not quite understand where in the code it should be done.
I had a quick llok and didn't find any defect in your code that could explain the problem. The checks on lines 7634 and 7654, don't test the right index (should be -1), but that's not the problem. Maybe, like you say, an initialization issue. I will check a bit deeper, but you know the code better than me
Comments
https://deluxepixel.com
Likes: MoKaLux, SinisterSoft
I noticed that I had to add 1 to the max width in order to make it perfect...
Here is my code:
Likes: MoKaLux
https://deluxepixel.com
(desktop and html5 work fine)
https://deluxepixel.com
https://deluxepixel.com
Also tried imgui:removeAllListeners() and that also works.
https://deluxepixel.com
https://github.com/MultiPain/Gideros_ImGui/commit/c024f704497bf8aef5c1da3cfd04f4e2839823a4
I guess this should fix the problem.
Likes: SinisterSoft
https://deluxepixel.com
https://deluxepixel.com
Also you can use this useful feature:
Likes: SinisterSoft
https://github.com/gideros/gideros/pull/500
@hgy29 added "touchevent" to make files and others.
Likes: SinisterSoft, hgy29
With imgui, on android, when the screen is touched, it says:
"Incorrect button index
stack traceback:"
Then resent back to the player, waiting for a new upload - which would be a pretty nice thing to add as a API function @hgy29 ...
https://deluxepixel.com
- First if the project has 'touch to mouse' or 'mouse to touch' enabled, they you'll end up handling the events twice. Since you handle touch natively, you should check if the event was a 'converted' one or not
- Second, and maybe Android specific, it can happen that some touch move events are reported without any finger (weird!), and Gideros translates this to mouse_move event without buttons, which causes the crash @SinisterSoft is experiencing.
I think both issues can be fixed at the same time, by disregarding converted events. Trouble is there doesn't seem to be a way to distinguish them currently, so maybe do one of the following things:
- Add a flag to tell if touch or mouse should be listened to (and let the developer decide)
- Do what is appropriate automatically based on the platform
- Handle the case where a button value of 0 (GINPUT_NO_BUTTONS) is given in MOUSE_MOVE, maybe processing it as it to a MOUSE_HOVER instead
What do you think ?
Likes: SinisterSoft
https://stackoverflow.com/questions/16649830/proximity-sensor-on-galaxy-s4-air-gestures
https://deluxepixel.com
https://github.com/gideros/gideros/blob/5fa2ea68f0cee907e5271359a36e010e261c4939/plugins/imgui/source/Common/imgui_bindings.cpp#L144
In order to tell ImGui which mouse button is pressed you need to set MouseDown value. Gideros buttons are:
- 0: none
- 1: left
- 2: right
- 4: middle
- 8: extra button
- 16: extra button
ImGui:
- 0: left
- 1: right
- 2: middle
- 3: extra button (unused in my binding)
- 4: extra button (unused in my binding) Already there :
https://github.com/gideros/gideros/blob/5fa2ea68f0cee907e5271359a36e010e261c4939/plugins/imgui/source/Common/imgui_bindings.cpp#L1185
Just pass true/false to ImGui.new() to enable/disable listeners.
Fragmenter - animated loop machine and IKONOMIKON - the memory game
I can add custom function, so you can fill correct values for ImGui on your own. And if something went wrong, you can debug the issue without recompiling the plugin
in any case i just remember this issue still being open:
https://github.com/gideros/gideros/issues/228
and sounds like the current issue with imgui might somehow breed another problem related to pen events, so i thought i shall warn you.
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Likes: SinisterSoft
https://deluxepixel.com
Idk if problem is fixed, but I have added new functions, so you can use them to handle mouse/touch inputs by yourself.
Example:
imGui constructor is changed
toLikes: MoKaLux, SinisterSoft
https://deluxepixel.com
Works this way:
Likes: MoKaLux
Likes: hgy29, keszegh, SinisterSoft, MoKaLux
Ive changed fonts API a little bit to be able to add custom glyph ranges.
Im using MaterialIcons font for icons (you can check glyphs here: https://fontdrop.info/). In order to add specific icons to ImGui I decided to stick with this structure:
So, can you please check the binding for this function?) Especially table parsing: https://github.com/MultiPain/Gideros_ImGui/blob/bd8b290fcecc43dbc6627590fcfe1d9b2b2e9583/main.cpp#L7700
"ranges" table parse:
https://github.com/MultiPain/Gideros_ImGui/blob/bd8b290fcecc43dbc6627590fcfe1d9b2b2e9583/main.cpp#L7651
Maybe its me, who messed up with lua stack
Here it works:
Here, it does not: