Up: Blackthorn API Reference

Package blackthorn-user

Provides the game driver and encapsulates user configuraiton. Also provides a sandbox for evaluation of input from the REPL.









About This Package

Main initializaion
Main game loop
User initialization
User draw step
User update step

Main initializaion

The function main is called automatically at the start of every game. The operations performed by main during initialization are as follows:
  • Load SDL DLLs or SOs.
  • Create the database, if any.
  • Initialize SDL.
  • Initialize the REPL.
  • Autoload graphics resources.
  • Call game-init if it has been defined (see below).
Main then proceeds to execute the game loop (see below).

Main game loop

The main game loop is executed in main, a function which is automatically called at the start of the game. The operations performed by main during the game loop are as follows:
  • Pump SDL events (e.g. keyboard events, etc). Quits upon receiving the quit event from SDL.
  • Render the root object.
  • Draw the REPL.
  • Call game-draw if it has been defined (see below).
  • Update the display window.
  • Setup the pathfinding grid for this step.
  • Update the root object.
  • Call game-update if it has been defined (see below).

User initialization

The game-init function may be provided by the user to define game-specific initialization behavior. If defined, it will be called automatically during game initialization (see above).

User draw step

The game-draw function may be provided by the user to define game-specific drawing behavior. If defined, it will be called automatically during the game loop (see above).

User update step

The game-update function may be provided by the user to define game-specific update behavior. If defined, it will be called automatically during the game loop (see above).

Exported Symbol Index

main, function