Jump to content

How to update BitmapText's text correct way?


Recommended Posts


I'm new in game progremming. I was read better than as performance BitmapText instead of Normal font on PixiJS. That's way I prefered BitmapText. I couldn't found detail. both any google searching and that in api documentation for update text as BitmapText.

My way solve that's like is; remove object, create object as updated with new text, object add to child.


import { Application, Graphics, BitmapText } from 'pixi.js'
import {GlowFilter} from '@pixi/filter-glow';

function emit(name:string, payload:any = true, ms=10) {
		gameEvents.dispatchEvent(new CustomEvent(name, { detail: payload }));
	}, ms);

const gameEvents = document.createElement('div');

// ....

let playerCoord: BitmapText;

app.loader.add('desyrel', 'desyrel.xml')
		updateCoord(0, 0);

function updateCoord(x=0, y=0) {
	playerCoord = new BitmapText(`X: ${x}, Y: ${y}`, {
		fontName: 'Desyrel', 
		fontSize: 24, 
		align: 'left'
	playerCoord.x = 10;
    playerCoord.y = 10;

function movement(gameObjet: any, stateKeys: any, speed: number = 4) {
	// ....
	updateCoord(gameObjet.position.x, gameObjet.position.y);

// ....

function playerGameLoop(){
	movement(player, stateKeys);	

gameEvents.addEventListener("LOADED_DESYREL_BMAP_FONT", function(){


Above code woking correctly.


But I wanted to learn real game programming architecture with performance. Therefore I want to ask you.


Thank you for interest.

Good works.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...