mahilab / mahi-gui Goto Github PK
View Code? Open in Web Editor NEWDirt Simple C++ GUI Toolkit using GLFW, ImGui, and NanoVG
License: MIT License
Dirt Simple C++ GUI Toolkit using GLFW, ImGui, and NanoVG
License: MIT License
The Util map is missing
Dear guys
First of all, thank you for the amazing work with the mahi-gui project. I have played around with the demos and the vast integration of different libraries is what attracted me the most from this project.
I am an absolute beginner thus please bear with me. I first came across the ImPlot library a couple of months ago since I had been looking for a nice library and/or platform for plotting real-time data from a group of sensors in a custom GUI. This led me to read a bit more about the Dear ImGui project. As part of their recommended alternative 'wrappers', the mahi-gui was one of the best-regarded by some.
I would like to learn about its integration and development with Visual Studio 2019 however, I have not found any resources online with detailed guides and/or tutorials covering the mahi-gui package.
I would like to kindly ask you if you could point me to some resources to learn from scratch on how to develop my own solution. I have tried to run a couple of tests using the CMake file and also pointing the linker to the built sources, however, Microsoft VS 2019 cannot find the header files.
Thank you in advance and my best wishes to you all 😉
Hello! I'm trying to build it on Ubuntu 20.04 and I get the following error:
/home/vyorkin/projects/github/cxx/mahi-gui/examples/ex_sequence.cpp:41:5: error: ‘Enumerator’ does not name a type
41 | Enumerator move(float duration) {
| ^~~~~~~~~~
/home/vyorkin/projects/github/cxx/mahi-gui/examples/ex_sequence.cpp:59:5: error: ‘Enumerator’ does not name a type
59 | Enumerator rotate(float duration) {
First of all, thanks for your amazing work on mahi-gui!
Implot v0.10 is out since March. Because I'd like to use some of the new features, I think it'd be useful to update implot.
Note that, apparently, there has been a minor API change (AFAICT, SetColormap was replaced by PushColormap/PopColormap and is used by Application.cpp).
Did anyone manage to compile it on macos using provided instructions in readme? I get the following errors (on MacOS Big Sur)
[ 92%] Building CXX object examples/CMakeFiles/puzzometry.dir/ex_puzzometry.cpp.o
/Users/patryk/Developer/compile/mahi-gui/examples/ex_puzzometry.cpp:738:25: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
ImGui::Text(matStr.c_str());
^~~~~~~~~~~~~~
/Users/patryk/Developer/compile/mahi-gui/examples/ex_puzzometry.cpp:738:25: note: treat the string as an argument to avoid this
ImGui::Text(matStr.c_str());
^
"%s",
/Users/patryk/Developer/compile/mahi-gui/examples/ex_puzzometry.cpp:810:16: error: the expression 'co_await __promise.final_suspend()' is required to be non-throwing
Enumerator transition(Coord to_coord, int perm, float duration) {
^
/Users/patryk/Developer/compile/mahi-gui/build/_deps/mahi-util-src/include/Mahi/Util/Coroutine.hpp:84:53: note: must be declared with 'noexcept'
SuspendAlways final_suspend();
^
/Users/patryk/Developer/compile/mahi-gui/examples/ex_puzzometry.cpp:856:25: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
ImGui::Text(matStr.c_str());
^~~~~~~~~~~~~~
/Users/patryk/Developer/compile/mahi-gui/examples/ex_puzzometry.cpp:856:25: note: treat the string as an argument to avoid this
ImGui::Text(matStr.c_str());
^
"%s",
/Users/patryk/Developer/compile/mahi-gui/examples/ex_puzzometry.cpp:954:10: warning: 'update' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
void update() {
^
/Users/patryk/Developer/compile/mahi-gui/include/Mahi/Gui/Application.hpp:166:18: note: overridden virtual function is here
virtual void update() { /* nothing by default */ }
^
/Users/patryk/Developer/compile/mahi-gui/examples/ex_puzzometry.cpp:925:16: error: the expression 'co_await __promise.final_suspend()' is required to be non-throwing
Enumerator shuffle() {
^
/Users/patryk/Developer/compile/mahi-gui/build/_deps/mahi-util-src/include/Mahi/Util/Coroutine.hpp:84:53: note: must be declared with 'noexcept'
SuspendAlways final_suspend();
^
/Users/patryk/Developer/compile/mahi-gui/examples/ex_puzzometry.cpp:965:73: warning: format specifies type 'int' but the argument has type 'std::vector<std::pair<unsigned long, bool>>::size_type' (aka 'unsigned long') [-Wformat]
ImGui::Text("Solve Time: %d ms | Operations: %d", ms_solve, solver.operations.size(), solver.solutions.size());
~~ ^~~~~~~~~~~~~~~~~~~~~~~~
%lu
/Users/patryk/Developer/compile/mahi-gui/examples/ex_puzzometry.cpp:965:99: warning: data argument not used by format string [-Wformat-extra-args]
ImGui::Text("Solve Time: %d ms | Operations: %d", ms_solve, solver.operations.size(), solver.solutions.size());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/Users/patryk/Developer/compile/mahi-gui/examples/ex_puzzometry.cpp:1056:16: error: the expression 'co_await __promise.final_suspend()' is required to be non-throwing
Enumerator animateSolution() {
^
/Users/patryk/Developer/compile/mahi-gui/build/_deps/mahi-util-src/include/Mahi/Util/Coroutine.hpp:84:53: note: must be declared with 'noexcept'
SuspendAlways final_suspend();
^
5 warnings and 3 errors generated.
make[2]: *** [examples/CMakeFiles/puzzometry.dir/ex_puzzometry.cpp.o] Error 1
make[1]: *** [examples/CMakeFiles/puzzometry.dir/all] Error 2
make: *** [all] Error 2
Plotting in real time mode 4 channels (items) with PlotItemBufferPoint max_points at 4096 will crash after some time.. (around 128[s])
void AddDrawListToDrawData(ImVector<ImDrawList*>, ImDrawList): Assertion `draw_list->_VtxCurrentIdx < (1 << 16) && "Too many vertices in ImDrawList using 16-bit indices.
In order to solve the issue, is there any other solution than uncomment '#define ImDrawIdx unsigned int' line in imconfig.h." ?
When I was writing #6, I noticed that you offered a ClangFormat specification. When I tried to use it, I noticed that imgui_plot.cpp
does not apply the specified style. ClangFormat reformatted the entire file (and even made it unusable).
It's great to offer a .clang-format
in your repository. I like working with auto-formatting a lot. It allows you to focus on what you want to write instead of how to indent it. It would be great if you could reformat all the files in the repository with ClangFormat, so the tools can actually be used.
Hello, I love the concept of this meta-library to easily integrate ImGui and GLFW with other related packages. I installed it with CMake FetchPackage() as described in the README, but the version of ImGui it pulls in to my project is v1.80 WIP.
Are there simple instructions anywhere on how to rebuild Mahi-Gui but with the most recent commits of the dependent libraries like ImGui v1.88? Unfortunately, my application which runs fine in a stand-alone instance with ImGui 1.88 fetched via vcpkg suffers from a couple missing features and strange assert() failures after moving it into a Mahi-Gui instance based on the older ImGui 1.80. Thanks!
Ubuntu 19.10
4k display
Using imgui example_sdl_opengl3
with new mahi gui window :
Dragging mouse 1 mm
higher cause the bar to disappear:
The only thing i modified in mahi-gui sources is the line in:
https://github.com/mahilab/mahi-gui/blob/master/src/Mahi/Gui/imgui_plot.cpp#L168
removed ternary operator for highlited
field due to compilation error.
On Catalina 10.15.7, compiling with the standard clang
, i.e.
Apple clang version 12.0.0 (clang-1200.0.32.27)
I can compile the Puzzometry example, but it crashes when I try to run it with a generic segmentation fault error.
Hi!
I'm using MSYS2 / mingw-w64 and have 3 minor issues when building with either GCC or clang.
Steps to reproduce:
pacman -Syu mingw-w64-x86_64-clang
pacman -Syu mingw-w64-x86_64-cmake
pacman -Syu mingw-w64-x86_64-ninja
# clang version 10.0.1 (https://github.com/Alexpux/MINGW-packages.git 94b687508346d10cec7e8c769785f73da18b4e54)
# Target: x86_64-w64-windows-gnu
# Thread model: posix
# InstalledDir: C:\msys64\mingw64\bin
mkdir build && cd build
CC=clang CXX=clang++ cmake .. -G"Ninja"
ninja
_deps/mahi-gui-src/src/Mahi/Gui/nanovg_custom.cpp:14:12: error: no member named 'memcpy' in namespace 'std'; did you mean 'wmemcpy'?
using std::memcpy;
~~~~~^~~~~~
wmemcpy
C:\msys64\mingw64\include\c++\10.2.0\cwchar:201:11: note: 'wmemcpy' declared here
using ::wmemcpy;
^
1 error generated.
_deps/mahi-gui-src/src/Mahi/Gui/Application.cpp:24:12: error: no member named 'memcpy' in namespace 'std'; did you mean 'wmemcpy'?
using std::memcpy;
~~~~~^~~~~~
wmemcpy
C:\msys64\mingw64\include\c++\10.2.0\cwchar:201:11: note: 'wmemcpy' declared here
using ::wmemcpy;
^
1 error generated.
-> Both are easily fixed by adding #include <cstring>
_deps/mahi-util-src/src/Mahi/Util/System.cpp:344:15: error: no member named 'GetFileVersionInfoSizeExW' in the global namespace
::GetFileVersionInfoSizeExW(FILE_VER_GET_NEUTRAL, system, &dummy);
~~^
_deps/mahi-util-src/src/Mahi/Util/System.cpp:344:41: error: use of undeclared identifier 'FILE_VER_GET_NEUTRAL'
::GetFileVersionInfoSizeExW(FILE_VER_GET_NEUTRAL, system, &dummy);
^
_deps/mahi-util-src/src/Mahi/Util/System.cpp:346:11: error: no member named 'GetFileVersionInfoExW' in the global namespace
::GetFileVersionInfoExW(FILE_VER_GET_NEUTRAL, system, dummy, (DWORD)buffer.size(), &buffer[0]);
~~^
_deps/mahi-util-src/src/Mahi/Util/System.cpp:346:33: error: use of undeclared identifier 'FILE_VER_GET_NEUTRAL'
::GetFileVersionInfoExW(FILE_VER_GET_NEUTRAL, system, dummy, (DWORD)buffer.size(), &buffer[0]);
^
4 errors generated.
I fixed this by using the non-ex variants GetFileVersionInfoSizeW
and GetFileVersionInfoW
and omitting the FILE_VER_GET_NEUTRAL
flag.
The demo application runs fine after these fixes (with both GCC, clang and make or Ninja as a build Tool).
Should I send a pull request, or could you implement and test those fixes yourself?
I'm unsure about the 3rd point. What's the reason for FILE_VER_GET_NEUTRAL
?
Hello Evan,
FYI, I tested your master (the SVG part is incredibly interesting btw) and I had some little issues building on Linux (x86_64, linuxmint):
More precisely, I hit:
Please consider that every changes I propose are under MIT license.
On my side, the build is 100% warning free and no more broken, but what works here, is maybe either wrong or not working for you. So feel free to use whatever you consider correct in this diff, and thanks again for sharing your code : I learn a lot with it !
The patch (don"t forget to rename it removing the .txt extension though):
Cannot find source file:
imgui_plot_ex.cpp
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
.hpp .hxx .in .txx
CMake Error at examples/CMakeLists.txt:30 (add_executable):
No SOURCES given to target: imgui_plot```
I am new to Dear Imgui and I came across the Mahi GUI library as a starter kit. I started going thru the examples and immediately noticed that the fonts are a tad blurry. I am on OSX with the Retina monitor. I downloaded the Syntacts app just in case and saw the same issue with it:
I saw there's a DPI example in Mahi GUI, but it looks like it does not actually change the scaling factor, the reported DPI scale is still 1.0 when I pass the -d
option there.
In the end, my question is, can I somehow make the fonts look sharper?
Hello,
Thanks for sharing your code, very interesting.
I filled this issue, because I'm trying to build your example on Linux x86_64,gcc-7 / g++-7 on Linuxmint 19.2, and cmake broke directly :(
The command line (from inside the build directory I created in the root dir):
cmake -G "Unix Makefiles" ..
I forgot : I'm using cmake 3.15
~ $ cmake --version
cmake version 3.15.3
CMake suite maintained and supported by Kitware (kitware.com/cmake).
~ $ g++-7 --version
g++-7 (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
The errors now:
Error 1
-- Looking for strtod_l - not found
On Linux, strtod_l islocated in stdlib.h + _GNU_SOURCE must be defined. Looks strange, probably yet another CMake issue ...
~ $ egrep -Hr strtod_l /usr/include
/usr/include/x86_64-linux-gnu/bits/stdlib-ldbl.h:__LDBL_REDIR1_DECL (strtold_l, strtod_l)
/usr/include/stdlib.h:extern double strtod_l (const char *__restrict __nptr,
FYI I tested that :
@@ -35,7 +35,7 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake")
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3") # ALL WARNINGS
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GNU_SOURCE -Wall -O3") # ALL WARNINGS
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") # MULTICORE BUILDS
... without success :-/
Error 2
Coroutines not supported by this compiler!
What are those coroutines ? The first information I found on the topic is https://www.phoronix.com/scan.php?page=news_item&px=Cpp20-Coroutines-GCC-10.
More strange, even and cmake wrote (see below):
Using GTK version: 3.22.30
-- Version: 6.1.3
-- Build type:
-- CXX_STANDARD: 11
-- Performing Test has_std_11_flag
-- Performing Test has_std_11_flag - Success
-- Performing Test has_std_0x_flag
-- Performing Test has_std_0x_flag - Success
I'm sorry, I don't understand :-/
Error 3
CMake Error at build/_deps/mahi-util-src/CMakeLists.txt:100 (add_subdirectory):
add_subdirectory given source "src/mahi/util" which is not an existing
directory.
Sorry, but maybe something not defined in the CMakefile ?
Error 4
./build/_deps/mahi-util-src/3rdparty/fmt/include/fmt/os.h:#include <cstdlib> // for strtod_l
./build/_deps/mahi-util-src/3rdparty/fmt/include/fmt/os.h: static double strtod_l(const char* nptr, char** endptr, _locale_t locale) {
./build/_deps/mahi-util-src/3rdparty/fmt/include/fmt/os.h: return _strtod_l(nptr, endptr, locale);
./build/_deps/mahi-util-src/3rdparty/fmt/include/fmt/os.h: double result = strtod_l(str, &end, locale_);
strtod_l is defined in stdlib.h.
Where can I change that to make cmake successfull (at least fix this false positive ?
Error 5
CMake Error at CMakeLists.txt:121 (add_subdirectory):
add_subdirectory given source "src/mahi/gui" which is not an existing
directory.
?? Maybe my fault ?
FYI, I checked out your repo out using :
git clone --recursive https://github.com/mahilab/mahi-gui.git
Is something wrong ? Wouldn't it more portable-ich to make it work with older compilers and C++x11 as Dear ImGui pretends ?
Thanks in advance for your help :-)
in the current imgui_plot we have to input the min and max value for y-axis.
How can we do it dynamically, that means the range will be calculated in depending the y-values?
Thanks
Is there a specific reason to disable this?
I commented out the checks to build a simple python module and there where no immediate issues.
If it is because it is untested I believe this should be a warning and not an error.
Affects other mahi projects as well...
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.