Difference between revisions of "ImGui.Core:dragScalar"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2020.9<br/> '''Class:''' ImGui<br/> === Description === Displays a scalar drag slider. <source lang="lua"> (number) = ImGui:dra...")
 
m (Text replacement - "<source" to "<syntaxhighlight")
Line 5: Line 5:
 
=== Description ===
 
=== Description ===
 
Displays a scalar drag slider.
 
Displays a scalar drag slider.
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
(number) =
 
(number) =
 
   ImGui:dragScalar(label, ImGuiDataType, value, v_speed, [v_min=nil, v_max=nil, format=nil,
 
   ImGui:dragScalar(label, ImGuiDataType, value, v_speed, [v_min=nil, v_max=nil, format=nil,
Line 25: Line 25:
  
 
=== Example ===
 
=== Example ===
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
require "ImGui"
 
require "ImGui"
  

Revision as of 15:28, 13 July 2023

Available since: Gideros 2020.9
Class: ImGui

Description

Displays a scalar drag slider. <syntaxhighlight lang="lua"> (number) =

 ImGui:dragScalar(label, ImGuiDataType, value, v_speed, [v_min=nil, v_max=nil, format=nil,
   ImGuiSliderFlags=0])

</source>

Parameters

label: (string) the label
ImGuiDataType: (string) an ImGui number data type
value: (number) the current value
v_speed: (number) the scalar speed
v_min: (number) the min scalar speed value
v_max: (number) the max scalar speed value
format: (string) the format of the value
ImGuiSliderFlags: (number) the drag slider flag

Return values

Returns (number) the current value

Example

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

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

local window01 = true local dragscalarvalue01 = 10

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!") -- we add a text element to our GUI dragscalarvalue01 = imgui:dragScalar("scalar", ImGui.DataType_Float, dragscalarvalue01, 1, 10, 100, "%d", 0) end -- 3 we end the frame and render to screen imgui:endFrame() imgui:render() end

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