Difference between revisions of "ImGui.Core:endFrame"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2020.9<br/> '''Class:''' Dear ImGui<br/> === Description === Ends the ImGui frame. <source lang="lua"> ImGui:endFrame() </source>...")
 
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
'''Available since:''' Gideros 2020.9<br/>
 
'''Available since:''' Gideros 2020.9<br/>
'''Class:''' [[Dear ImGui]]<br/>
+
'''Class:''' [[ImGui]]<br/>
  
 
=== Description ===
 
=== Description ===

Revision as of 02:24, 23 March 2021

Available since: Gideros 2020.9
Class: ImGui

Description

Ends the ImGui frame.

ImGui:endFrame()

It is automatically called by render(). If you don't need to render data (skipping rendering) you may call endFrame() without render()... but you'll have wasted CPU already! If you don't need to render, better to not create any windows and not call newFrame() at all!

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()
	-- 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