Class Display

Description

Displays are overlays on top of the game screen. These can be scores, lives, points or other messages to be passed on to the player during the game.

default displays are

timeLeft
score
debug
pause

These can be customized using lua scripting.

Members

  • int id

Display:enableShadows

  • in bool toggle
  • out void
Enable the shadow under this display. Only applies to text only. If `toggle` is set to true the shadows are displayed otherwise they're not. You can use other methods to redefine how the shadows are shown.

local display = getDisplayByName("message");
display:enableShadows(true);

Display:expire

  • in int time
  • out void
another alias from Display:setExpireTime()

Display:hide

  • in void
  • out void
Hide this display.

example

local display = getDisplayByName("timeLeft");
display:hide();

Display:move

  • in int x
  • in int y
  • out void
this is another alias from Display:setXY

Display:remove

  • in void
  • out void

Display:setAlpha

  • in int alpha
  • out void

Display:setColor

  • in int r
  • in int g
  • in int b
  • in int a
  • out void
This function changes the color of the text contained in the display.

local score = getDisplayByName("score");
score:setColor(0xff, 0xff, 0xff, 0x80);
score:setFontSize(24);

Display:setContent

  • in void
  • out void
same as setText

Display:setExpireTime

  • in int time
  • out void

Display:setFontSize

  • in int pxSize
  • out void
Change the font size of a given text display.

local display = getDisplayByName("message");
display:setFontSize(20);

Display:setShadowColor

  • in int red
  • in int green
  • in int blue
  • in int alpha
  • out void
set the color of the shadow under the text in the display. works for text-only display and ony if shadows have been enabled.

display:setShadowColor(255, 32, 32, 255);

Display:setShadowOffset

  • in int tx
  • in int ty
  • out void
changes the relative position of the shadow under the text. works only in text-only display and only if the shadow was enabled (see. enableShadow(...).

display:setShadowOffset(1,1);

Display:setSize

  • in int pxSize
  • out void
This is an alias Display:setFontSize().

display:setSize(40);

Display:setText

  • in string text
  • out void

Display:setType

  • in int displayType
  • out void

Display:setXY

  • in int x
  • in int y
  • out void
This is just an alias for :move.

Display:show

  • in void
  • out void
Show this display.

example

local display = getDisplayByName("timeLeft");
display:show();

Display:sizeText

  • in string text*
  • out int size
Returns the text size inside a display. The text is optional. If omitted, it will be taken from the display itself.

in parameter text : optional and can be omitted.