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
local display = getDisplayByName("message"); display:enableShadows(true);
Display:expire
- in int time
- out void
Display:hide
- in void
- out void
example
local display = getDisplayByName("timeLeft"); display:hide();
Display:move
- in int x
- in int y
- out void
Display:new
- in string name
- in int x
- in int y
- in int displayType
- out Display
you can use any of the DISPLAY_XXXX constants for ``type``.
DISPLAY_TIME_LEFT DISPLAY_MESSAGE DISPLAY_SCORE DISPLAY_LIVES DISPLAY_HP
after adding a new display also remember to set it visible using the show() function.
local display = Display:new( "petImage", 60, 60, DISPLAY_IMAGE); displaySetImage(display.id, IMAGES_ANNIE_OBL , 0 ); display.show();
see addDisplay for sample usage.
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
local score = getDisplayByName("score"); score:setColor(0xff, 0xff, 0xff, 0x80); score:setFontSize(24);
Display:setContent
- in void
- out void
Display:setExpireTime
- in int time
- out void
Display:setFlagXY
- in int flagX
- in int flagY
- out void
Display:setFont
- in int fontID
- out void
Display:setFontSize
- in int pxSize
- out void
local display = getDisplayByName("message"); display:setFontSize(20);
Display:setImage
- in int imageSet
- in int imageNo
- out void
See displaySetImage for more details.
Display:setShadowColor
- in int red
- in int green
- in int blue
- in int alpha
- out void
display:setShadowColor(255, 32, 32, 255);
Display:setShadowOffset
- in int tx
- in int ty
- out void
display:setShadowOffset(1,1);
Display:setSize
- in int pxSize
- out void
display:setSize(40);
Display:setTemplate
- in string template
- out void
"%.2d" "%.3d" "%.8d"
Display:setText
- in string text
- out void
Display:setType
- in int displayType
- out void
Display:setXY
- in int x
- in int y
- out void
Display:show
- in void
- out void
example
local display = getDisplayByName("timeLeft"); display:show();
Display:sizeText
- in string text*
- out int size
in parameter text : optional and can be omitted.