ImGui.Core:dragFloatRange2

From GiderosMobile
Revision as of 16:04, 23 November 2021 by MoKaLux (talk | contribs) (→‎Example: .deltaTime)

Available since: Gideros 2020.9
Class: ImGui

Description

Displays 2 float drag range sliders, side by side.

(number), (number), (bool) =
  ImGui:dragFloatRange2(label, valueMin, valueMax, [incStep=1, min=0, max=0, formatMinString="%.3f",
    formatMaxString=formatMinString, ImGuiSliderFlags=0])

Parameters

label: (string) the label
valueMin: (number) the current minimum value
valueMax: (number) the current maximum value
incStep: (number) the increment step
min: (number) the min range value
max: (number) the max range value
formatMinString: (string) the format of the min value
formatMaxString: (string) the format of the max value
ImGuiSliderFlags: (number) the drag slider flag

Return values

Returns (number) the current min value
Returns (number) the current max value
Returns (bool) whether one of the current values has changed

Example

require "ImGui"

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

local window01 = true
local dragvaluemin01 = -10
local dragvaluemax01 = 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
		dragvaluemin01, dragvaluemax01, isChanged = imgui:dragFloatRange2("between", dragvaluemin01, dragvaluemax01, 0.2, -50, 50, "%.3f", "%.2f", 0)
		if isChanged then print(dragvaluemin01, dragvaluemax01) 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)