- Notifications
You must be signed in to change notification settings - Fork4
A dockerized version of Dear ImGui
License
ZenSepiol/Dear-ImGui-App-Framework
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This repository is used to create simple applications based on Dear ImGui. It tries to keep dependencies to a minimum, and offer a fast and easy solution to build C++ apps with GUI.
This version of the App framework usesGLFW andOpenGL as backend.As a testing frameworkCatch2 is included.As buildsystemmeson is used.
Inlib is the library code and inapp are examples on the usage.The framework itself can be foundhere. It includes the necessary backend calls to GLFW as well as OpenGL. The color schemes and the window handler are also part of the framework. They can be overriden or adapted as needed.
An example of a app based on the framework can be foundhere. In order to develop a custom app, usually it is only required to adaptapp.hpp
. Additional source files that need compilation can be added in themeson application description.
Since it is often useful to have additional classes and tests for them, the testing framework CATCH2 is already included. An example of how to create an module and write tests is availablehere. It is important to add the subdirectory to themeson.build file in the root directory.
The following packages are needed to run build and run the application:
apt-get install -y bash libglfw3 libglfw3-dev xorg-dev libxkbcommon-dev meson clang git cmake libssl-dev cmakeapt-get install --yes --no-install-recommends wget build-essential libcurl4 && \ wget https://curl.se/download/curl-7.81.0.tar.gz && \ tar -xvf curl-7.81.0.tar.gz && cd curl-7.81.0 && \ ./configure --with-openssl && make && make install
Additionally, it is necessary to clone Dear ImGui and ImPlot:
git clone --depth 1 --branch v1.88 https://github.com/ocornut/imgui.git /imgui git clone --depth 1 --branch v0.14 https://github.com/epezent/implot.git /implot
Useful commands for building and running the application.
# Setup the build directorymeson setup builddir --native-file=native.build# Compile the applicationninja -C builddir src/app/sample_app/sample_app# Run the application./builddir/src/app/sample_app/sample_app# Run all testsninja -C builddir testmeson test -C builddir# Running a specific testninja -C builddir src/app/sample_app/sample_module/sample_module_test && ./builddir/src/app/sample_app/sample_module/sample_module_testmeson test -C builddir -v sample_module_test
This repository is designed for an easy-to-use and portable way to use Dear ImGui. It containsDear ImGui andImPlot.The application is compiled and run inside a docker container. During the execution of the application, the X-server of the host system is connected and the output display is forwarded to the host system.
The only requirement to run the sample project is docker and a Debian based Linux environment (e.g. Ubuntu) that runs X-server.
To install docker you can find more informationhere
Using the install script allows easy installation of docker.
curl -fsSL https://get.docker.com -o get-docker.shsudo sh ./get-docker.sh --dry-run
Afterwards
# Prepare the imagedocker compose build# Setup the build directorydocker compose run console meson setup builddir /code --native-file=native.build# Compile the applicationdocker compose run console ninja -C builddir# Run the applicationdocker compose run gui builddir/src/app/sample_app/sample_app# Run testsdocker compose run console ninja -C builddir testdocker compose run console meson test -C builddir -v `test_name`# Useful aliasesalias setup="docker compose run console meson setup builddir /code --native-file=native.build"alias console="docker compose run console"alias build="docker compose run console ninja -C builddir"alias run="docker compose run gui"alias all_tests="docker compose run console ninja -C builddir test"alias test="docker compose run console meson test -C builddir -v"
The sample application is stored inapp.hpp and can be extended.For a longer term development it is recommend to create an own application.
Docker compose is used to setup two different services using the same docker image. The description of both services can be found indocker-compose. One service calledconsole
is used for any interaction where no gui is required. The other service calledgui
is used for commands that require gui output.gui
is connecting to the X-server of the host system and forwarding the output to the display of the host system. E.g. the application is running inside the docker container, but the output is displayed for any normal appliciation.
The dockerfile provided creates an image including all necessary dependencies. If additional dependencies are introduced, it is necessary to adapt thedockerfile (docker image) accordingly.
If you have problems getting the error messageGlfw Error 65544: X11: Failed to open display :0
try runningxhost +
first in your console.
If you do not want to share the X server to the host, it is possible to disable the MIT-SHM support for the X server by creating a file/etc/X11/xorg.conf.d/disable-MIT-SHM.conf
with the content.
Section "Extensions" Option "MIT-SHM" "Disable"EndSection
Afterwards it is possible to removenetwork_mode: host
from thedocker-compose.yml
.
It's also possible to run without usingxhost +
by adding this snippet to the dockerfile:
RUN export uid=1000 gid=1000 && \ mkdir -p /home/developer && \ echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \ echo "developer:x:${uid}:" >> /etc/group && \ mkdir -p /etc/sudoers.d && \ echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \ chmod 0440 /etc/sudoers.d/developer && \ chown ${uid}:${gid} -R /home/developerUSER developerENV HOME /home/developer
About
A dockerized version of Dear ImGui
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.