Banner

Extends: BGE.UI.UiWidget

A line of text centered on a dark band across the screen that fades in, holds and fades out - for "Boss defeated", level names and the like. show() it; it hides itself.

Add it to gameUi (it draws across the whole UI canvas, centerY of the way down), or call update() and drawOn() yourself.

Properties

  • textColor (integer)
  • bandColor (integer) — The band's color at full opacity.
  • fontName (string) — Font key ("heading", falling back to "default").
  • fadeInSeconds (float)
  • fadeOutSeconds (float)
  • centerY (float) — The band's middle, as a fraction of the canvas height.
  • bandLines (float) — The band's height in text lines.

Example

CODE
banner = new BGE.UI.Banner(game)
game.gameUi.addChild(banner)
banner.show("The Crypt", 3)

Constructor

new Banner(game: BGE.Game): Banner

Parameters


Instance Methods

show(text: string, seconds?: float): void

Shows text for seconds in all, fades included. Replaces any banner showing.

Parameters

  • text (string)
  • seconds (float, optional, default: "3.0")

Returns

  • void

hide(): void

Hides the banner at once.

Returns

  • void

isShowing(): boolean

Is a banner showing?

Returns

  • boolean

getText(): string

The text shown last.

Returns

  • string

getOpacity(): float

How opaque the banner is now, 0 to 1.

Returns

  • float

update(dt: float): void

Counts the banner down. Called for you when it's in gameUi.

Parameters

  • dt (float) — seconds

Returns

  • void

onUpdate(deltaTime: float): void

Parameters

  • deltaTime (float)

Returns

  • void

draw(parent?: UiWidget): void

Parameters

  • parent (UiWidget, optional, default: "invalid")

Returns

  • void

drawOn(renderer: BGE.Renderer): void

Draws the banner across renderer's canvas.

Parameters

Returns

  • void