Skip to content

ohmtal/BaseFlux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BaseFlux - Minimalist SDL3 and ImGui base library

Base to build an cross platform Application or Prototype with SDL3 and ImGui.

Features

  • 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

Prepare Example

  • 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

CMake in Projects

  • demo: cmake example with setting a path to BaseFlux
  • demo2: cmake with fetch content BaseFlux

Implement

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;
}

Demo with cmake build system:

Compile and run :

cd demo
cmake -S . -B build
cmake --build build
./BaseFluxDemo

BaseFlux Demo Screenshot

About

Minimalist SDL3 and ImGui base. I use this for fast setup to prototype ideas.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors