Difference between revisions of "ImGui.Core:colorEdit3"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2020.9<br/> '''Class:''' ImGui<br/> === Description === Displays an RGB color edit widget that consists of 3 inputs (RGB) and a p...")
 
Line 4: Line 4:
  
 
=== Description ===
 
=== Description ===
Displays an RGB color edit widget that consists of 3 inputs (RGB) and a preview. Please note that Alpha is ignored.
+
Displays an RGB color edit widget that consists of 3 inputs (RGB) along with a color picker.
 
<source lang="lua">
 
<source lang="lua">
 
(number), (bool) = ImGui:colorEdit3(label, color, [ImGuiColorEditFlags=0])
 
(number), (bool) = ImGui:colorEdit3(label, color, [ImGuiColorEditFlags=0])

Revision as of 08:04, 3 April 2021

Available since: Gideros 2020.9
Class: ImGui

Description

Displays an RGB color edit widget that consists of 3 inputs (RGB) along with a color picker.

(number), (bool) = ImGui:colorEdit3(label, color, [ImGuiColorEditFlags=0])

Parameters

label: (string) the label
color: (number) the current color
ImGuiColorEditFlags: (number) one of ImGui color edit flags

Return values

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

Example

require "ImGui"

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

local window01 = true
local hexcolor = 0x00ff00

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
		hexcolor, isChanged = imgui:colorEdit3("label", hexcolor, 0)
		if isChanged then print(hexcolor) end
	end
	-- 3 we end the frame and render to screen
	imgui:endFrame()
	imgui:render()
end

stage:addEventListener(Event.ENTER_FRAME, onEnterFrame)