About assets
HelloImGui and ImmApp applications rely on the presence of an assets
folder.
The typical layout of an assets folder looks like this:
assets/
+-- app_settings/ # Application settings
| +-- icon.png # This will be the app icon, it should be square
| | # and at least 256x256. It will be converted
| | # to the right format, for each platform (except Android)
| +-- apple/
| | +-- Info.plist # macOS and iOS app settings
| | # (or Info.ios.plist + Info.macos.plist)
| |
| +-- android/ # Android app settings: any file placed here will be deployed
| | |-- AndroidManifest.xml # (Optional manifest, HelloImGui will generate one if missing)
| | +-- res/
| | +-- mipmap-xxxhdpi/ # Optional icons for different resolutions
| | +-- ... # Use Android Studio to generate them:
| | # right click on res/ => New > Image Asset
| +-- emscripten/
| |-- shell.emscripten.html # Emscripten shell file
| | # (this file will be cmake "configured"
| | # to add the name and favicon)
| +-- custom.js # Any custom file here will be deployed
| # in the emscripten build folder
+-- fonts/
| +-- DroidSans.ttf # Default fonts used by HelloImGui to
| +-- fontawesome-webfont.ttf # improve text rendering (esp. on High DPI)
| | # if absent, a default LowRes font is used.
| |
| +-- Roboto/ # Optional: fonts for markdown
| +-- LICENSE.txt
| +-- Roboto-Bold.ttf
| +-- Roboto-BoldItalic.ttf
| +-- Roboto-Regular.ttf
| +-- Roboto-RegularItalic.ttf
| +-- SourceCodePro-Regular.ttf
+-- images/
+-- markdown_broken_image.png # Optional: used for markdown
+-- world.png # Add anything in the assets folder!
You can change the assets folder:
-
during the execution, via
HelloImGui::SetAssetsFolder
(C++) orhello_imgui.set_assets_folder
(python). -
at compile time, via
imgui_bundle_add_app(app_name file.cpp ASSETS_LOCATION "path/to/assets")
(C++ only)
Where to find the default assets
Look at the folder imgui_bundle/bindings/imgui_bundle/assets to see their content.
Where to place your assets folder
Python
Place it into your execution folder (C++ and python), or call hello_imgui.set_assets_folder()
at startup.
C++
Place the assets/ folder besides your CMakeLists.txt, and it will be deployed into the execution folder automatically ().
When using cmake, you can also specify a custom assets folder via imgui_bundle_add_app(app_name file.cpp ASSETS_LOCATION "path/to/assets")
You can also call HelloImGui::SetAssetsFolder
at startup.
App icon
The app icon is defined by the file icon.png
in the assets/app_settings
folder. It should be square and at least 256x256 (but 512x512 is preferred).
C++
With C++, icon.png
will define the application icon as well as the window icon. It will be converted to the right format for each platform by CMake (via imgui_bundle_add_app
).
Python
With Python, icon.png
will define the window icon, on platforms that supports this (i.e. Windows and Linux, but not macOS).
It will not define the application icon.
If you wish to ship an application with a given icon, you should use a tool like pyinstaller
to create a standalone executable. See the pyinstaller documentation for more information.
See this demo for an example showing how to package a python application.
App settings
macOS and iOS, (C++ only)
The app settings are defined by the file Info.plist
in the assets/app_settings/apple
folder.
You can copy and edit this example by adding your own settings (replace ${HELLO_IMGUI_BUNDLE_XXX}
by your own values).
You can also specify different settings for macOS and iOS via Info.macos.plist
and Info.ios.plist