Skip to content
Perses Games edited this page Apr 26, 2017 · 1 revision

Text

Displaying text on screen is as simple as (in the render method):

  Texts.drawText(x, y, "SCORE $score", font = "bold 32pt future", fillStyle = "rgba(200, 255, 200, 0.75)")

Make sure the font is knows ('future' in this case) by for example adding it to your css:

    @font-face {
      font-family: future;
      src: url(fonts/kenvector_future.ttf) format("truetype");
    }

Please note that text is always on top of the sprites. This is because it is rendered with a seperate 2d canvas on top of the webgl canvas.

Clone this wiki locally