User Tools

Site Tools


en:tutorials:imgui

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
en:tutorials:imgui [2019/03/10 14:01 (16 months ago)]
127.0.0.1 external edit
en:tutorials:imgui [2020/03/28 18:26 (3 months ago)] (current)
sausage Changes with the new version of init
Line 1: Line 1:
 ====== Creating your own ImGui based project ====== ====== Creating your own ImGui based project ======
  
-<WRAP center round box info 90%>Huge thanks go to the //​thegwydd//​ for his work bringing the ImGui User Interface Library to Orx.</​WRAP>​+<WRAP center round box info 90%>Huge thanks go to the //​thegwydd//​ for his work bringing the Dear ImGui User Interface Library to Orx.</​WRAP>​
  
-<WRAP center round box info 90%>​Please note that ImGui project ​creation will soon be built into the [[en:​tutorials:​creating_your_own_project|init script]]. Once supported, this page will be removed.</​WRAP>​+You can easily generate a Dear ImGui project ​using ''​init''​ from the github version of Orx.
  
-Start by working through the [[https://​github.com/​thegwydd/​ImGuiOrx|guide to create ​the imgui_orx library and demo project]].+This article assumes that you have [[en:tutorials:​cloning_orx_from_github|downloaded ​the latest version of Orx from github]] and have built Orx.
  
-Once those are done, head back here. 
  
-Start by [[en:​tutorials:​creating_your_own_project|init'​ing up a new project]].+===== How to Create your own Dear ImGui project ​=====
  
-Your new project ​already contains references to the Orx librarybut you will also need to reference the ImguiOrx library as well. To do this:+There are two ways to create a Dear ImGui project. Firstlyusing Interactive Mode:
  
-  ​- Add ''​../​../​../​../​ImGuiOrx/​lib/​static''​ to your Library paths. +  ​init 
-  - Add ''​../​../​../​../​ImGuiOrx/​include''​ and ''​../​../​../​../​ImGuiOrx/​imgui''​ to your Include paths. +
-  - Add ''​imgui_orxd''​ to your Libraries.+
  
-Important: Ensure that your library order is: ''​imgui_orxd;​orxd''​ +Then follow all the prompts and choose ​''​yes'' ​when asked if you want to include Dear ImGui:
-Otherwise ​you will get a link time error later on.+
  
-Remove all code your main .cpp file.+  [Extension] imgui: Dear ImGui support (https://​github.com/​ocornut/​imgui)?​ (no) 
 +   
 +The second way is to specify everything on the commandline:​
  
-Add the following includes ​ to your main .cpp file:+  init myGameFolder/​MyGame +imgui
  
-   #​include "​orx.h" ​ 
-   #​include "​imgui.h"​ 
-   #​include "​ImGui_Orx.h"​ 
  
 +===== Working with your project =====
  
- +Load your new Dear ImGui project ​using your favourite IDEYou'​ll ​find your build in the ''​build'' ​folder.
-Copy the Viewport and Camera declarations from the ImGuiOrx test project (main.cpp) to your .cpp file. +
-Copy all the functions from the ImGuiOrx test project ​file (main.cpp) into your .cpp file. +
- +
-Change your ''​Orx_Execute''​ line in your ''​main''​ function to be: +
- +
-   ​orx_Execute(argc,​ argv, ImGuiOrx_Init,​ ImGuiOrx_Run,​ ImGuiOrx_Exit);​ +
- +
-Compiling will be fine but you'​ll ​get a runtime error. This is because you will be missing the ini files required from the ImGuiOrx project. +
- +
-Add the following Post Build command to your project configuration:​ +
- +
-   cmd /c copy /Y ..\..\..\..\ImGuiOrx\test\\*.ini ..\..\..\data\config +
- +
-Change ​the number of ''​..\'' ​to get your relative path back to where your ImGuiOrx project lives. +
- +
-Add the following to the bottom of your main project .ini file to load the ini files required from imgui: +
- +
-   ​@imgui_orx_testd.[email protected]+
  
 Compile and run. You should get a nice screen with demo gui controls. Compile and run. You should get a nice screen with demo gui controls.
  
-{{ :​tutorials:​imgui-orx-project.png |}}+{{ :​tutorials:​imgui-orx-project-logo.png |}}
  
-Feel free to add the Orx logo back into the project by adding: +And just for some extra flair, add a little up/down movement to the logo in your main config file:
- +
-   ​orxObject_CreateFromConfig("​Object"​);​ +
-    +
-... into the bottom of the ''​ImGuiOrx_Init()''​ function. +
- +
-And just for some extra flair, add a little up/down movement to the logo:+
  
 <code ini> <code ini>
 [Object] [Object]
 Graphic ​        = @ Graphic ​        = @
-SoundList ​      = @ 
-Sound           = appear.ogg 
 Texture ​        = logo.png Texture ​        = logo.png
 Pivot           = center Pivot           = center
-Scale           = 0.5 
-Position ​       = (0, 0, 0) 
 AngularVelocity = 18 AngularVelocity = 18
 FXList ​         = FadeIn # ColorCycle # MoveAround FXList ​         = FadeIn # ColorCycle # MoveAround
Line 84: Line 52:
 </​code>​ </​code>​
  
-Now you can drag your windows over moving Orx objects.+===== orx/Scroll based projects =====
  
-{{ :​tutorials:​imgui-orx-project-logo.png |}}+You can also create an orx/Scroll-based Dear ImGui project. ​See: [[en:​tutorials:​creating_your_own_scroll_project_using_init|Creating your own orx/Scroll project using '​init'​]]
  
 ===== Learning ImGui ===== ===== Learning ImGui =====
Line 92: Line 60:
 To get started learning how to use the UI Library, check the official repo page: https://​github.com/​ocornut/​imgui To get started learning how to use the UI Library, check the official repo page: https://​github.com/​ocornut/​imgui
  
-Many examples are in the ''​ImGuiOrx\imgui\examples''​ folder of the ImGuiOrx ​library project.+You can also find the previous guide for Orx and Dear ImGui here: [[https://​github.com/​thegwydd/​ImGuiOrx|guide to create ​the imgui_orx ​library ​and demo project]].
en/tutorials/imgui.1552226466.txt.gz · Last modified: 2019/03/10 14:01 (16 months ago) by 127.0.0.1