Skip to content

renatocassino/phaser-toolkit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

410 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Phaser Toolkit

A comprehensive collection of tools and utilities for game development with Phaser.

๐Ÿ“ฆ Packages

This monorepo contains a cohesive suite of TypeScript-first libraries for Phaser. Each package is focused, well-tested, and built to work great together or stand alone.

Phaser Toolkit

๐ŸŽฉ Hudini โ€” Magical UI components for Phaser

Hudini

Hudini is a collection of reusable, themeable UI components for Phaser games. Named after the famous magician Houdini and HUD (Head-Up Display), it provides a magical toolkit for building consistent game interfaces.

Key Features:

  • ๐ŸŽจ Themeable - Dark/light themes with full customization
  • ๐Ÿ“ฆ Phaser-wind Dependency - Only requires phaser-wind
  • ๐ŸŽฏ TypeScript First - Full type safety and IntelliSense
  • ๐Ÿงช Tested - Comprehensive test coverage

Components:

  • Column - Stacks children vertically with spacing and alignment
  • Row - Arranges children horizontally with spacing and alignment
  • IconButton - Interactive circular icon button with animations
  • FlatIconButton - Flat-style icon button with customizable colors and opacity

Links:


๐ŸŒช๏ธ phaser-wind โ€” Theme system inspired by Tailwind

Phaser Wind

Phaser Wind brings the joy and simplicity of Tailwind-like design tokens to Phaser games! Stop fighting with magic numbers and random colors.

Key Features:

  • ๐ŸŽจ Complete Tailwind-like Color Palette - 22 families ร— 11 shades
  • ๐Ÿ“ Semantic Font Sizes - From xs to 6xl
  • ๐Ÿงฉ Default constants ready-to-use - Color, FontSize, Spacing, Radius, Shadow
  • ๐Ÿงญ Optional theme system (typed) - Add your own tokens with strong typing
  • ๐Ÿ”ง TypeScript First - Full type safety and IntelliSense
  • ๐ŸŽฎ Phaser Ready - Global plugin for easy access in scenes

Example:

import { Color, FontSize } from 'phaser-wind';

const button = this.add.text(100, 50, 'Click me!', {
  fontSize: FontSize.css('lg'), // Clear intention!
  fill: Color.rgb('blue-500'), // Beautiful blue
  backgroundColor: Color.rgb('gray-800'), // Perfect contrast
});

Links:


๐ŸŽจ font-awesome-for-phaser โ€” Font Awesome icons in Phaser

Font Awesome for Phaser

Use Font Awesome icons as text/sprites directly in your Phaser scenes with zero friction rendering pipeline.

Key Features:

  • ๐ŸŽฏ Zero friction rendering - Direct integration with Phaser text system
  • ๐ŸŽจ Full control - Sizing, color and stroke controls
  • ๐Ÿ“ฆ IconText component - Ready-to-use component for icons
  • ๐Ÿ”ง TypeScript Support - Full type safety

Example:

import { IconText } from 'font-awesome-for-phaser';

const icon = new IconText(this, 90, 90, 'gamepad', 64, {
  color: '#0066cc',
  iconStyle: 'solid', // 'solid' | 'regular' | 'brands'
});

Links:


๐Ÿช phaser-hooks โ€” React-style hooks for Phaser

Phaser Hooks

A comprehensive state management library for Phaser games with React-like hooks pattern. Reduce boilerplate and manage state cleanly.

Key Features:

  • ๐ŸŽฏ React-like API - Familiar hooks pattern for Phaser developers
  • ๐Ÿ”’ Type-safe - Full TypeScript support with compile-time validation
  • ๐ŸŽฎ Phaser-native - Designed specifically for Phaser lifecycles
  • ๐Ÿงช Well-tested - Comprehensive test coverage
  • ๐Ÿ› Debug Mode - Built-in debug logging for development

Available Hooks:

  • withLocalState - Scene-specific state management
  • withGlobalState - Application-wide state
  • withPersistentState - State with localStorage persistence
  • withComputedState - Derived state that auto-updates
  • withUndoableState - State with undo/redo functionality
  • withDebouncedState - State with debounced updates

Example:

import { withLocalState } from 'phaser-hooks';

const playerState = withLocalState<{ hp: number; level: number }>(
  this,
  'player',
  { hp: 100, level: 1 },
  { debug: true } // Enable debug logging
);

playerState.set({ hp: 90, level: 2 });
const currentPlayer = playerState.get();

Links:


๐ŸŽต phaser-sound-studio โ€” Professional audio management

Phaser Sound Studio

The ultimate type-safe audio management system for Phaser.js games. Transform your game's audio experience with professional-grade sound management, multi-channel mixing, and automatic volume persistence.

Key Features:

  • โœ… Full TypeScript Support - Complete type safety for sound keys and channels
  • ๐ŸŽ›๏ธ Multi-Channel Audio - Professional mixing with HUD, SFX, Music, and custom channels
  • ๐Ÿ’พ Automatic Persistence - Player volume preferences saved automatically
  • โšก Smart Preloading - Efficient audio loading with lazy loading fallbacks
  • ๐ŸŽฏ Zero Configuration - Works out of the box with sensible defaults
  • ๐Ÿ”— Phaser Hooks Integration - Leverages battle-tested state management

Example:

import { getSoundStudio } from 'phaser-sound-studio';

const studio = getSoundStudio<GameSounds, GameChannels>(this);
studio.play('button-click'); // โœ… Type-safe!
studio.setChannelVolume(this, 'music', 0.1); // Lower background music

Links:


๐Ÿ” phaser-data-inspector โ€” DevTools for Phaser state

Phaser Data Inspector

A powerful Chrome DevTools extension that brings state inspection capabilities to Phaser game development. Just like Redux DevTools revolutionized React debugging, this extension provides game developers with comprehensive insights into their Phaser game state management.

Key Features:

  • ๐ŸŽฏ Real-Time State Monitoring - Track state changes across Phaser Registry and Scene Data
  • ๐Ÿ” Powerful Search & Filter - Search by state key and filter by source
  • ๐Ÿ“Š State Diff Visualization - Side-by-side comparison with visual diff highlighting
  • ๐Ÿ“„ Pagination & Performance - Handle large event logs efficiently
  • ๐ŸŽฎ Multi-Game Support - Switch between multiple Phaser game instances
  • ๐ŸŽจ Modern UI - Built with React and styled-components

Example:

import { withLocalState } from 'phaser-hooks';

// In your scene
const { set, get } = withLocalState(this, 'score', 0);

// When score changes, you'll see the diff in the inspector
set(100);

Links:

๐Ÿš€ Getting started

Prerequisites

  • Node.js >= 18.0.0
  • pnpm >= 8.0.0

Instalaรงรฃo

# Clone o repositรณrio
git clone https://github.com/cassinodev/phaser-toolkit.git
cd phaser-toolkit

# Instale as dependรชncias
pnpm install

# Construa todos os pacotes
pnpm build

Scripts Disponรญveis

  • pnpm build - Builds all packages
  • pnpm test - Runs tests across all packages
  • pnpm dev - Starts development mode
  • pnpm lint - Runs linting across all packages
  • pnpm typecheck - Checks TypeScript types
  • pnpm clean - Cleans previous builds
  • pnpm changeset - Creates a new changeset for versioning
  • pnpm release - Publishes new versions of packages

๐Ÿ“‹ Project Structure

phaser-toolkit/
โ”œโ”€โ”€ packages/
โ”‚   โ”œโ”€โ”€ hudini/                    # UI components
โ”‚   โ”œโ”€โ”€ phaser-wind/              # Design tokens & theming
โ”‚   โ”œโ”€โ”€ font-awesome-for-phaser/   # Font Awesome icons
โ”‚   โ”œโ”€โ”€ phaser-hooks/             # State management hooks
โ”‚   โ”œโ”€โ”€ phaser-sound-studio/      # Audio management
โ”‚   โ”œโ”€โ”€ phaser-data-inspector/    # Chrome DevTools extension
โ”‚   โ””โ”€โ”€ showcase/                 # Astro showcase
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ pnpm-workspace.yaml
โ””โ”€โ”€ README.md

๐Ÿค Contribute

Contributions are always welcome! Please read our contribution guide before submitting a PR.

  1. Fork the project
  2. Create a branch for your feature (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ‘จโ€๐Ÿ’ป Author

CassinoDev

โญ Show your support

If this project helped you, please give it a โญ in the repository!

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors