A set of libraries for UI development.
Project description
About
This is just a utility project to help quickly bring in dependencies that I usually use in my personal projects. It also contains a little bit of OpenGL code to compile shaders, open nicer looking fonts in ImGui, store user settings in a sensible place, and get rid of entry point boiler plate. This library comes in two flavors: the C++ interface (for desktop and web browser platforms) and Python. The two flavors are a bit different in some ways, but for the most part they are just a packaged interface to GLFW, OpenGL ES 2, ImGui and ImPlot. There is little to no abstraction layers in place. If you already know the GLFW, OpenGL and ImGui APIs, learning to use this library is easy.
C++ Interface
In order to use this project with C++, you'll need to compile it and link to it.
In order to compile it, you'll need to have CMake installed and an active vcpkg repository.
You'll need to set the environment variable VCPKG_ROOT to where the initialized vcpkg repository is.
Finally, you'll need to ensure you have the dependencies installed:
./vcpkg install glfw openal-soft pybind11
Note: The OpenAL dependency may get dropped in a future release.
Add this project as a sub directory in CMake either by installing it with FetchContent or by adding it as a git submodule and calling add_subdirectory(uikit).
Link to uikit::uikit and uikit::main (contains the entry point code) and start your application like this:
#include <uikit/main.hpp>
#include <imgui.h>
// optionally
#include <GLES2/gl2.h>
namespace {
class app_impl final : public app
{
public:
void setup(uikit::platform& plt) override { plt.set_app_name("My Demo App"); }
void teardown(uikit::platform& plt) { }
void loop(uikit::platform& plt) {
// In setup() you can disable auto-close with uikit::platform::set_auto_close_enabled and allow the application to
// decide when to exit.
//
// if (plt.exit_requested()) {
// plt.queue_exit();
// }
ImGui::Begin("Test");
ImGui::End();
}
};
} // namespace
namespace uikit {
auto create_app() -> std::unique_ptr<app> { return std::unique_ptr<uikit::app>(new app_impl()); }
} // namespace uikit
The Python Interface
You can also use this project in Python on both Linux and Windows.
Clone the repository and run:
pip install path/to/uikit
Where uikit is the path to the repository.
It works just fine in virtual environments as well.
In a Python file, you can import uikitpy which contains submodules for OpenGL ES 2, GLFW, ImGui, ImPlot and portable-file-dialogs.
import uikit.gl as gl
import uikit.glfw as glfw
import uikit.imgui as imgui
import uikit.implot as implot
import uikit.pfd as pfd
def main():
glfw.init()
window = glfw.create_window()
while not window.should_close():
glfw.poll_events()
window.begin_frame()
if imgui.begin('Main Window'):
if imgui.button('Click me!'):
print('Button was clicked!')
imgui.end()
window.end_frame()
window.close()
glfw.terminate()
main()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file uikitpy-0.2.0.tar.gz.
File metadata
- Download URL: uikitpy-0.2.0.tar.gz
- Upload date:
- Size: 473.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2914278323aeae69f3f42f98e4ea99c79f13ed264d7d87baf65cfb14efeeda0f
|
|
| MD5 |
0b90e108a0eb59713b3b209a1e86db71
|
|
| BLAKE2b-256 |
6a22bde0f3e7b78a6c7405522e034bd2fa1cb51873cc18f1422cc39238059382
|
File details
Details for the file uikitpy-0.2.0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: uikitpy-0.2.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 968.2 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1aaeb3da7cb549a48ab2f6813819ba67786a293678a6588aec5719e2271466f7
|
|
| MD5 |
2092a8513e26667cc692d249a6b83cac
|
|
| BLAKE2b-256 |
36d43e9050a3d07d5dd434a248606ca7bfe25946ac29922916cc6a389ee59899
|