Skip to content

ExampleApp ​

struct · #include <rayrai/example_common.hpp>

Minimal SDL/ImGui wrapper for RayraiWindow examples.

Public member functions ​

init ​

cpp
bool init(const char *title, int width, int height, bool visible=true)

Initialize SDL, OpenGL context, and ImGui backends.

Requests a 4.3 core context and falls back to 3.3; enables vsync.

Parameters

ParameterDescription
titleWindow title.
widthWindow width.
heightWindow height.
visibleFalse creates a hidden window (e.g. for headless captures).

Returns True on success.

shutdown ​

cpp
void shutdown()

Shutdown ImGui/SDL resources.

processEvents ​

cpp
void processEvents()

Poll SDL events and update quit flag.

beginFrame ​

cpp
void beginFrame()

Begin a new ImGui frame.

renderViewer ​

cpp
void renderViewer(raisin::RayraiWindow &viewer)

Render the RayraiWindow output into an ImGui window.

Calls viewer.update() at the drawable size, forwarding hover state and the cursor position in drawable pixels, and shows the result full-window.

Parameters

ParameterDescription
viewerRayraiWindow instance to render.

endFrame ​

cpp
void endFrame()

End the ImGui frame and swap buffers.

Public attributes ​

window ​

cpp
SDL_Window *window

Main window (null before init()).

context ​

cpp
SDL_GLContext context

OpenGL context of window.

quit ​

cpp
bool quit

Set by processEvents() when the window is closed.

RaiSim — physics for robotics and AI.