Module engine

Types

PEngine* = ref TEngine
TEngine* = object of TObject
  fRun: bool
  fScreen: TScreen
  fUpdateTimer, fInfoTimer: PTimer
  fUpdateInterval: int
  fFPSLimit: cint
  fInfoText: PText
  state*: PState
  info*, infobg*: bool
  bgColor*: int32

Vars

game*: PEngine

Procs

proc fpsLimit*(obj: PEngine): int {.inline.}
Get FPS limit.
proc `fpsLimit =`*(obj: PEngine; value: int = 60)
Set FPS limit. For unlimited FPS set to < 1.
proc newEngine*(width: int = 640; 
                height: int = 480; 
                flags: int = 0; 
                scale: int = 1; 
                title: cstring = ""; 
                updateInterval: int = 20; 
                fpsLimit: int = 60; 
                info: bool = false; 
                infobg: bool = true; 
                bgColor: TColor = color(0, 0, 0); 
                audio: bool = true; 
                audioFrequency: cint = DEFAULT_FREQUENCY; 
                audioFormat: int = DEFAULT_FORMAT; 
                audioChannels: cint = DEFAULT_CHANNELS; 
                audioChunkSize: cint = 1024): PEngine

width: screen width.

height: screen height.

flags: init flags.

scale: screen scale rate (1 for no-scaling).

title: window caption.

updateInterval: interval of update event in ms.

fpsLimit: frames per second limit. For unlimited FPS set to < 1.

info: true to show info panel.

infobg: true to show info on black background.

bgColor: screen background color.

audio: true to use audio system.

audioFrequency: audio sampling frequency in samples per second (Hz).

audioFromat: audio sample format.

audioChannels: number of sound channels (2 for stereo, 1 for mono).

audioChunkSize: bytes used per sample.

proc switchInfo*(obj: PEngine) {.inline.}
Turn on/off info panel.
proc flip*(obj: PEngine) {.inline.}
proc start*(obj: PEngine)
Start main cycle.

Methods

method free*(obj: PEngine)
method run*(obj: PEngine): bool {.inline.}
method `run =`*(obj: PEngine; value: bool) {.inline.}
method stop*(obj: PEngine) {.inline.}
Generated: 2012-11-12 11:09:53 UTC