Skip to content

hywax/phaser-font-plugin

Repository files navigation

Phaser Font Plugin

npm version npm downloads License

Phaser Font Plugin is a lightweight plugin that allows you to load fonts in your Phaser 3 game.

🎯 Features

  • 🚀️ Easy to use
  • 📦️ Lightweight ~ 600 bytes
  • 🌐️ XHRSettings support
  • 0️⃣ Zero dependencies
  • 🪄️ TypeScript support

✨ Installation

# Using pnpm
pnpm add phaser-font-plugin

# Using yarn
yarn add phaser-font-plugin

# Using npm
npm install phaser-font-plugin

⚡ Usage

Load the plugin

Add the plugin to the list of global plugins in your game configuration.

import { Game } from 'phaser'
import { FontPlugin } from 'phaser-font-plugin'

export default new Game({
  plugins: {
    global: [
      {
        key: 'FontPlugin',
        plugin: FontPlugin,
        start: true,
      },
    ],
  },
})

Use the plugin

Use the plugin to load fonts in your scenes.

import { Scene } from 'phaser'

export default class Boot extends Scene {
  preload() {
    this.load.font('pixeloid', 'assets/fonts/pixeloid.ttf')
  }
}

🌟 Credits

A huge thank you to everyone who is helping to improve Phaser Font Plugin. Thanks to you, the project can evolve!

Contributors

To become a contributor, please follow our contributing guide.

contributors

📝 License

Licensed under the MIT License.