ImGui.Core:sliderAngle

From GiderosMobile
Revision as of 06:21, 29 March 2021 by MoKaLux (talk | contribs) (Created page with "__NOTOC__ '''Available since:''' Gideros 2020.9<br/> '''Class:''' ImGui<br/> === Description === Displays a regular angle slider. <source lang="lua"> (number), (bool) =...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Available since: Gideros 2020.9
Class: ImGui

Description

Displays a regular angle slider.

(number), (bool) =
  ImGui:sliderAngle(label, valueInRad, [min_degrees=-360, max_degrees=360, formatString="%.0f deg",
    ImGuiSliderFlags=0])

Parameters

label: (string) the label
valueInRad: (number) the current value in radians
min_degrees: (number) the min value in degrees
max_degrees: (number) the max value in degrees
formatString: (string) the format of the value
ImGuiSliderFlags: (number) the drag slider flag

Return values

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

Example

require "ImGui"

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

local window01 = true
local value = math.pi/4 -- 45 degrees

function onEnterFrame(e)
	-- 1 we start ImGui
	imgui:newFrame(e)
	-- 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!")
		local isChanged = false
		value, isChanged = imgui:sliderAngle("slider angle", value, -90, 90, "%.2f", 0)
		if isChanged then print(value) end
	end
	-- 3 we end the frame and render to screen
	imgui:endFrame()
	imgui:render()
end

stage:addEventListener(Event.ENTER_FRAME, onEnterFrame)