ImGui.Core:newFrame

From GiderosMobile
Revision as of 18:02, 18 August 2021 by Anthony (talk | contribs)

Available since: Gideros 2020.9
Class: ImGui

Description

Starts a new ImGui frame, you can submit any command from this point until endFrame().

ImGui:newFrame(deltaTime)

Example

MyClass = Core.class(Sprite)

function MyClass:init()
	application:setBackgroundColor(0x111111)
	-- imgui init
	self.imgui = ImGui.new()
	-- order
	self:addChild(self.imgui)
	-- LISTENERS
	self:addEventListener("enterBegin", self.onTransitionInBegin, self)
end

-- LOOP
function MyClass:onEnterFrame(e)
	-- 1 we start ImGui
	self.imgui:newFrame(e.deltaTime)
	-- 2 we build our GUI
	-- ...
	self.imgui:endFrame()
	self.imgui:render()
end

-- EVENT LISTENERS
function MyClass:onTransitionInBegin()
	self:addEventListener(Event.ENTER_FRAME, self.onEnterFrame, self)
end