package bogue

  1. Overview
  2. Docs

Control the workflow of the GUI mainloop

Dependency graph
type board

The board is the whole universe of your GUI. It contains everything.

exception Exit

Raising the Exit exception will tell the GUI loop to terminate.

val exit_on_escape : int * int * (board -> unit)

If the exit_on_escape shortcut is given to the make function, then the Exit exception will be raised upon pressing the Escape key.

val make : ?shortcuts:(int * int * (board -> unit)) list -> Widget.connection list -> Layout.t list -> board

Create a board from a list of layouts and connections. The list of connections can be empty, because connections can be added afterwards. Each Layout in the list will open as a new window. The optional argument shortcuts is a list of shortcut triples of the form keycode, keymod, action.

val run : ?before_display:(unit -> unit) -> ?after_display:(unit -> unit) -> board -> unit

Launch the main loop.

Using Bogue together with another graphics loop

See the embed example.

val make_sdl_windows : ?windows:Tsdl.Sdl.window list -> board -> unit

This is only useful if you have your own graphics loop, and do not use run. This function creates an SDL window for each top layout in the board. One can use predefined windows with the optional argument windows. They will be used by the layouts in the order they appear in the list. If there are fewer windows than layouts, new windows are created. If there are more, the excess is disregarded.

val refresh_custom_windows : board -> unit

Ask the GUI to refresh (ie. repaint) the custom windows (those that were not created by Bogue itself).

val one_step : ?before_display:(unit -> unit) -> bool -> ((unit -> unit) * (unit -> unit)) -> ?clear:bool -> board -> bool

This is only useful if you have your own graphics loop, and do not use run. Calling one_step ~before_display anim (start_fps, fps) ~clear board is what is executed at each step of the Bogue mainloop. If anim=true this step is non blocking; this is what you want if either Bogue or your loop has an animation running. If anim=false then the function will wait until an event is received.

  • returns

    true if the GUI currently handles an animation. In this case fps() was executed by one_step. If not, you should handle the frame rate yourself.

val get_frame : unit -> int

Number of displayed frames since startup.

val quit : unit -> unit

Use this to close SDL windows and cleanup memory, after run has returned.