CreditsView

Extends: BGE.UI.UiWidget

Credits text: entries of {text, style}, wrapped to the view's width and coloured by style, either scrolling up ("scroll", the default) or laid out from the top ("static"). setFast() speeds a scroll up and skip() jumps to the end; isFinished() says when it's done (a static view is finished once skipped). Lines only draw inside the view.

The view fills the UI canvas's title-safe area unless you set customX/customY/ width/height. Colors per style are in styleColors, fonts in styleFonts (font keys; "body"/"default" when missing).

Properties

  • mode (string) — "scroll" or "static".
  • scrollSpeed (float) — Pixels per second.
  • fastScale (float) — Speed multiplier while setFast(true).
  • styleColors (roAssociativeArray) — Style name -> RGBA.
  • styleFonts (roAssociativeArray) — Style name -> font key.
  • headingGap (float) — Static mode: extra space above each heading after the first.
  • textAlign (string) — Lines are centered ("center") or left-aligned ("left").
  • backgroundRGBA (integer) — Fill drawn behind the text, 0 for none.

Example

CODE
credits = new BGE.UI.CreditsView(game, [
{text: "My Game", style: "title"},
{text: "Code", style: "heading"},
{text: "Me"}
])
scene.addUi(credits)

Constructor

new CreditsView( game: BGE.Game, entries?: Array.<BGE.UI.CreditsEntry>, ): CreditsView

Parameters

  • game (BGE.Game)
  • entries (Array.<BGE.UI.CreditsEntry>, optional, default: "[]")

Instance Methods

setEntries(entries: Array.<BGE.UI.CreditsEntry>): void

Replaces the entries and starts over.

Parameters

  • entries (Array.<BGE.UI.CreditsEntry>)

Returns

  • void

restart(): void

Back to the start.

Returns

  • void

setFast(fast: boolean): void

Parameters

  • fast (boolean) — scroll fastScale times faster

Returns

  • void

skip(): void

Jumps to the end.

Returns

  • void

isFinished(): boolean

Has the last line scrolled off the top (or, for a static view, has it been skipped)?

Returns

  • boolean

getRows(): Array.<BGE.UI.CreditsRow>

The wrapped lines, in order.

Returns

  • Array.<BGE.UI.CreditsRow>

getScroll(): float

How far the roll has scrolled, in pixels.

Returns

  • float

onUpdate(deltaTime: float): void

Parameters

  • deltaTime (float)

Returns

  • void

draw(parent?: UiWidget): void

Parameters

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

Returns

  • void