Difference between revisions of "ImGui.Core.new"

From GiderosMobile
(improved example)
Line 6: Line 6:
 
Initializes a new ImGui instance.
 
Initializes a new ImGui instance.
 
<source lang="lua">
 
<source lang="lua">
ImGui.new()
+
ImGui.new(xxx)
 
</source>
 
</source>
  
Line 13: Line 13:
  
 
=== Example ===
 
=== Example ===
 +
'''A minimum example'''
 
<source lang="lua">
 
<source lang="lua">
 +
require "ImGui"
 +
 
local imgui = ImGui.new()
 
local imgui = ImGui.new()
print("hello ImGui v"..ImGui._VERSION)
 
 
stage:addChild(imgui)
 
stage:addChild(imgui)
 +
 +
function onEnterFrame(e)
 +
imgui:newFrame(e)
 +
imgui:setClassicStyle()
 +
 +
imgui:showDemoWindow()
 +
 +
imgui:render()
 +
imgui:endFrame()
 +
end
 +
 +
stage:addEventListener(Event.ENTER_FRAME, onEnterFrame)
 
</source>
 
</source>
  
 
{{ImGui}}
 
{{ImGui}}

Revision as of 03:52, 24 March 2021

Available since: Gideros 2020.9
Class: ImGui

Description

Initializes a new ImGui instance.

ImGui.new(xxx)

Parameters

xxx: (table) parameters optional

Example

A minimum example

require "ImGui"

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

function onEnterFrame(e)
	imgui:newFrame(e)
	imgui:setClassicStyle()

	imgui:showDemoWindow()

	imgui:render()
	imgui:endFrame()
end

stage:addEventListener(Event.ENTER_FRAME, onEnterFrame)