Module CorsixTH.CorsixTH.Lua.graphics

Layer for loading (and subsequently caching) graphical resources.

The Graphics class handles loading and caching of graphics resources. It can adapt as the API to C changes, and hide these changes from most of the other Lua code.

Functions

AnimationManager:AnimationManager (anims) Utility class for setting animation markers and querying animation length.
AnimationManager:setAnimLength (anim, length) For overriding animations which have builtin repeats or excess frames
Graphics:loadFontFile () Tries to load the font file given in the config file as unicode_font.
Graphics:loadMenuFont () Utility function to return preferred font for main menu ui
Graphics:loadPalette (dir, name, transparent_255) Load a palette file
Graphics:loadRaw (name, width, height, dir, paldir, pal, transparent_255) Load a bitmap from a dat file and palette


Functions

AnimationManager:AnimationManager (anims)
Utility class for setting animation markers and querying animation length.

Parameters:

  • anims
AnimationManager:setAnimLength (anim, length)
For overriding animations which have builtin repeats or excess frames

Parameters:

  • anim
  • length
Graphics:loadFontFile ()
Tries to load the font file given in the config file as unicode_font. If it is not found it tries to find one in the operating system.
Graphics:loadMenuFont ()
Utility function to return preferred font for main menu ui
Graphics:loadPalette (dir, name, transparent_255)
Load a palette file

Parameters:

  • dir (string) The directory of the palette relative to the HOSPITAL directory
  • name (string) The name of the palette file
  • transparent_255 (boolean) Whether the 255th entry in the palette should be transparent

Returns:

    (palette, string) The palette and a string representing the palette converted to greyscale
Graphics:loadRaw (name, width, height, dir, paldir, pal, transparent_255)
Load a bitmap from a dat file and palette

Parameters:

  • name (string) The file name of the bitmap without the .dat extension
  • width (int) The width of the bitmap. Defaults to 640
  • height (int) The height of the bitmap. Defaults to 480
  • dir (string) The directory of the bitmap. Defaults to QData
  • paldir (string) The directory of the palette.
  • pal (string) The name of the palette
  • transparent_255 (boolean) Whether the 255th entry of the palette should be transparent
generated by LDoc TESTING Last updated 2015-01-01 12:00:00