Viewer

class Kilosim::Viewer

The Viewer is used to display a Kilosim World. It is instantiated with a pointer to a World, which will be displayed whenever the draw method is called. After constructing your Viewer, this is the only method you need to call to use it.

Public Functions

Viewer(World &world, const int window_width = 1080)

Create a Viewer with the pointer to the given world

Parameters
  • world – Pointer to the World that will be displayed

  • window_width – Width (in pixels) to draw the display window. Height will be automatically determined from the aspect ratio of the World’s dimensions.

void draw()

Draw everything in the world at the current state

This will display all robots and the light pattern (if set; otherwise black). It is frame rate limited to 144 FPS, which limits the overall rate at which the simulation can run. If the window is closed, the simulation will continue to run but the window will not reopen.