Module application

The application module contains the central type to the Dadren engine the AppObj and its Ref type App.The App serves a few primary roles for the game author:

  • Loading configuration and assets
  • Running the main loop
  • Calling user event handlers
The App is initialized by passing the filename of a settings file which contains the needed information.

Types

AppSettings = object
  title*: string
  scale*: float
  vsync: bool
  accelerated: bool
  resolution*: Resolution
AppObj = object
  settings*: AppSettings
  resources*: ResourceManager
  scenes*: SceneManager
  window*: WindowPtr
  display*: RendererPtr
  clock*: Clock
  running*: bool
App = ref AppObj

Procs

proc getLogicalSize(app: App): Size {.raises: [], tags: [].}
proc newApp(settings: AppSettings): App {.raises: [Exception],
                                      tags: [TimeEffect, RootEffect].}
proc newApp(width, height: int; title: string; scale = 1.0'f64; vsync = true;
           accelerated = true): App {.raises: [Exception],
                                  tags: [TimeEffect, RootEffect].}
proc clear(app: App; r, g, b: uint8) {.raises: [], tags: [].}
proc run(app: App; first_scene: Scene) {.raises: [Exception],
                                    tags: [RootEffect, TimeEffect].}