ImGui.Core:dragInt

From GiderosMobile
Revision as of 15:28, 13 July 2023 by Hgy29 (talk | contribs) (Text replacement - "<source" to "<syntaxhighlight")

Available since: Gideros 2020.9
Class: ImGui

Description

Displays an int drag slider. <syntaxhighlight lang="lua"> (number), (bool) =

 ImGui:dragInt(label, value, [incStep=1, min=0, max=0, formatString="%d", ImGuiSliderFlags=0])

</source>

Parameters

label: (string) the label
value: (number) the current value
incStep: (number) the increment step
min: (number) the min value
max: (number) the max value
formatString: (string) the format of the value
ImGuiSliderFlags: (number) the drag slider flag

Return values

Returns (number) the current value
Returns (bool) whether the current value has changed

Example

<syntaxhighlight lang="lua"> require "ImGui"

local imgui = ImGui.new() stage:addChild(imgui)

local window01 = true local dragvalue01 = 20

function onEnterFrame(e) -- 1 we start ImGui imgui:newFrame(e.deltaTime) -- 2 we add some child windows and build our GUI window01 = imgui:beginWindow("Window 01") -- no close button (X) if window01 then -- the variable is false when window is collapsed imgui:text("Hello Dear ImGui!") -- we add a text element to our GUI local isChanged = false dragvalue01, isChanged = imgui:dragInt("value", dragvalue01, 1, 0, 100, "%d", 0) if isChanged then print(dragvalue01) end -- print(e.deltaTime) end -- 3 we end the frame and render to screen imgui:endFrame() imgui:render() end

stage:addEventListener(Event.ENTER_FRAME, onEnterFrame) </source>