whatisgithub

What is phaser-hidpi?

sparkade-labs/phaser-hidpi — explained in plain English

Analysis updated 2026-05-18

5JavaScriptAudience · developerComplexity · 2/5Setup · easy

In one sentence

A small Phaser 4 plugin that renders games at full device resolution so text and graphics stay sharp on phones and high-DPI screens.

Mindmap

mindmap
  root((phaser-hidpi))
    What it does
      Fixes blurry rendering
      Uses native pixel resolution
      Provides px helper
    Tech stack
      JavaScript
      Phaser
      npm
    Use cases
      Mobile game sharpness
      High-DPI displays
      Accurate touch input
    Audience
      Game developers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Fix blurry text and graphics in a Phaser game on mobile devices.

USE CASE 2

Add device-pixel-aware sizing to a new Phaser project from the start.

USE CASE 3

Ensure touch or click hit-tests line up correctly on high-DPI screens.

What is it built with?

JavaScriptPhasernpm

How does it compare?

sparkade-labs/phaser-hidpi00kaku/wp-rest-playgroundchalarangelo/mini-active-record
Stars555
LanguageJavaScriptJavaScriptJavaScript
Setup difficultyeasyhardeasy
Complexity2/53/51/5
Audiencedeveloperdevelopervibe coder

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Drop-in npm package or script tag, no external services required.

So what is it?

phaser-hidpi is a small plugin for Phaser 4, a JavaScript game framework, that fixes blurry text and graphics on high resolution screens. If your Phaser game looks sharp on a standard desktop monitor but appears blurry on a phone, tablet, or high-DPI display, this plugin solves it by rendering the canvas at the device's native pixel resolution instead of the lower logical resolution. The root cause is that modern screens often use multiple physical pixels to draw each CSS pixel, a ratio called devicePixelRatio (DPR). A phone with DPR 3, for example, uses 9 physical pixels to draw each CSS pixel. If a game canvas is sized in CSS pixels but not scaled up for the backing buffer, the graphics engine stretches a low resolution image to fill the screen, causing blur. This plugin configures Phaser's canvas to use the full physical resolution. Using it involves two pieces. First, the plugin returns a Phaser configuration object with the canvas and scale settings already set up for the device's pixel density, which you merge into your normal Phaser config. Second, it provides a helper function called px() that you use to wrap pixel measurements in your scene code. On a standard DPR 1 screen, px() returns its input unchanged, on a DPR 2 or 3 screen, it multiplies the value accordingly. You wrap coordinates, sizes, font sizes, radii, and line widths with px(), but not colors, scale multipliers, angles, or durations. The project is written in JavaScript, installable via npm, and also available as a plain script file. It also reports the pointer position in physical pixels, so touch and click hit tests line up correctly without extra conversion.

Copy-paste prompts

Prompt 1
Help me install phaser-hidpi and wire it into my existing Phaser game config.
Prompt 2
Explain which values in my Phaser scene I need to wrap with px() and why.
Prompt 3
Show me how devicePixelRatio causes blur in canvas games and how phaser-hidpi fixes it.
Prompt 4
Help me debug why my Phaser text still looks blurry after adding phaser-hidpi.

Frequently asked questions

What is phaser-hidpi?

A small Phaser 4 plugin that renders games at full device resolution so text and graphics stay sharp on phones and high-DPI screens.

What language is phaser-hidpi written in?

Mainly JavaScript. The stack also includes JavaScript, Phaser, npm.

How hard is phaser-hidpi to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is phaser-hidpi for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.