Base to build an cross platform Application or Prototype with SDL3 and ImGui.
- Building:
- Easy building as lib with cmake including static SDL3 and ImGui.
- Main
- Initialize SDL and ImGui bases on the Settings
- Settings setup also the asset path with aliases: base:/ and pref:/
- Loading Textures wrapper (bmp/png)
- Set Window Icon
- Event driven system: OnRender, OnEvent and OnShutDown
- Managers (since 2026-04-23)
- TexturesManager save textures in a map for rendering and garbage collection
- AudioManager save Wave-Files in a map for loading, playing and garbage collection
- create a new folder with a sub folder src
- copy CMakeLists.txt from demo to you new folder
- create a new empty main.cpp in src
- demo: cmake example with setting a path to BaseFlux
- demo2: cmake with fetch content BaseFlux
Only five steps to get it work:
- set your custom settings like Caption, Company ..
- InitSDL
- InitImGui
- Setup Render and optional other Event Callbacks
- Execute
//-----------------------------------------------------------------------------
// BaseFlux Demo main.cpp
//-----------------------------------------------------------------------------
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>
#include "imgui.h"
#include "BaseFlux/Main.h"
int main(int argc, char* argv[]) {
BaseFlux::Main app;
app.getSettings() = {
.Caption = "My App"
};
if ( !app.InitSDL() ) return 1;
app.initImGui();
app.OnRender = [&](SDL_Renderer* renderer) {
if (ImGui::Begin("Hello World"))
{
if (ImGui::Button("Close")) app.TerminateApplication();
}
ImGui::End();
};
app.Execute();
return 0;
}
Compile and run :
cd demo
cmake -S . -B build
cmake --build build
./BaseFluxDemo
