Difference between revisions of "Dear ImGui"

From GiderosMobile
(added example)
 
(36 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
<!-- GIDEROSOBJ:ImGui -->
 
<!-- GIDEROSOBJ:ImGui -->
'''<translate>Supported platforms</translate>:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]<br/>
+
'''Supported platforms:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]<br/>
'''<translate>Available since</translate>:''' Gideros 2020.9<br/>
+
'''Available since:''' Gideros 2020.9<br/>
  
 
=== Description ===
 
=== Description ===
Line 9: Line 9:
  
  
'''This is brand new in Gideros Studio so it may take some time to document it thoroughly.'''
+
To use Dear ImGui in your project you need to add the ImGui plugin and call require like so:
 
+
<syntaxhighlight lang="lua">
In the meantime, the '''author's GitHub''' is the best place to start using Dear ImGui in Gideros Studio.
 
https://github.com/MultiPain/Gideros_ImGui
 
 
 
<source lang="lua">
 
require 'ImGui'
 
</source>
 
 
 
=== Examples ===
 
'''The basics of Dear ImGui'''
 
<source lang="lua">
 
 
require "ImGui"
 
require "ImGui"
 +
</syntaxhighlight>
  
-- a Dear ImGui instance
 
local imgui = ImGui.new()
 
 
-- we scale the font up
 
imgui:ioSetFontGlobalScale(2)
 
 
-- we choose a style (default = Dark)
 
--imgui:setLightStyle()
 
--imgui:setDarkStyle()
 
imgui:setClassicStyle()
 
 
-- we add imgui to the stage
 
stage:addChild(imgui)
 
 
-- we create 2 variables to hold our main window status
 
local mainWindowOpen, mainWindowDrawn
 
  
-- Dear ImGui runs on the game loop
+
'''This is a new and very big plugin, it may take some time to document it thoroughly.'''
function enterFrame(e)
 
-- 1 we start ImGui
 
imgui:newFrame(e)
 
  
-- 2 we build our GUI
+
In the meantime, the person (@'''rrraptor''') who made the Gideros implementation has a GitHub. It is the best place to get started with Gideros Dear ImGui.
mainWindowOpen, mainWindowDrawn =
+
'''https://github.com/MultiPain/Gideros_ImGui'''
imgui:beginWindow(
 
"Hello ImGui v"..ImGui._VERSION, -- main window title
 
true -- main window is expanded
 
)
 
if (mainWindowDrawn) then -- the variable is false when main window is collapsed
 
imgui:text("Hello Dear ImGui!") -- we add a text element to our GUI
 
end
 
imgui:endWindow()
 
  
-- 3 we render our window
 
imgui:endFrame()
 
imgui:render()
 
end
 
  
-- this wouldn't work without listeners
+
Of course, Gideros Wiki is here to help as well. You will find below some Dear ImGui examples implemented in Gideros Studio.
stage:addEventListener("mouseDown", function(e) imgui:onMouseDown(e) end)
+
'''[[ImGui_Examples]]'''
stage:addEventListener("mouseUp", function(e) imgui:onMouseUp(e) end)
 
stage:addEventListener("mouseHover", function(e) imgui:onMouseHover(e) end)
 
stage:addEventListener("mouseMove", function(e) imgui:onMouseMove(e) end)
 
stage:addEventListener("mouseWheel", function(e) imgui:onMouseWheel(e) end)
 
stage:addEventListener("keyDown", function(e) imgui:onKeyDown(e) end)
 
stage:addEventListener("keyUp", function(e) imgui:onKeyUp(e) end)
 
stage:addEventListener("keyChar", function(e) imgui:onKeyChar(e) end)
 
stage:addEventListener("enterFrame", enterFrame)
 
</source>
 
  
{|-
+
=== Classes ===
| style="width: 50%; vertical-align:top;"|
+
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
=== <translate>Methods</translate> ===
+
'''[[ImGui|ImGui.Core (ImGui)]]'''<br/><!--GIDEROSOBJ:ImGui-->
| style="width: 50%; vertical-align:top;"|
+
'''[[ImGui.DrawList]]'''<br/><!--GIDEROSOBJ:ImGui.DrawList-->
=== <translate>Events</translate> ===
+
'''[[ImGui.Style]]'''<br/><!--GIDEROSOBJ:ImGui.Style-->
=== <translate>Constants</translate> ===
+
</div>
|}
 
  
 
{{GIDEROS IMPORTANT LINKS}}
 
{{GIDEROS IMPORTANT LINKS}}

Latest revision as of 12:35, 27 August 2024

Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.pngPlatform html5.pngPlatform winrt.pngPlatform win32.png
Available since: Gideros 2020.9

Description

This is an implementation of the Dear ImGui library.

See full original documentation here: https://pthom.github.io/imgui_manual_online/manual/imgui_manual.html


To use Dear ImGui in your project you need to add the ImGui plugin and call require like so:

require "ImGui"


This is a new and very big plugin, it may take some time to document it thoroughly.

In the meantime, the person (@rrraptor) who made the Gideros implementation has a GitHub. It is the best place to get started with Gideros Dear ImGui.

https://github.com/MultiPain/Gideros_ImGui


Of course, Gideros Wiki is here to help as well. You will find below some Dear ImGui examples implemented in Gideros Studio.

ImGui_Examples

Classes