Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
imGui bindings - Page 7 — Gideros Forum

imGui bindings

145791015

Comments

  • rrraptorrrraptor Member
    edited August 2020
    keszegh said:

    thanks, so what should be XXXX?

    See enums:
    ImGui.WindowFlags_NoScrollWithMouse
    ImGui.WindowFlags_None
    ImGui.WindowFlags_NoScrollbar
    ImGui.WindowFlags_HorizontalScrollbar
    ImGui.WindowFlags_NoFocusOnAppearing
    ImGui.WindowFlags_NoBringToFrontOnFocus
    ImGui.WindowFlags_NoDecoration
    ImGui.WindowFlags_NoCollapse
    ImGui.WindowFlags_NoTitleBar
    ImGui.WindowFlags_NoMove
    ImGui.WindowFlags_NoInputs
    ImGui.WindowFlags_NoMouseInputs
    ImGui.WindowFlags_NoSavedSettings
    ImGui.WindowFlags_NoNav
    ImGui.WindowFlags_UnsavedDocument
    ImGui.WindowFlags_NoNavFocus
    ImGui.WindowFlags_AlwaysHorizontalScrollbar
    ImGui.WindowFlags_AlwaysUseWindowPadding
    ImGui.WindowFlags_NoNavInputs
    ImGui.WindowFlags_NoResize
    ImGui.WindowFlags_AlwaysVerticalScrollbar
    ImGui.WindowFlags_MenuBar
    ImGui.WindowFlags_NoBackground
    ImGui.WindowFlags_AlwaysAutoResize
    Or

    https://github.com/ocornut/imgui/blob/4448734041bfff23c86dbc68dac88e69df112536/imgui.h#L794
  • @rrraptor , apparently there is no flag to disable close button. so is there another way?
  • rrraptorrrraptor Member
    edited August 2020
    keszegh said:

    @rrraptor , apparently there is no flag to disable close button. so is there another way?

    I mean, I have changed "beginWindow" function :D
    New dll on github.
    local p_open,draw_f = true,true
     
    function enterFrame(e)
    	imgui:newFrame(e)
     
    	if (imgui:beginWindow("No X 1")) then 
    		if imgui:button("OPENUP 1") then p_open = true end
    	end
    	imgui:endWindow()
     
     
    	if (imgui:beginWindow("No X 2", ImGui.WindowFlags_NoCollapse)) then 
    		if imgui:button("OPENUP 2") then p_open = true end
    	end
    	imgui:endWindow()
     
     
    	if (p_open) then 
    		p_open,draw_f = imgui:beginWindow("Have X 1", p_open)
    		if (draw_f) then 
    			imgui:text("Hi3")
    		end
    		imgui:endWindow()
    	end
     
    	if (p_open) then 
    		p_open,draw_f = imgui:beginWindow("Have X 2", p_open, ImGui.WindowFlags_NoCollapse)
    		if (draw_f) then 
    			imgui:text("Hi4")
    		end
    		imgui:endWindow()
    	end
     
    	imgui:endFrame()
    	imgui:render()
    end
  • thanks @rrraptor for the detailed example, now i think i got it, it's a bit misleading that second parameter is 'optional' and third parameter can take its place.
  • another question to hinder your progress:
    it seems the app remembers previous settings, where are those stored? how can i set them manually? (e.g. to force a window to be not collapsed on startup even if it was collapsed at the end of last run of the app)
  • keszegh said:

    thanks @rrraptor for the detailed example, now i think i got it, it's a bit misleading that second parameter is 'optional' and third parameter can take its place.

    I can remake this again :D
    what about that:
    draw_flag = imgui:beginWindow("NO X", nil, ImGui.WindowFlags_NoCollapse)
    p_open, draw_flag = imgui:beginWindow("NO X", p_open, ImGui.WindowFlags_NoCollapse)
  • rrraptor said:

    keszegh said:

    @rrraptor , for the mirrored filled slider i need that the values are also reversed (that is, it goes from 100 to 0). i can set the range to 100,0 but strangely then i cannot pull it to to 0, the filledslider stops at 1.

    Same for regular "sliderInt", so that is a bug in original ImGui code. I'll try to fix it.

    Btw its ok for float slider :D
    imgui:filledSliderFloat("test1", true, v1, 100, 0, "%.0f")
    this is still a bug..
  • rrraptor said:

    keszegh said:

    thanks @rrraptor for the detailed example, now i think i got it, it's a bit misleading that second parameter is 'optional' and third parameter can take its place.

    I can remake this again :D
    what about that:
    draw_flag = imgui:beginWindow("NO X", nil, ImGui.WindowFlags_NoCollapse)
    p_open, draw_flag = imgui:beginWindow("NO X", p_open, ImGui.WindowFlags_NoCollapse)
    the second isn't it rather a "HAVE X"?
  • rrraptorrrraptor Member
    edited August 2020
    keszegh said:

    this is still a bug..

    I know, idk how to fix it, sorry. Ive create a bug report: https://github.com/ocornut/imgui/issues/3432
    keszegh said:

    another question to hinder your progress:
    it seems the app remembers previous settings, where are those stored? how can i set them manually? (e.g. to force a window to be not collapsed on startup even if it was collapsed at the end of last run of the app)

    Yes, it stores the settings somewhere in a file, but I don't know where yet. I haven't figured out this problem yet.
    keszegh said:

    the second isn't it rather a "HAVE X"?

    Yes, you right :) Copy pasta )))

    Likes: keszegh

    +1 -1 (+1 / -0 )Share on Facebook
  • about the reversed range slider bug let's hope it will be fixed soon, imgui seems to be very actively deveoped and it must be easy to fix it on their side.
  • keszeghkeszegh Member
    edited August 2020
    another question:
    i try to change the uv mapping of an image on a button.
    and for a start as i understand
    imgui:imageButton(texture, w, h)
    and
    imgui:imageButton(texture, w, h  -1,  0xffffff, 1,  0xffffff, 0, 1, 1, 0, 0)
    should do the same, right?
    but they don't.
    first, what tint value i need to have no effect on the image?
    second, is this really the right uv values (1,1,0,0) that is the same as the default?
  • rrraptorrrraptor Member
    edited August 2020
    keszegh said:

    another question:
    i try to change the uv mapping of an image on a button.
    and for a start as i understand

    imgui:imageButton(texture, w, h)
    and
    imgui:imageButton(texture, w, h  -1,  0xffffff, 1,  0xffffff, 0, 1, 1, 0, 0)
    should do the same, right?
    No. First is background color, second is tint color, so that
    imgui:imageButton(texture, w, h, -1,  0xffffff, 0,  0xffffff, 1)
    will do the trick ;) Or you can simply pass nil if it is an optional parameter and you dont know its default value or if its faster to type "nil" instead of "0xffffff" :smiley:
    keszegh said:

    second, is this really the right uv values (1,1,0,0) that is the same as the default?

    No. Gideros expects the texture with power of two (POT) size, and if your image is 256x256 then yes, uvs must be (1,1,0,0), but if it is not then its something like this:
    (textureWidth / closestPOTWidth, textureHeight / closestPOTHeight, 0, 0) e.g. if your texture is 200x170 its uvs must be (200/256, 170/256, 0, 0).

    I can make it so the formula will be (textureWidth / closestPOTWidth) * userUV1x where userUV1x is ur desired uv x coordinate. That makes more sense.

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
  • thanks, got it.

    it was said that easiest to include images in widgets is to use custom fonts, yet setting fonts is not yet available apparently. i hope you will be able to add that too sometime.
  • still happily playing around with imgui. can you tell me how can i know if in a combo box an item was clicked on? (after which i wish to close the popup window which was opened only for this combo box)
  • keszegh said:

    thanks, got it.

    it was said that easiest to include images in widgets is to use custom fonts, yet setting fonts is not yet available apparently. i hope you will be able to add that too sometime.

    For now you can do something like this:
    imgui = ImGui.new(nil, nil, {
    	{"myFonts/font.ttf", 16, 3, 3}, -- font1
    	{...}, -- font2
    })
    Only TTF fonts supported.
    keszegh said:

    how can i know if in a combo box an item was clicked on?

    I dont realy understand you, but maybe something like this...?
    for i,v in ipairs(demoData.combo1) do 
    	if (imgui:checkbox("CheckBox"..i, v)) then 
    		demoData.combo1[i] = not v
    	end
    end
  • when setting font in Imgui.new then size does not seem to be considered, whatever i change "16" to in your example, everything remains the same.
  • about combo, let me rephrase,
    i have a
    currentItem, isOpen = ImGui:combo(label, currentItem, items)
    element and i want to trigger something when this combo gets closed.
    as a workaround i can make a variable temp which is 0, is changed to 1 when isOpen==true and i trigger the event i want (closing the containing popup window) when (isOpen==false & temp==1), but i'm sure there must be some straightforward imgui function for that.
  • another note, probably you know that, but setCursorPosX is not available.
  • in the imgui demo there is a style editor which has an export button for colors, it would be quite convenient if somehow it would export the appropriate lua code. like i have many themes here but it's a hassle to convert them to lua:
    https://github.com/ocornut/imgui/issues/707
  • keszeghkeszegh Member
    edited August 2020
    btw the ImGui:pushStyleColor(color) syntax is wrong in https://github.com/MultiPain/Gideros_ImGui#parameters-stacks-shared

    also
    pressFlag = ImGui:imageButton(texture, w, h, [padding = -1, tintColor = 0xffffff, 1, borderColor = 0xffffff, 0, uv1x = 1, uv1y = 1, uv0x = 0, uv0y = 0])

    you write that first is tintColor but it's the backgroundColor in fact.
  • there is some issue with getting colors, in dark style
    print(imgui:getStyleColor(imgui.Col_ButtonActive))
    print(0x0f87fa) --got it from the style editor
    should return the same but they don't.
  • rrraptorrrraptor Member
    edited August 2020
    So many messages xD But thanks for your feedback ;)
    keszegh said:

    about combo, let me rephrase,
    i have a
    currentItem, isOpen = ImGui:combo(label, currentItem, items)
    element and i want to trigger something when this combo gets closed.
    as a workaround i can make a variable temp which is 0, is changed to 1 when isOpen==true and i trigger the event i want (closing the containing popup window) when (isOpen==false & temp==1), but i'm sure there must be some straightforward imgui function for that.

    Flag name actually not "isOpen", my mistake. Its must be something like isSelected. So you need to use
    item, isSelected = imgui:combo(...)
    if (isSelected) then
    -- do something
    end
    keszegh said:

    another note, probably you know that, but setCursorPosX is not available.

    I'm not an expert in ImGui, so I don't know what it is for, so I decided not to implement it yet (as well as some other functions). Can you tell me what it is for?
    keszegh said:

    in the imgui demo there is a style editor which has an export button for colors, it would be quite convenient if somehow it would export the appropriate lua code. like i have many themes here but it's a hassle to convert them to lua:
    https://github.com/ocornut/imgui/issues/707

    I'll think about what I can do :)
    keszegh said:

    btw the ImGui:pushStyleColor(color) syntax is wrong in https://github.com/MultiPain/Gideros_ImGui#parameters-stacks-shared

    Fixed.
    keszegh said:

    pressFlag = ImGui:imageButton(texture, w, h, [padding = -1, tintColor = 0xffffff, 1, borderColor = 0xffffff, 0, uv1x = 1, uv1y = 1, uv0x = 0, uv0y = 0])

    you write that first is tintColor but it's the backgroundColor in fact.

    Hmmm, I'll change the order in sources, so it will match with ImGui:image(texture, w, h, [tintColor = 0xffffff, 1, bgColor = 0xffffff])
    Also, I changed uv arguments.
    First, they are swapped ( [uv0, uv1] instead of [uv1, uv0] ).
    Second, no need to calculate uv1 by your self. Now it works like a scale argument.

    Btw, I can give you access to edit github page if you want :D All I need is ur nickname.
    keszegh said:

    there is some issue with getting colors, in dark style

    print(imgui:getStyleColor(imgui.Col_ButtonActive))
    print(0x0f87fa) --got it from the style editor
    should return the same but they don't.
    Oh, my bad
    https://github.com/MultiPain/Gideros_ImGui/blob/3c628cc45a9e871653f230de7fbc9f1510d3067a/main.cpp#L85
    Must be
    GColor::toHex(color.x, color.y, color.>z<, color.w)
    Also, result is a bit different. Its 0x0f87f9 instead of 0x0f87fa. I guess its ok...?

    Likes: keszegh

    +1 -1 (+1 / -0 )Share on Facebook
  • keszeghkeszegh Member
    edited August 2020
    setCursorPosX seems to be position to an exact place the 'cursor', so e.g. the next text element is starting from there. i could use sameLine() though to have the same functionality.

    "Also, result is a bit different. Its 0x0f87f9 instead of 0x0f87fa. I guess its ok...?"
    -well the point would be to get the exact value, whatever it is (so e.g. i can match some other color with pushstylecolor to be the same).

  • btw while changing font size in imgui.new did not effect the font, i could scale it afterwards with imgui:ioSetFontGlobalScale().
  • my github name is also keszegh, even though i do not want to mess up anything. still, i can correct typos when there is no doubt.
  • Added some new features :)
    https://github.com/MultiPain/Gideros_ImGui/blob/master/README.md#loggingcapture
    https://github.com/MultiPain/Gideros_ImGui/blob/master/README.md#style-settersgetters
    https://github.com/MultiPain/Gideros_ImGui/blob/master/README.md#cursor--layout
    ImGui:setCursorPos(local_x, local_y)
    ImGui:setCursorPosX(local_x)
    ImGui:setCursorPosY(local_y)

    Likes: keszegh, MoKaLux

    +1 -1 (+2 / -0 )Share on Facebook
Sign In or Register to comment.