btEventLoop()

libbtng API Reference: btEventLoop()

Run the event loop of GUI programs. btEventLoop() does two things: it implements a timer that periodically calls the cb callback function, and it captures events via the SDL event system and routes them to the ecb event callback function. The timer may be used to implement periodic screen refreshs. The event callback is used to handle user interaction.

Syntax

void btEventLoop(EventCallback *ecb, Callback *cb, Uint32 fps, void *data);

Parameters

  • ecb: an EventCallback function pointer. This function is being called on every event that occurs, and should handle this particuar event. btEventLoop() finishes when ecb returns TRUE.
  • cb: a Callback function pointer. This function is being called at intervals given by the fps parameter.
  • fps: the number of frames per second. This determines the frequency cb is being called.
  • data: this is a pointer a user defined data structure that is passed as parameter to the ecb and cb callbacks when they are called.

Return Value

None. A return value may be implemented within the user data struct (data).

Remarks

btEventLoop() finishes when the application window receives a close event or the ecb event callback returns a value different from 0. See also btModalEventLoop().