ImGui.DrawList:getWindowDrawList

From GiderosMobile
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Available since: Gideros 2020.9
Class: ImGui.DrawList

Description

Gets the current window ImGui draw list.

(drawlist) = ImGui:getWindowDrawList()

Return values

Returns (drawlist) the current window draw list

Example

require "ImGui"

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

local window01 = true

function onEnterFrame(e)
	-- 1 we start ImGui
	imgui:newFrame(e)
	-- 2 the main window
	if window01 then -- if window exists
		local windowdrawn = false
		window01, windowdrawn = imgui:beginWindow(
			"Hello Dear ImGui", -- window title
			window01 -- is window expanded
		)
		if (windowdrawn) then -- the variable is false when main window is collapsed
			imgui:text("Hello X Dear ImGui!") -- we add some element to our GUI
			imgui:textColored("Hello, Y Dear ImGui!", 0xff00ff, 1) -- we add some element to our GUI
			local drawlist = imgui:getWindowDrawList()
			drawlist:addCircle(128, 128, 64, 0x00ff00, 1, 32)
		end
		imgui:endWindow()
	end
	-- 3 we end the frame and render to screen
	imgui:endFrame()
	imgui:render()
end

stage:addEventListener(Event.ENTER_FRAME, onEnterFrame)