TinyUI 0.0.2
A small ui-lib for game development
Loading...
Searching...
No Matches
TinyUI

tiny_ui

A lightweight C++23 UI library for Windows and Linux, using SDL2 as the renderer.

Features

  • Widgets:
    • Panel
    • Button
      • Text
      • Images
    • Label
    • Progress Bar
    • Imageview
    • Checkboxes / Selectionboxes
    • Tree-View (experimental)
    • Input-Field (experimental)
    • Status Bar
    • Standard-Dialogs
      • Open-File-Dialog
      • Save-File-Dialog
  • Platforms:
    • Windows
    • Linux

Build

# Configure and build
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release

Samples

You can check out samples at Samples-Section

Quick Start

int quit(WidgetHandle, void *instance) {
if (instance != nullptr) {
auto *ctx = static_cast<Context *>(instance);
ctx->mRequestShutdown = true;
return ResultOk;
}
return ErrorCode;
}
int main(int argc, char *argv[]) {
if (Style style = TinyUi::getDefaultStyle(); !TinyUi::createContext("Sample-Screen", style)) {
return -1;
}
if (TinyUi::initScreen(20, 20, 1024, 768) == -1) {
const auto &ctx = TinyUi::getContext();
ctx.mLogger(LogSeverity::Error, "Cannot init screen");
return ErrorCode;
}
constexpr int32_t ButtonHeight = 18;
WidgetHandle rootPanel = Widgets::panel(WidgetHandle::getRootHandle(), "Sample-Dialog", Rect(90, 5, 220, 60), nullptr);
if (!panel.isValid()) {
const auto &ctx = TinyUi::getContext();
ctx.mLogger(LogSeverity::Error, "Cannot create panel");
return ErrorCode;
}
auto &ctx = TinyUi::getContext();
auto *dynamicQuitCallback = new CallbackI(quit, (void*) &ctx);
Widgets::label(rootPanel, "Hi, World!", Rect(100, 10, 200, ButtonHeight), Alignment::Center);
Widgets::textButton(rootPanel, "Quit", Rect(100, 30, 200, ButtonHeight), Alignment::Center, dynamicQuitCallback);
while (TinyUi::run()) {
TinyUi::render();
}
TinyUi::release();
return 0;
}

Running the Sample

./bin/release/tiny_ui_sample.exe # Windows
./bin/tiny_ui_sample # Linux

results to

Sample

Planned

  1. Layouter
  2. Copy & Paste
  1. Groups
  2. Tabs
  3. Engine Integration examples
  4. Tutorials

CMake Quality Gate