dear giderians, I would like to start a new thread regarding imgui and its implementation in gideros. The old imgui thread is a bit outdated imho. Let's start fresh and I will try to update the wiki as we gather more tips and use case on how to use imgui in gideros.
I'm very busy right now, so I don't have time to update the plugin. In general, to work with "ImGui" you only need a few lines:
require"ImGui"
ui = ImGui.new()
stage:addChild(ui)-- to add fonts use this example: github.com/MultiPain/Gideros_ImGui#minimal-example
stage:addEventListener("enterFrame", function(e)
ui:newFreame(e)-- paste ur code here --
ui:render()
ui:endFrame()end)-- to resize GUI window you can add a listener like that:
stage:addEventListener("applicationResize", function()local minX, minY, maxX, maxY = application:getLogicalBounds()local W, H = maxX - minX, maxY - minY
ui:setPosition(minX, minY)
ui:getIO():setDisplaySize(W, H)end)
If you do not know how to do something, then first look at the source code "imgui_demo.cpp". To convert code from C++ you need just a little bit of knowledge of C/C++. The function names are completely identical (except that the first letter must be in lowercase). If you don't find something that you need, you can ask me, or contact the discord community.
thank you rrraptor for all the links that is a very good start to get us going.
Rrraptor you already did an enormous amount of work and it is now our turn to contribute
PS: you don't need to update ImGui. Imho when we have a stable plugin we don't need to update it until someone really needs a new feature then we might update the plugin
@rrraptor I was trying to add an image to a drawlist, but I'm not sure how to do it. I know there is an add image function but an example would be great.
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 was trying to add an image to a drawlist, but I'm not sure how to do it. I know there is an add image function but an example would be great.
Now I just need the button widths to be able to be a set width..
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
But that doesn't work for me, I have to put it in the enterFrame to see the light style!?
It works on very first launch, but breaks after restart. I guess that is because Im not cleaning memory correctly...but not sure. I know how fix it, but memory leak is still possible.
@rrraptor If you get 5 mins, can you look to see if there is a way of setting the button width (rather than it being automatic) - it would make things much neater.
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 If you get 5 mins, can you look to see if there is a way of setting the button width (rather than it being automatic) - it would make things much neater.
It will take more than 5 mins Fixed this 3 for now. Image size and button size now separated arguments.
@rrraptor Centering is one option, how about left or right justify too? (eg menu buttons would usually be left justified)
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 Centering is one option, how about left or right justify too? (eg menu buttons would usually be left justified)
For this 3 there is an anchor point that you can set. For text buttons there will be a direction argument (Left or Right align image, and anchor point for text ).
colorButton I don't really understand this button So it displays a color and shows some info about that color. Can we click on it and does it respond to clicks?
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
on the bottom right 3-tuple of buttons i guess the text should be aligned right and not the image.
My image have alpha channel. Its size is set to [64 x 64] (original image size is [512x512]) Or I don’t understand what you mean. Hm, it seems that I messed up with frame padding on Y axis, fixing it right now...
Would you be able to show the source code - so we can figure out to code it so they group?
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 you submit your update to github, hopefully @hgy29 will roll out an update soon, I think he is looking at an issue on the Mac with LiquidFun, etc...
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
Comments
In general, to work with "ImGui" you only need a few lines:
Also there is a few demos:
https://github.com/MultiPain/Gideros_examples/tree/master/ImGuiTablesDemo
https://github.com/MultiPain/Gideros_examples/tree/master/ImGuiFileDialogDemo
https://github.com/MultiPain/Gideros_examples/tree/master/ImGuiDockingDemo
Likes: MoKaLux, SinisterSoft
Rrraptor you already did an enormous amount of work and it is now our turn to contribute
PS: you don't need to update ImGui. Imho when we have a stable plugin we don't need to update it until someone really needs a new feature then we might update the plugin
https://deluxepixel.com
Updated now: https://github.com/MultiPain/Gideros_ImGui/blob/master/README.md#draw-lists-commands
(only for images)
I don’t know how the "imageQuad" will work with the texture regions, but the rest should work without problems.
Images anchor points always in the center
https://github.com/MultiPain/Gideros_ImGui/blob/0fc7b66a0d7b19ed9204710db6095c60ea4c9336/main.cpp#L8774
Likes: SinisterSoft
Likes: SinisterSoft, MoKaLux
Now I just need the button widths to be able to be a set width..
https://deluxepixel.com
In the wiki do I need to write the e as a parameter or can I leave it. If it is best to add e as a parameter is e the delta time?
Thank you.
https://github.com/gideros/gideros/blob/master/plugins/imgui/source/Common/imgui_bindings.cpp#L1736
wiki: https://wiki.gideros.rocks/index.php/ImGui:newFrame
I know how fix it, but memory leak is still possible.
EDIT: https://github.com/gideros/gideros/pull/506
Likes: MoKaLux
CTRL+V to gideros, wrap it into a function, call this function...profit!
Likes: MoKaLux
setAutoUpdateCursor(true) and
setAutoUpdateCursor(false)
https://github.com/gideros/gideros/blob/db839bdfc6bbbb91524a687f23a8289bc24fa500/plugins/imgui/source/Common/imgui_bindings.cpp#L1754
https://github.com/gideros/gideros/blob/db839bdfc6bbbb91524a687f23a8289bc24fa500/plugins/imgui/source/Common/imgui_bindings.cpp#L377
Likes: MoKaLux
https://deluxepixel.com
Fixed this 3 for now.
Image size and button size now separated arguments.
Likes: SinisterSoft, MoKaLux
https://deluxepixel.com
Likes: SinisterSoft
So it displays a color and shows some info about that color. Can we click on it and does it respond to clicks?
It's not really a button
EDIT: this may be usefull for drag'n drop scenario?EDIT2: a nice tutorial https://eliasdaler.github.io/using-imgui-with-sfml-pt2/
TIP: ImGui could be very very handy for mobile controls
https://github.com/MultiPain/Gideros_ImGui/blob/63dce85996763d5650c961d141fbd6519a0464f2/main.cpp#L3908
I'll fix that
Likes: MoKaLux
I will wait for the update, no hurry
Likes: MoKaLux
https://deluxepixel.com
Likes: MoKaLux
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Likes: keszegh, SinisterSoft, MoKaLux
Likes: SinisterSoft, MoKaLux
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Or I don’t understand what you mean.
Hm, it seems that I messed up with frame padding on Y axis, fixing it right now...
Likes: keszegh
https://deluxepixel.com
Likes: SinisterSoft, MoKaLux
https://deluxepixel.com
Likes: SinisterSoft, MoKaLux
I haven't fixed all problems with image buttons, but most of them, I guess
Likes: SinisterSoft, vitalitymobile