Jump to content

Recommended Posts

Posted (edited)

Introduction

  • ImGui is a popular library written by ocornut, it can make awesome user interface based on directx.
  • It is being used by many big apps/games
  • The UI is nice and flexible, easy to use because of frame-by-frame drawing.

So I decided to convert the entire ImGui library to AutoIt

  • At first it's just an experiment, i converted some basic draw functions of imgui, compile to a dll, then using DllCall in autoit to call the functions.
  • I was testing to see how much FPS i can get in autoit, and i was expected a low FPS, since autoit is slow.
  • Suprisingly, the FPS turned out to be so high, it works really fast, even when drawing 1000 buttons at the same time.

Features

  • More than +270 functions converted from ImGui (compiled dll).
  • Has 90% of the capability of what you can do in C++;
  • Usable ImGuiIO and ImGuiStyle, so you can set whatever configurations you like.

Preview

    u1XKVkY.png

Usage

#include <WinAPI.au3>
#include "ImGui.au3"

; Create a window
Local $hwnd = _ImGui_GUICreate("AutoIt ImGui", 1024, 768)
_WinAPI_ShowWindow($hwnd)

; Set style color
_ImGui_StyleColorsLight()
;~ _ImGui_StyleColorsDark()

Local $f_value = 5
While 1

    ; when the user click close button on the window, this will return false
    if Not _ImGui_PeekMsg() Then Exit

    ; must call
    _ImGui_BeginFrame()

    _ImGui_Begin("Another window")
  
    _ImGui_Text("Hello there..")
  
    If _ImGui_Button("click me") Then $f_value = 5
  
    _ImGui_SliderFloat("slider", $f_value, 2, 20)
    If _ImGui_IsItemHovered() Then _ImGui_ToolTip("what r u doing?")
  
    _ImGui_End()
  
    ; must call
    _ImGui_EndFrame()
Wend

 

Remark

  • Most of the functions were converted automatically. I haven't tested all of them yet, if some function doesn't work for you, please tell me.
  • Still missing some features of ImGui, please tell me if you needed any.
  • Run \tools\imgui-au3-setup.au3 to add _ImGui functions to SciTE auto-complete.

Source Code

Edited by thedemons
Posted

I get the same, screenshots look great though. :P

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted (edited)

Just test it but I also get the same error as above.
I tried the step you discribe above but still it doesn't work.
On Windows 10 64 bit.

Edited by nend
Posted (edited)

Tested it. Win 10 x64. No problems. Run in x86 and x64.

Q: What is the use of "FileInstall("imgui.dll", $__imgui_dllpath)". Why not just run from local folder.
 

;~ Local $__imgui_dllpath = @TempDir & "\temp-data-" & TimerInit() & ".tmp", $__imgui_created = False
;~ If Not FileInstall("imgui.dll", $__imgui_dllpath) Then
;~  MsgBox(16, "Error", "Cannot find imgui.dll")
;~  Exit
;~ EndIf

Global $__imgui_created = False
Global $__imgui_dllpath = @ScriptDir & "\imgui.dll"
If @AutoItX64 Then $__imgui_dllpath = @ScriptDir & "\dll_64\imgui.dll"

Global $IMGUI_DLL = DllOpen($__imgui_dllpath)

If $IMGUI_DLL = -1 Then
    MsgBox(16, "Error", "Cannot load imgui.dll" & @CRLF & "Please update to the latest version of DirectX")
    Exit
EndIf

OnAutoItExitRegister(Shutdown_)
Func Shutdown_()
    If $__imgui_created Then _ImGui_ShutDown()
    DllClose($IMGUI_DLL)
;~  FileDelete($__imgui_dllpath)
EndFunc
... ...

Q: How can the _ImGui_GUICreate() be dock to the main GUI ?

Edited by argumentum

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted (edited)

Please be more clear, dock what to what? Also, this is a problem of imgui, so you can just google with "imgui c++ dock....".

image.png

Edited by thedemons
Posted

This is an example docking space, please call MainDockSpace() after _ImGui_BeginFrame(), and remember to _ImGui_EnableDocking() first.

Func MainDockSpace($transparent_bg = True)

    Local $io = _ImGui_GetIO()
    if BitAND($io.ConfigFlags, $ImGuiConfigFlags_DockingEnable) = False Then Return False

    Local $opt_fullscreen_persistant = true
    Local $opt_fullscreen = $opt_fullscreen_persistant
    Local $dockspace_flags = $transparent_bg ? $ImGuiDockNodeFlags_PassthruCentralNode : $ImGuiDockNodeFlags_None

    Local $window_flags = $ImGuiWindowFlags_NoDocking

    $viewport = _ImGui_GetMainViewport()
    _ImGui_SetNextWindowPos($viewport.Pos_x, $viewport.Pos_y)
    _ImGui_SetNextWindowSize($viewport.Size_x, $viewport.Size_y)
    _ImGui_SetNextWindowViewport($viewport.ID)
    _ImGui_PushStyleVar($ImGuiStyleVar_WindowRounding, 0)
    _ImGui_PushStyleVar($ImGuiStyleVar_WindowBorderSize, 0)
    $window_flags = BitOR($window_flags, $ImGuiWindowFlags_NoTitleBar, $ImGuiWindowFlags_NoCollapse, $ImGuiWindowFlags_NoResize, $ImGuiWindowFlags_NoMove)
    $window_flags = BitOR($window_flags, $ImGuiWindowFlags_NoBringToFrontOnFocus, $ImGuiWindowFlags_NoNavFocus)

    if BitAND($dockspace_flags, $ImGuiDockNodeFlags_PassthruCentralNode) Then $window_flags = BitOR($window_flags, $ImGuiWindowFlags_NoBackground)

    _ImGui_PushStyleVarPos($ImGuiStyleVar_WindowPadding, 0, 0)
    _ImGui_Begin("main_dockspace", False, $window_flags)
    _ImGui_PopStyleVar()

    if ($opt_fullscreen) Then _ImGui_PopStyleVar(2)

    $dockspace_id = _ImGui_GetID("MyDockSpace")
    _ImGui_DockSpace($dockspace_id, 0, 0, $dockspace_flags)

    _ImGui_End()
EndFunc

 

Posted

Still no success, even with argumentum script version ... 

Still the same error message PLEASE INSTALL THE LATEST VERSION of DIRECTX ?

For Win10 x64 this is already installed on my machine.

Even if the script run in x86 or x64, same error ...?

Posted (edited)

That is because the dll can't be load. please try to update your Visual C++

Edit: I have updated the new dll built with a lower version of windows SDK, maybe my version of SDK was too high.

Edited by thedemons
Posted

The dll is using directx 11 which is prettey much installed on every machine, i think the problem is the windows SDK i used to build the dll.
I have updated a new version of the dll, can you try again?

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...