kevinalberts Posted July 20, 2024 Posted July 20, 2024 (edited) expandcollapse popup#include <Windowsconstants.au3> #include <WinAPI.au3> #include "imgui.au3" _ImGui_EnableViewports() Local $hwnd = _ImGui_GUICreate("", 1, 1, -100, -100, 0, $WS_EX_TOOLWINDOW) _WinAPI_ShowWindow($hwnd) _ImGui_StyleColorsDark() Global $bCheckbox1 = 0 Global $ScreenSize[] = [@DesktopWidth, @DesktopHeight] Local $io = _ImGui_GetIO() $io.ConfigWindowsMoveFromTitleBarOnly = True Local $is_first_run = True While 1 If Not _ImGui_PeekMsg() Then Exit _ImGui_BeginFrame() If Not _ImGui_Begin("Test", True, $ImGuiWindowFlags_NoCollapse) Then Exit If $is_first_run Then $is_first_run = False Local $win_size[] = [500, 300] Local $win_pos_x = (@DesktopWidth - $win_size[0]) / 2 Local $win_pos_y = (@DesktopHeight - $win_size[1]) / 2 _ImGui_SetWindowPos($win_pos_x, $win_pos_y) _ImGui_SetWindowSize($win_size[0], $win_size[1]) EndIf _ImGui_CheckBox("Overlay", $bCheckbox1) If $bCheckbox1 Then _ImGui_SetNextWindowSize($ScreenSize[0], $ScreenSize[1]) _ImGui_SetNextWindowPos(0, 0) If _ImGui_Begin("overlay", False, BitOR($ImGuiWindowFlags_NoDecoration, $ImGuiWindowFlags_NoInputs, $ImGuiWindowFlags_NoBringToFrontOnFocus, $ImGuiWindowFlags_NoCollapse, $ImGuiWindowFlags_NoScrollbar, $ImGuiWindowFlags_NoScrollWithMouse, $ImGuiWindowFlags_NoBackground)) Then Local $pDrawListPtr = _ImGui_GetWindowDrawList() _ImDraw_AddCircle(400, 400, 100, 0xFFFFFF) _ImGui_End() EndIf EndIf _ImGui_End() _ImGui_EndFrame() Wend First window is appearing there is no problem, but when i create second window it's just pure black screen when i put $ImGuiWindowFlags_NoBackground. What am i doing wrong? What I'm tryna do is, when i hit the checkbox it will create a transparent background and draw a circle on it. It doesn't draw the circle probably because it's pure black screen like i said. I've tried a lot of stuff but didn't work, i'd appreciate any help. Thanks in advance.. Edited July 20, 2024 by kevinalberts
kevinalberts Posted July 20, 2024 Author Posted July 20, 2024 (edited) an addition; I checked demo window thing. Somehow that $ImGuiWindowFlags_NoBackground and $ImGuiWindowFlags_NoTitleBar works fine but not on my script. (Forgive me if i created the help post in wrong section) Edited July 20, 2024 by kevinalberts
Developers Jos Posted July 20, 2024 Developers Posted July 20, 2024 What exactly is IMGUI as that is not a standard UDF library we supply? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
kevinalberts Posted July 20, 2024 Author Posted July 20, 2024 10 minutes ago, Jos said: What exactly is IMGUI as that is not a standard UDF library we supply? Hi Jos, IMGUI is a powerful & high performanced cool looking UI library, thought you know it. It uses imgui functions using DllCalls from compiled imgui dll. So imgui can be used in autoit as well thanks to this.
Nine Posted July 20, 2024 Posted July 20, 2024 31 minutes ago, kevinalberts said: anyone? I think you should ask the creator of imgui. It is the first I hear about it and I have been using AutoIt for about 20 years ! I doubt that someone here has the knowledge to answer you without investing quite some time on your issue. But who knows I could be wrong. BTW, you should wait longer before bumping your own thread... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
kevinalberts Posted July 20, 2024 Author Posted July 20, 2024 1 hour ago, Nine said: I think you should ask the creator of imgui. It is the first I hear about it and I have been using AutoIt for about 20 years ! I doubt that someone here has the knowledge to answer you without investing quite some time on your issue. But who knows I could be wrong. BTW, you should wait longer before bumping your own thread... i'm sorry i'm kinda new to forum, when should i bump?
Nine Posted July 20, 2024 Posted July 20, 2024 https://www.autoitscript.com/wiki/FAQ#When_should_I_bump_my_threads? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
kevinalberts Posted July 20, 2024 Author Posted July 20, 2024 Oops i didn't know it. Sorry also thanks for letting me know.
Andreik Posted July 20, 2024 Posted July 20, 2024 (edited) It doesn't work because you need to call SetDrawList() and the color should be in AARRGGBB format. expandcollapse popup#include <Windowsconstants.au3> #include <WinAPI.au3> #include "imgui.au3" _ImGui_EnableViewports() Local $hwnd = _ImGui_GUICreate("", 1, 1, -100, -100, 0, $WS_EX_TOOLWINDOW) _WinAPI_ShowWindow($hwnd) _ImGui_StyleColorsDark() Global $bCheckbox1 = 0 Global $ScreenSize[] = [@DesktopWidth, @DesktopHeight] Local $io = _ImGui_GetIO() $io.ConfigWindowsMoveFromTitleBarOnly = True Local $is_first_run = True While 1 If Not _ImGui_PeekMsg() Then Exit _ImGui_BeginFrame() If Not _ImGui_Begin("Test", True, $ImGuiWindowFlags_NoCollapse) Then Exit If $is_first_run Then $is_first_run = False Local $win_size[] = [500, 300] Local $win_pos_x = (@DesktopWidth - $win_size[0]) / 2 Local $win_pos_y = (@DesktopHeight - $win_size[1]) / 2 _ImGui_SetWindowPos($win_pos_x, $win_pos_y) _ImGui_SetWindowSize($win_size[0], $win_size[1]) EndIf _ImGui_CheckBox("Overlay", $bCheckbox1) If $bCheckbox1 Then _ImGui_SetNextWindowSize($ScreenSize[0], $ScreenSize[1]) _ImGui_SetNextWindowPos(0, 0) If _ImGui_Begin("overlay", False, BitOR($ImGuiWindowFlags_NoDecoration, $ImGuiWindowFlags_NoInputs, $ImGuiWindowFlags_NoBringToFrontOnFocus, $ImGuiWindowFlags_NoCollapse, $ImGuiWindowFlags_NoScrollbar, $ImGuiWindowFlags_NoScrollWithMouse, $ImGuiWindowFlags_NoBackground)) Then Local $pDrawListPtr = _ImGui_GetWindowDrawList() _ImDraw_SetDrawList($pDrawListPtr) ; line added _ImDraw_AddCircle(400, 400, 100, 0xFFFFFFFF) ; AARRGGBB color _ImGui_End() EndIf EndIf _ImGui_End() _ImGui_EndFrame() Wend Edited July 20, 2024 by Andreik kevinalberts 1
kevinalberts Posted July 20, 2024 Author Posted July 20, 2024 Thanks for your help. It draws fine now but my issue is, it's still black screen. What i'm tryna do is to make second Begin window as transparent.
Andreik Posted July 20, 2024 Posted July 20, 2024 (edited) 14 minutes ago, kevinalberts said: it's still black screen Really? It's black because you use dark color style + $ImGuiWindowFlags_NoBackground. Voilà, it's not black anymore: expandcollapse popup#include <Windowsconstants.au3> #include <WinAPI.au3> #include "imgui.au3" _ImGui_EnableViewports() Local $hwnd = _ImGui_GUICreate("", 1, 1, -100, -100, 0, $WS_EX_TOOLWINDOW) _WinAPI_ShowWindow($hwnd) _ImGui_StyleColorsLight() Global $bCheckbox1 = 0 Global $ScreenSize[] = [@DesktopWidth, @DesktopHeight] Local $io = _ImGui_GetIO() $io.ConfigWindowsMoveFromTitleBarOnly = True Local $is_first_run = True While 1 If Not _ImGui_PeekMsg() Then Exit _ImGui_BeginFrame() If Not _ImGui_Begin("Test", True, $ImGuiWindowFlags_NoCollapse) Then Exit If $is_first_run Then $is_first_run = False Local $win_size[] = [500, 300] Local $win_pos_x = (@DesktopWidth - $win_size[0]) / 2 Local $win_pos_y = (@DesktopHeight - $win_size[1]) / 2 _ImGui_SetWindowPos($win_pos_x, $win_pos_y) _ImGui_SetWindowSize($win_size[0], $win_size[1]) EndIf _ImGui_CheckBox("Overlay", $bCheckbox1) If $bCheckbox1 Then _ImGui_SetNextWindowSize($ScreenSize[0], $ScreenSize[1]) _ImGui_SetNextWindowPos(0, 0) If _ImGui_Begin("overlay", False, BitOR($ImGuiWindowFlags_NoDecoration, $ImGuiWindowFlags_NoInputs, $ImGuiWindowFlags_NoBringToFrontOnFocus, $ImGuiWindowFlags_NoCollapse, $ImGuiWindowFlags_NoScrollbar, $ImGuiWindowFlags_NoScrollWithMouse)) Then Local $pDrawListPtr = _ImGui_GetWindowDrawList() _ImDraw_SetDrawList($pDrawListPtr) ; line added _ImDraw_AddCircle(400, 400, 100, 0xFFFF8000) ; AARRGGBB color _ImGui_End() EndIf EndIf _ImGui_End() _ImGui_EndFrame() Wend Edited July 20, 2024 by Andreik
kevinalberts Posted July 20, 2024 Author Posted July 20, 2024 (edited) No you didn't get me, i want it to be transparent... I noticed i didn't even use $ImGuiWindowFlags_NoBackground. But eventho i added it it's still not transparent window Edited July 20, 2024 by kevinalberts
Andreik Posted July 20, 2024 Posted July 20, 2024 My crystal ball it's broken, I can't figure out what everyone might want. Anyway your issues doesn't seems related to AutoIt but more about how imgui works, so it's better to post your questions about imgui in the right place.
kevinalberts Posted July 20, 2024 Author Posted July 20, 2024 Sigh... I thought someone could fix my problem...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now