pthom / hello_imgui Goto Github PK
View Code? Open in Web Editor NEWHello, Dear ImGui: unleash your creativity in app development and prototyping
Home Page: https://pthom.github.io/hello_imgui
License: MIT License
Hello, Dear ImGui: unleash your creativity in app development and prototyping
Home Page: https://pthom.github.io/hello_imgui
License: MIT License
I am trying to implement support for IDBFS for Emscripten. Emscripten by default does not include IDBFS and we have to include it by -lidbfs.js
.
I've been struggling to include it - granted I am not great with CMake yet. If anyone is able to help me resolve this, that would be great!
My CMake is essentially the same as the example integration file with almost zero changes (just listing include dirs and source files).
This is what I tried to do:
if (EMSCRIPTEN)
add_link_options(-lidbfs.js)
endif()
I am trying to compile my app against hello_imgui checked-out as a submodule on Windows.
I am surprised it's complaining out of the box about the following statement in pnm.h
:
using detail::literals::operator"" _str;
"C:\PROGRA~1\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\Hostx86\x64\cl.exe" /nologo /TP -DHELLOIMGUI_HAS_OPENGL -DHELLOIMGUI_USE_GLAD -DHELLOIMGUI_USE_GLFW -DHELLOIMGUI_USE_GLFW_OPENGL3 -DIMGUI_IMPL_OPENGL_LOADER_GLAD -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES -IC:\...\extern\imlibs\hello_imgui\src\hello_imgui -IC:\...\extern\imlibs\hello_imgui\src\hello_imgui\.. -IC:\...\extern\imlibs\hello_imgui\external\imgui -IC:\...\cmake-build-debug-visual-studio\_deps\glfw-src\include -IC:\...\extern\imlibs\hello_imgui\external\SYSTEM -IC:\...\extern\imlibs\hello_imgui\external\OpenGL_Loaders\glad\include /DWIN32 /D_WINDOWS /GR /EHsc /MDd /Zi /Ob0 /Od /RTC1 /W4 /Zc:preprocessor /permissive- -D_CRT_SECURE_NO_WARNINGS -std:c++17 /showIncludes /Foextern\imlibs\hello_imgui\src\hello_imgui\CMakeFiles\hello_imgui.dir\internal\backend_impls\opengl_setup_helper\opengl_screenshot.cpp.obj /Fdextern\imlibs\hello_imgui\src\hello_imgui\CMakeFiles\hello_imgui.dir\hello_imgui.pdb /FS -c C:\...\extern\imlibs\hello_imgui\src\hello_imgui\internal\backend_impls\opengl_setup_helper\opengl_screenshot.cpp
C:\...\extern\imlibs\hello_imgui\src\hello_imgui/internal/pnm.h(1046): warning C4267: 'argument': conversion from 'size_t' to 'const uint8_t', possible loss of data```
C:\...\extern\imlibs\hello_imgui\src\hello_imgui/internal/pnm.h(1076): error C3688: invalid literal suffix '_str'; literal operator or literal operator template 'operator ""_str' not found
I haven't found authoritative info about the proper way to import literal operators but I tried locally replacing the using statements with:
using namespace details::literals
and that makes the error go away.
Hello! I want to make the sources in Ubuntu22.10,and i ran into a problem🥵🥵
I'm very sorry I came for your help.
CMake Error at external/CMakeLists.txt:33 (add_library):
Cannot find source file:
/home/zhouzihao/MYFILE/imgui_learning1/hello_imgui/external/imgui/misc/cpp/imgui_stdlib.cpp
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h
.hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc
CMake Error at src/hello_imgui/CMakeLists.txt:11 (add_library):
Cannot find source file:
/home/zhouzihao/MYFILE/imgui_learning1/hello_imgui/external/imgui/backends/imgui_impl_opengl3.h
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h
.hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc
CMake Error at external/CMakeLists.txt:33 (add_library):
No SOURCES given to target: imgui
I cd to this path ,and I can't find these sources.
ps.I use these commands to make CMake file
mkdir build && cd build && cmake .. && cmake --build . -j 4
./hello_world
The FontAwesome feature could use a couple new features.
A locked glyph size will allow for menu items to align nicely in vertical menus, giving icons all the same width. Here's an example I use in one of my projects:
config.GlyphMinAdvanceX = 18;
config.GlyphMaxAdvanceX = 18;
Also, exposing MergeFontAwesomeToLastFont
to the public API will allow using a custom font size, which can in some times be beneficial. For example, in my case, having the icon font be 1 pixel smaller fixes an issue in multi-line text fields where icons will blend into each other if they're right underneath other icons on the next line. (And they kinda align better in menu bars if they're 1 pixel smaller than the main font.)
I have noticed the following warnings when building on windows.
Absolutely not critical but I like to have a clean build, so would be nice to get rid of them.
Let me know if you would like a PR or just handle them on your end when time permits.
Commenting out the parameter name should do for those:
hello_imgui\hello_imgui_cmake\HelloImGui_WinMain.cpp(7): warning C4100: 'nCmdShow': unreferenced formal parameter
hello_imgui\hello_imgui_cmake\HelloImGui_WinMain.cpp(7): warning C4100: 'lpCmdLine': unreferenced formal parameter
hello_imgui\hello_imgui_cmake\HelloImGui_WinMain.cpp(7): warning C4100: 'hPrevInstance': unreferenced formal parameter
hello_imgui\hello_imgui_cmake\HelloImGui_WinMain.cpp(7): warning C4100: 'hInstance': unreferenced formal parameter
hello_imgui\internal\backend_impls\backend_window_helper\glfw_window_helper.cpp(14): warning C4100: 'backendOptions': unreferenced formal parameter
Not sure about that one:
hello_imgui\internal\backend_impls\backend_window_helper\glfw_window_helper.cpp(9): warning C4505: 'HelloImGui::BackendApi::glfw_error_callback': unreferenced function with internal linkage has been removed
That one is probably a release vs debug thing: the value is used by an assert macro that does not do anything in release.
hello_imgui\internal\backend_impls\runner_glfw_opengl3.cpp(42): warning C4189: 'glfwInitSuccess': local variable is initialized but not referenced
A static_cast should be ok for that one (although that's 3rd party code):
hello_imgui\src\hello_imgui\..\hello_imgui/internal/pnm.h(1046): warning C4267: 'argument': conversion from 'size_t' to 'const uint8_t', possible loss of data
I have a window whose size i only know later, not on the first or the second frame. I need some advice how to deal with this with hello_imgui using Python. My window is real simple, it just has an image (imgui.image()
) to show. I have the following questions:
app_window_params.window_geometry.window_size_measure_mode = hello_imgui.WindowSizeMeasureMode.relative_to96_ppi
is key here, right?glfw.hide_window
) in post_init
and only showing it once the image is about to be drawn for the first time. Can i invoke the sizing (and positioning) logic at a later time instead of only at window creation?`Hi pthom!
I have an issue with rendering using your imgui libray.
The application works great, and I used your imgui_manual project for source code hacking too :P but I have an issue when I am trying to draw in the background GL canvas, behind imGui on mobile phones. This issue is reproducible even on Firefox mobile emulation, like iOS 6, etc. It occurs on all mobile devices as far as I can tell.
Browser:
Chrome/Firefox
Steps to Reproduce:
Expected Result:
The jrpc.pl website should load the same as on Desktop monitors/computers
Actual Behaviour:
The background canvas behind the imgui interface is scaled down and placed in the bottom left corner. This applies to all browser tests and physical device tests I performed on iOS (iPhone6s) and Android (Blackberry Key2)
I am looking a way to have a confirmation dialog appear to ask the user whether they really want to close the app (e.g. because some changes might be lost).
The BeforeExit
callback is called at a stage when there is no way back, more like a c++ destructor that you can use to clean-up resources but from which you cannot change your mind about leaving a context.
I would like to achieve that while reusing the default 'Quit' menu entry that ships with the App menu.
Is that a case for introducing a new callback? Or is there another way I have overlooked?
On Chrome it seams that the Classic and Docking Demos differ in their keyboard input...
Things that work in the Classic Demo and Not in Docking Demo:
Since both are built from the same docking branch I'm confused as to why one would work and the other not...
Thought it was worth a report.
To duplicate go to the Dear Imgui Demo > Configuration and enable ioConfigFlags: NavEnableKeyboard and press down / up / space. After turning this off you can go to Dear Imgui Demo > Widgets > Basic. Type "asdf, Ctrl+A, Ctrl+X, Ctrl+VV, Backspace, Ctrl+C, Ctrl+VV...
This all works fine on the Classic demo but not on the Docking demo... Weird!
Hello again !
I initially populate my RunnerParams with:
runnerParams.appWindowParams.windowTitle = "MyApp"
runnerParams.imGuiWindowParams.showMenuBar = true;
runnerParams.imGuiWindowParams.showMenu_App = true;
runnerParams.imGuiWindowParams.showMenu_View = true;
When I update the window title once the application is up and running with the following statement:
HelloImGui::GetRunnerParams()->appWindowParams.windowTitle = "MyApp 2023.1.1";
I noticed that the App menu name gets updated to my title variable while the main window title remains the same as the value that was in the RunnerParams
I originally passed to HelloImGui::Run()
.
In the following example the initial value of appWindowParams.windowTitle
was just "MyApp", then updated to "MyApp 2023.1.1" :
Note: the Settings
menu you can see in the image is my own custom menu on top of the App and View built-ins.
This behavior is a bit surprising to me and I want to clarify what is a feature and what might be a bug.
It also makes me wonder if there is a way to control separately the name of the App
menu from the main window title ?
My expectation was that appWindowParams.windowTitle would only affect the main window title bar and not the App menu entry name.
Does hello_imgui can be used in Android Linux ?
Hi,
Make compile on windos, is get this error can make help?
\hello_imgui\internal\backend_impls\backend_window_helper\sdl_window_helper.cpp(145,36): error C2065: 'SDL_FLASH_UNTIL_FOCUSED': undeclared identifier
Thanks you
Hello. Imgui itself is not exception safe or exceptions aware but I know how to deal with this mainly C code. What is about hello_imgui? I consider it as a kind of window management system for Imgui that hides some its mechanics so I must be sure I may or may not use exceptions with hello_imgui.
Sorry for the noob question but it is a blocker for me so I want to be sure about the facts, approaches and plans. Thank you.
P.S. It would be worth to mention about thread safety/awareness too.
The user loaded fonts throw an exception in debug mode on windows 10.
ucrtbased.dll!00007ffc46341bc0() (Unknown Source:0)
ucrtbased.dll!00007ffc463451c5() (Unknown Source:0)
ucrtbased.dll!00007ffc463458c8() (Unknown Source:0)
hello.exe!FreeWrapper(void * ptr, void * user_data) Line 1019 (hello_imgui\external\imgui\imgui.cpp:1019)
:288)
static void FreeWrapper(void* ptr, void* user_data) { IM_UNUSED(user_data); free(ptr); }
Based on that (old-ish) imgui issue: ocornut/imgui#2715
I am wondering whether providing a way to display a main window icon should be part of what the battery-included, cross platform hello_imgui approach should offer.
I have looked at the doc and the hello_imgui_app example but it's not obvious how to achieve that currently.
Hello. I use ImGuiConfigFlags_ViewportsEnable setting and hello_imgui_demo_classic.exe does not save the main window position and its size on milti-monitor system.
Given OS=Windows, imgui-bundle=0.8.5
Click and crash here:
Log:
Traceback (most recent call last):
File "C:\Users\tangz\test.py", line 183, in <module>
immapp.run(demo_gui, with_markdown=True, window_size=(1000, 800)) # type: ignore
File "C:\Users\tangz\test.py", line 172, in demo_gui
show_markdown_file("ibd_faq")
File "C:\Users\tangz\miniconda3\lib\site-packages\imgui_bundle\demos_python\demo_utils\api_demos.py", line 79, in show_markdown_file
code = read_markdown_code(doc_filename)
File "C:\Users\tangz\miniconda3\lib\site-packages\imgui_bundle\demos_python\demo_utils\api_demos.py", line 106, in read_markdown_code
r = read_code(doc_file)
File "C:\Users\tangz\miniconda3\lib\site-packages\imgui_bundle\demos_python\demo_utils\functional_utils.py", line 11, in wrapper
cache[key] = func(*args, **kwargs)
File "C:\Users\tangz\miniconda3\lib\site-packages\imgui_bundle\demos_python\demo_utils\api_demos.py", line 88, in read_code
r = f.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0x8b in position 7774: illegal multibyte sequence
Need to add encoding='utf8'
to open here:
@memoize
def read_code(filename: str) -> str:
if not os.path.isfile(filename):
return ""
with open(filename, encoding='utf8') as f: # a small fix
r = f.read()
return r
I am trying to run my hello_imgui gui in a separate Python thread, but it seems hello_imgui.run
isn't able to do so on Mac OS. This code works fine on Windows and Linux (Ubuntu 22.04). On Mac OS, post_init is never called, the GUI is never shown, and the process spins eating all my CPU.
This is on an M1 mac, imgui_bundle 0.8.2 (compiled as part of the pip install, guess the wheel is only for the intel mac?), Mac OS 13.1, Python 3.10.9. Edit: just tested on an Intel Mac, same thing happens.
import time
import threading
from imgui_bundle import imgui, hello_imgui
import glfw
should_exit = False
def gui():
if should_exit:
print('requesting window close')
hello_imgui.get_runner_params().app_shall_exit = True
imgui.text("Bloat free code")
def post_init():
print('post init')
def thread_fun():
params = hello_imgui.RunnerParams()
params.app_window_params.window_geometry.size = (100,200)
params.app_window_params.window_title = "Hello!"
params.fps_idling.fps_idle = 0
params.callbacks.show_gui = gui
params.callbacks.post_init = post_init
print('lets go')
hello_imgui.run(params)
if __name__ == "__main__":
if True:
thread = threading.Thread(target=thread_fun)
thread.start()
time.sleep(6)
print('window should close')
should_exit = True
thread.join()
else:
thread_fun()
I'm now able to build emscripten on this project imgui_manual and it works on browser. Although below errors haven't solved but I should be able to figure it out what went wrong below by looking into imgui_manual
.
Thanks for the awesome project !
I was able to build linux desktop app in _example_integration
but failed to build the web app(emscripten).
If someone can guide me through this would be really appreciative!
I use docker for quickly get the development environment and it works for linux desktop app well.
The failed part is in the Build web app(emscripten)
below.
Docker version 20.10.7, build f0df350
$ docker run --rm -it --user 0 -p 5901:5901 -p 6901:6901 consol/debian-xfce-vnc
open browser and navigate to http://localhost:6901/?password=vncpassword
open Terminal
app and install tools
apt update && apt install -y git build-essential cmake`
apt install libglfw3-dev libxinerama-dev libxcursor-dev libxi-dev libx11-dev
cd ~
git clone https://github.com/pthom/hello_imgui.git
cd ~/hello_imgui/
cd _example_integration
mkdir build && cd build
cmake .. && make hello_world .. && ./hello_world
Yayyy~~ I can see hello world application running in the linux now
~/hello_imgui/tools/emscripten/install_emscripten.sh
source ~/emsdk/emsdk_env.sh
cd ~/hello_imgui/src/hello_imgui_demos/_example_integration
mkdir build_emscripten && cd build_emscripten
emcmake cmake .. -DHELLOIMGUI_USE_SDL_OPENGL3=ON ..
./_deps/hello_imgui-src/tools/sdl_download.sh
emcmake cmake .. -DHELLOIMGUI_USE_SDL_OPENGL3=ON .. #again
After emcmake cmake .. -DHELLOIMGUI_USE_SDL_OPENGL3=ON ..
.
the Error shows Could NOT find X11
as below
Hey there, was hoping to get an imgui update in hello_imgui to fix an issue I was having: ocornut/imgui#3982
I'm not sure how often imgui generally gets updated for hello_imgui, so figured I'd just ask. Thanks! 🥰
Hello phtom,
thanks for hello imgui.
My project could benefit from having a parameter for FPS.
I do not need full FPS all the time.
Would be good on accu powered devices or when having other resource hungry apps running, to lower the FPS when not needed.
Since imgui has the trickling input queue, this could be possible, I think.
What do you think about a parameter for FPS, which the app can set dynamically at runtime?
Best regards
On Archlinux I am getting the following error when compiling with HELLOIMGUI_USE_GLFW_OPENGL3
.
/usr/bin/ld: external/hello_imgui/external/libglad.a(glad.c.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
I can fix this by linking with dl
, but perhaps this should be fixed in the library directly:
hello_imgui/src/hello_imgui/CMakeLists.txt
Line 108 in 4ae3507
Constructive feedback is always welcome!
I would like to add a window to a dockspace programmatically. However, trying to do so crashes.
I take the source of demo_docking.py
and add the following to the bottom of command_gui()
:
if imgui.button("Add window"):
temp = hello_imgui.DockableWindow()
temp.label = "Test"
temp.dock_space_name = "MainDockSpace"
temp.gui_function = lambda: imgui.text('yo')
wins = hello_imgui.get_runner_params().docking_params.dockable_windows
wins.append(temp)
hello_imgui.get_runner_params().docking_params.dockable_windows = wins
The crash i then get is:
Exception has occurred: RuntimeError
IM_ASSERT( name != 0 && name[0] != '\0' ) --- imgui.cpp:6366
File "C:\...\demo_docking.py", line 265, in main
immapp.run(runner_params, addons_params)
File "C:\...\demo_docking.py", line 269, in <module>
main()
RuntimeError: IM_ASSERT( name != 0 && name[0] != '\0' ) --- imgui.cpp:6366
Is this the correct way to add more dockable windows to a program? And will they correctly be docked to the indicated dockspace, not free floating?
I would like to start experimenting with an emscripten build of my app (that was part of the original draw to hello_imgui as I was able to bring up the minimal example hello_imgui_app
on a localhost server so quickly).
My imgui application uses std::thread
and my understanding is I need to turn on a number of additional compilation flags like -pthread
and -sASYNCIFY
.
I am struggling to find where these should go in the current hello_imgui
setup.
I see the following comment in hello_imgui_emscripten.cmake
:
# hello_imgui_emscripten_target_compile_options needs fix!
# For the moment, these options are global via hello_imgui_emscripten_global_options.cmake
# function(hello_imgui_emscripten_target_compile_options target_name)
# target_compile_options(
# ${target_name}
# PUBLIC
# "SHELL:-s USE_SDL=2"
# "SHELL:-s USE_WEBGL2=1"
# "SHELL:-s WASM=1"
# "SHELL:-s FULL_ES3=1"
# "SHELL:-s ALLOW_MEMORY_GROWTH=1"
# )
# endfunction()
Is the idea to add something like
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -sASYNCIFY")
in hello_imgui_emscripten_global_options.cmake ?
I can't seem to marry the settings working on e.g. this sample emscripten with threads project :
https://github.com/jiulongw/emscripten-mutex-test/blob/main/run
to the hello_imgui
cmake framework.
The minimal example I am working with is:
#include "hello_imgui/hello_imgui.h"
#include <thread>
int main(int , char *[]) {
std::thread thread([]{}); // should run, do nothing and exit.
HelloImGui::Run(
[] { ImGui::Text("%s", "Hello World!"); }, // Gui code
"Hello!", // Window title
true // Window size auto
);
}
It compiles but doesn't display anything in the browser (if I comment out the thread line, it's basically the hello_imgui_app
and it works).
It appears that author forgot to either ignore or correctly format the line to not cause a crash:
hello_imgui_ini_settings.cpp: line 116
std::string r = ";;; !!! This configuration is handled by HelloImGui and stores several Ini Files, separated by markers like this:\n ;;;<<<INI_NAME>>>;;;\n\n";
This line is causing the application to abort whenever it attempts to read/save.
I had to readjust the string so that each line opened/closed with ;;;<<< >>>;;; in order for the app to correctly read/save file.
Upon launching my the hello_imgui powered version of my app I am seeing the main window appear in two steps, which does not look great. I am trying to understand where that's coming from.
I am still on Windows.
For a split second I first see this:
That's after the first call to ShowGui() callback.
Interestingly both the position of the window on the screen and the window size change (and that can't be told from the images above).
It seems that there is a first rendering pass of just the empty main window and then it picks up the dock spaces contents and somehow relocates the window (my code is not attempting any resize/change of position).
I assume that line testedPaths.push_back(assetPath);
is a residual from tests.
It breaks android build.
/home/vin/git/hello_imgui/build_android/hello_imgui_demodocking_AndroidStudio/app/jni/hello_imgui_subrepo/src/hello_imgui/internal/hello_imgui_assets.cpp:179:9: error: use of undeclared identifier 'testedPaths'
testedPaths.push_back(assetPath);
^
1 error generated.
ninja: build stopped: subcommand failed.
I am trying to add my own callbacks to hello_imgui's glfw window. There is an order issue here however. I've been modifying the heart haiku, this is the state i am in now. With this, any mouse click interaction with the gui is not possible, mouse clicks are not received. This is not strange, since the glfw backend's callback has been replaced by mine.
import time
import numpy as np
from imgui_bundle import implot, imgui_knobs, imgui, immapp, hello_imgui, glfw_window_hello_imgui
import glfw
# Fill x and y whose plot is a heart
vals = np.arange(0, np.pi * 2, 0.01)
x = np.power(np.sin(vals), 3) * 16
y = 13 * np.cos(vals) - 5 * np.cos(2 * vals) - 2 * np.cos(3 * vals) - np.cos(4 * vals)
# Heart pulse rate and time tracking
phase = 0
t0 = time.time() + 0.2
heart_pulse_rate = 80
def gui():
global heart_pulse_rate, phase, t0, x, y
# Make sure that the animation is smooth
#hello_imgui.get_runner_params().fps_idling.enable_idling = False
t = time.time()
phase += (t - t0) * heart_pulse_rate / (np.pi * 2)
k = 0.8 + 0.1 * np.cos(phase)
t0 = t
imgui.text("Bloat free code")
implot.begin_plot("Heart", immapp.em_to_vec2(21, 21))
implot.plot_line("", x * k, y * k)
implot.end_plot()
_, heart_pulse_rate = imgui_knobs.knob("Pulse", heart_pulse_rate, 30, 180)
def post_init():
print(hello_imgui.get_runner_params().backend_pointers.glfw_window)
#print(hello_imgui.get_glfw_window())
print(glfw_window_hello_imgui())
window = glfw_window_hello_imgui()
# define a callback
def my_window_size_callback(window: glfw._GLFWwindow, w: int, h: int):
print(f"Window size changed to {w}x{h}")
def my_mouse_button_callback(window: glfw._GLFWwindow, w: int, h: int, c: int):
print(f"Mouse button")
glfw.set_window_size_callback(window, my_window_size_callback)
glfw.set_mouse_button_callback(window, my_mouse_button_callback)
if __name__ == "__main__":
params = hello_imgui.RunnerParams()
params.app_window_params.window_geometry.size = (300,450)
params.app_window_params.window_title = window_title="Hello!"
params.fps_idling.fps_idle = 0
params.callbacks.show_gui = gui
params.callbacks.post_init = post_init
add_params = immapp.AddOnsParams()
add_params.with_implot = True
immapp.run(params, add_params)
The thing is, user callbacks need to be set before the glfw backend is initialized (see ImGui_ImplGlfw_InstallCallbacks
). This from code not using hello_imgui works fine:
# set our own callbacks before calling
# imgui.backends.glfw_init_for_open_gl(), then imgui's
# glfw backend will chaincall them
glfw.set_char_callback(self.window, self.char_callback)
glfw.set_window_focus_callback(self.window, self.focus_callback)
glfw.set_window_pos_callback(self.window, self.pos_callback)
glfw.set_drop_callback(self.window, self.drop_callback)
# transfer the window address to imgui.backends.glfw_init_for_open_gl
import ctypes
window_address = ctypes.cast(self.window, ctypes.c_void_p).value
imgui.backends.glfw_init_for_open_gl(window_address, True)
imgui.backends.opengl3_init("#version 150")
glfw.swap_interval(globals.settings.vsync_ratio)
Could hello_imgui support this? Perhaps another callback is needed here, for in between glfw window being created and glfw_init_for_open_gl
being called?
And a small question:
Should i still set fps_idling.enable_idling = False
when i already set fps_idling.fps_idle = 0
, or are they equivalent? Your haiku demo does both.
I have two pages. click first or second .Display different page layouts
leftspack***####firstspace############################
**************#######################################
**************#######################################
**************#######################################
**************#######################################
**************#######################################
**************#######################################
**************#######################################
####secondspace###################################
#################################################
#################################################
#################################################
#################################################
bottomspace***************************************************
How to Hide the Terminal Window?
think you!
my system: arch linux, dell xps 13
desktop: SDL opengl:
issue: can't build with SDL2::SDL2-static
my workaround: build with SDL2::SDL2
android:
issue: assets are not automatically copied
workaround: manually copy assets to app/src/main
How do you build this? I ran the SDL.sh first, then the cmake_arm7.sh, but I don't get a Android Studio project of IMGUI. It always shows an error that CMakeLists.txt(error7).
Just perusing the Imgui Manual this morning and came across the part where it says Ctrl+Tab selects window. This won't work on emscripten because that is already bound to change tabs.Not sure what to do about this. Could use vim bindings (Ctrl+w, Ctrl+Shift+w) but those are not as well known to the world. Alt+Tab is in uded in most OSes. Could use Ctrl+Alt+tab but it's cumbersome...
Anyhow, my point was just to catalog the issue for others. - This may be something to bring up to the main Imgui repo. dunno...
Thoughts?
-- Library hello_imgui
VERBOSEhello_imgui_bundle_assets_from_folder hello_imgui_demo_minimal /home/hi/hello_imgui/build_android/src/hello_imgui_demos/hello_imgui_demo_minimal/tmp/common_assets
-- apkCMake_makeAndroidStudioProject hello_imgui_demo_minimal
> apkCMake_projectTemplateFolder=/home/hi/hello_imgui/hello_imgui_cmake/android/apkCMake/templates/sdl
> ANDROID_HOME=/home/hi/android-sdk-linux/
> apkCMake_sdkDir=/home/hi/android-sdk-linux/
CMake Error at hello_imgui_cmake/android/apkCMake/apkCMake.cmake:35 (message):
Please set apkCMake_ndkDir
Call Stack (most recent call first):
hello_imgui_cmake/android/apkCMake/apkCMake.cmake:73 (apkCMake_fillAndroidSdkVariables)
hello_imgui_cmake/android/apkCMake/apkCMake.cmake:215 (apkCMake_fillVariables)
hello_imgui_cmake/hello_imgui_add_app.cmake:60 (apkCMake_makeAndroidStudioProject)
hello_imgui_cmake/hello_imgui_add_app.cmake:84 (hello_imgui_prepare_app)
src/hello_imgui_demos/hello_imgui_demo_minimal/CMakeLists.txt:2 (hello_imgui_add_app)
-- Configuring incomplete, errors occurred!
I'd like to create a window that is initially hidden, i will only show it later. right now it flashes up before i get a chance to call glfw.hide_window(self._glfw_window)
in the post_init
callback.
I tried:
glfw.window_hint(glfw.VISIBLE, False)
immapp.run(params)
but it makes sense that wouldn't work since glfw isn't even initialized at this point, correct?
Is it possible to make a window that is initially hidden?
Running the imgui_example_glfw_opengl3.py demo, when I print:
print(GL.glGetString(GL.GL_VERSION)) I get 4.6.0 NVIDIA...
But, when I run any immapp or hello_imgui demo, I get:
3.3.0 NVIDIA...
I would like to use immap, but how would I use the latest OpenGL on my machine?
Thanks,
Nick
Does imgui in general support it?
If I use HelloImGui::ImageGl
, when am I supposed to destruct the object? It's currently happening when the program exits, but it seems like (on Linux at least) this is too late as glDeleteTextures
is pointing to invalid memory.
I like the convenience hello_imgui
provides as well as its extra features (autosize, etc).
I needed more than one window in my program, so i tried to find out how to do that with hello_imgui. Turns out i can (kinda ab-)use the docking support for that. See lines 140-164 in the diff of _image_gui.py
here dcnieho/glassesValidator@6982233. That gives me nice windows with native decorations for additional windows. At least on Windows, didn't test further yet.
I did however lose a lot of the hello_imgui features in the process for the additional windows: e.g. autosizing and such only works for the main window. And the fact that just about all in the docking support can be used without docking, makes it seem like docking is a bit of a misnomer. It suggests a (possibly significant) API change. I haven't fully thought this through:
resize_app_window_at_next_frame
and all the window geometry stuff on a specific window, the main window is not special. params.docking_params.dockable_windows
would become something like just params.windows
An issue in the file "hello_imgui/internal/backend_impls/backend_window_helper/window_geometry_helper.cpp"
Unnecessary include:
#include <filesystem>
Causes build failure when compiling with MinGW 8.1
That's because MinGW 8.1 has a known bug where including causes a build failure: https://stackoverflow.com/a/56493176/7753444
Also requires adding this line
set(HELLOIMGUI_WIN32_EXECUTABLE OFF)
and only then
include(hello_imgui_add_app)
because otherwise the build fails with a linker error:
[build] [ 98%] Linking CXX executable hello_world.exe
[build] G__~1.EXE: error: /SUBSYSTEM:WINDOWS: No such file or directory
[build] G__~1.EXE: error: /ENTRY:mainCRTStartup: No such file or directory
That's because the correct compiler flag for MinGW to compile an executable without a console is:
target_link_options(Main PRIVATE -Wl,--subsystem,windows) # The two options are: windows, console
With those two fixes, the build succeeds.
I now created a poll request that fixes the issue
#31 (comment)
One thing with Docking is not super clear yet: what's the 'right' (as in idiomatic) way to load the layout from the *.ini file that persists user modifications to the layout, after closing and reopening the application?
Right now on startup I populate dockingParams.dockableWindows
programmatically every time so it gets rid of whatever customization was made the previous time the app was run.
Also, would be nice to have a way to customize the name of the ini file (imgui.ini is not appropriate in the presence of several co-existing imgui-based apps).
I have done it before with:
ImGuiIO& io = ImGui::GetIO();
io.IniFilename = ...;
but maybe you want to expose that in the RunnerParams ?
I am getting unresolved external errors for calls to ImGui methods placed in imgui/misc/cpp/imgui_stdlib.h
.
Are these sources not compiled by default alongside other imgui code?
Are there some specific steps to take in the CMakeLists.txt to pull them in?
Tested the webapp on ChromeOS everything worked great. Resize is clean anti-alias is great. However, copy/paste did not seem to work at all. I don't know if this is a feature of your wrapper or something on my side. But Thought it would be good to report.
Hello. I have two questions.
hello_imgui_assets.cpp
) std::string GetAssetFolderPath() {
std::string a = FileUtils::GetCurrentDirectory();
#if defined(__ANDROID__)
a+="/";
#else
a += "\\";
#endif
a += gAssetsSubfolderFolderName;
return a;
}
ImGui::Text("%s", HelloImGui::GetAssetFolderPath().c_str());
There should be a convenient way of handling shortcuts. Right now there is AnyBackendEventCallback
which would technically allow me to make shortcuts work, but it's backend-dependent and so any code handled by that would be kind of weird to work with.
Perhaps there could be an event specifically for passing through key down/up events?
Edit: Actually, perhaps ImGui::IsKeyDown
and ImGui::IsKeyPressed
would work just fine for this, so this might not even be completely necessary! Maybe I jumped the gun a bit too quick with a github issue 😳
Hello👋!
I want to load a ttf font into hello_imgui,but it can't work;
void Draw()
{
ImFont* font1; ImFont* font1;
static bool bool1 = true;
if (bool1)
{
font1 = HelloImGui::LoadFontTTF_WithFontAwesomeIcons(
"/usr/share/fonts/truetype/ms-core-fonts/AndaleMo.TTF", 25.0f);
bool1 = false;
}
ImGui::PushFont(font1);
ImGui::Text("Hello");
ImGui::PopFont();
⬇⬇It likely load success,but it show "unknown".
And when i select it,my program will crash ( show: 18762 segmentation fault (core dumped) ./hello_world ).
Hello, is it possible to make "backend window" of GLFW draggable for example by grabbing the top "menu bar"?
I'd like to replace OS window decorations with my own, but then I think there's no way to drag the window around.
I don't use fullscreen or docking, I'd just like to render one small window with it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.