Difference between revisions of "ImGui.Core:inputInt2"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2020.9<br/> '''Class:''' ImGui<br/> === Description === Sets two input int fields side by side (no plus/minus buttons). <source l...")
 
m (Text replacement - "<source" to "<syntaxhighlight")
Line 5: Line 5:
 
=== Description ===
 
=== Description ===
 
Sets two input int fields side by side (no plus/minus buttons).
 
Sets two input int fields side by side (no plus/minus buttons).
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
(number), (number), (bool) = ImGui:inputInt2(label, value1, value2, [ImGuiInputTextFlags=0])
 
(number), (number), (bool) = ImGui:inputInt2(label, value1, value2, [ImGuiInputTextFlags=0])
 
</source>
 
</source>
Line 21: Line 21:
  
 
=== 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

Sets two input int fields side by side (no plus/minus buttons). <syntaxhighlight lang="lua"> (number), (number), (bool) = ImGui:inputInt2(label, value1, value2, [ImGuiInputTextFlags=0]) </source>

Parameters

label: (string) the label
value1: (number) the first value to be displayed
value2: (number) the second value to be displayed
ImGuiInputTextFlags : (number) the input text flag

Return values

Returns (number) the current first value
Returns (number) the current second value
Returns (bool) whether a current value has changed

Example

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

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

local window01 = true local value01 = 4 local value02 = 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!") local isChanged = false value01, value02, isChanged = imgui:inputInt2("some label", value01, value02, 0) if isChanged then print(value01, value02) end end -- 3 we end the frame and render to screen imgui:endFrame() imgui:render() end

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