Giter Club home page Giter Club logo

pixi-typescript-boilerplate's Introduction

Pixi.js TypeScript Boilerplate

A beginner-friendly template for building interactive graphics and games using Pixi.js with TypeScript and Webpack. This boilerplate simplifies the setup process, allowing developers to quickly start creating engaging web experiences.

pixi.js logo

Netlify Status Windows build Linux build MacOs build

Recent update ( 25.12.2023 )

  • ๐Ÿ†• Updated to Pixi v7: The latest version of Pixi.js brings enhanced features and performance improvements

  • ๐Ÿ”ง Stability Overhaul: Moved from swc to ts-loader for improved stability and compatibility

  • Revised and Updated Dependencies: All package dependencies have been reviewed and updated to their latest versions for optimal performance and security.

Features

  • ๐Ÿ”ฐ - Beginner-friendly setup and structure.
  • ๐Ÿš€ - Optimized build times.
  • ๐Ÿ›  - Full TypeScript support for robust type-checking.
  • โœˆ๏ธ - Live reload for efficient development workflow.
  • ๐Ÿ“ - Consistent code style using Prettier and Eslint

Usage

Click on the green button "Use this template" on top of the repo or

Simply copy paste this and start coding

git clone --depth=1 --branch=master https://github.com/yordan-kanchelov/pixi-typescript-boilerplate

rm -rf ./pixi-typescript-boilerplate/.git

Commands

  • npm run build - starts build procedure
  • npm run start - start watching for files and open's server on localhost:8080
  • npm run lint - generate code coverage report

For vscode users - ctrl ( or โŒ˜ ) + shift + b will run package.json's dev script ( it is set as default vscode task )

pixi-typescript-boilerplate's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar imgbot[bot] avatar yordan-kanchelov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pixi-typescript-boilerplate's Issues

Something is wrong with default base path

Hi @jkanchelov I am testing this template with some simple examples to learn and I have not managed to create a Sprite from a local image.
There seems to be some path problem.

You can test it yourself by replacing "index.ts" with:

import * as PIXI from 'pixi.js';

const app = new PIXI.Application({
  width: window.innerWidth,
  height: window.innerWidth,
  backgroundColor: 0xaaaaaa,
});
document.body.appendChild(app.view);

const rabbit = PIXI.Sprite.from('./assets/rabbit.png');
rabbit.anchor.set(0.5);
rabbit.x = app.screen.width / 2;
rabbit.y = app.screen.height / 2;

app.stage.addChild(rabbit);

Issue with npm run build

Hello,

Did npm install and then npm run dev work fine : Server running at http://localhost:8080 .

Then I tried npm run build and got:

โ ง Building settings.es.js...node_modules/pixi.js/pixi.js.d.ts:4:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: VERSION, PI_2, RAD_TO_DEG, DEG_TO_RAD, TEXT_GRADIENT, TARGET_FPMS, MIPMAP_TEXTURES, RESOLUTION, FILTER_RESOLUTION, SPRITE_MAX_TEXTURES, SPRITE_BATCH_SIZE, RETINA_PREFIX, RENDER_OPTIONS, GC_MODE, GC_MAX_IDLE, GC_MAX_CHECK_COUNT, WRAP_MODE, SCALE_MODE, PRECISION_VERTEX, PRECISION_FRAGMENT, UPLOADS_PER_FRAME, CAN_UPLOAD_SAME_BUFFER, AccessibilityManager, Bounds, Container, DisplayObject, Transform, GraphicsData, Graphics, Matrix, ObservablePoint, Point, Circle, Ellipse, Polygon, Rectangle, RoundedRectangle, ObjectRenderer, Quad, Filter, SpriteMaskFilter, Sprite, TextStyle, TextMetrics, Text, BaseRenderTexture, BaseTexture, RenderTexture, Texture, TextureMatrix, TextureUvs, Spritesheet, Shader, FXAAFilter, BlurFilter, ColorMatrixFilter, DisplacementFilter, AlphaFilter, NoiseFilter, InteractionData, InteractionPointerEvents, InteractionTouchEvents, InteractionMouseEvents, InteractionPixiEvents, InteractionEventTypes, InteractionManager, premultiplyBlendMode, TextureCache, BaseTextureCache, isMobile, EventEmitter, PIXI

4 declare namespace PIXI {
  ~~~~~~~

  ../../../../../node_modules/@types/pixi.js/index.d.ts:7:1
    7 declare namespace PIXI {
      ~~~~~~~
    Conflicts are in this file.

node_modules/pixi.js/pixi.js.d.ts:1131:10 - error TS2567: Enum declarations can only merge with namespace or other enum declarations.

1131     enum RENDERER_TYPE {
              ~~~~~~~~~~~~~

...and more...


Found 30 errors.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] type-check: `tsc --noEmit`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] type-check script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/aymeric/.npm/_logs/2020-04-15T11_50_13_978Z-debug.log
โœจ  Built in 16.37s.

dist/src.a142f48a.js.map    โš ๏ธ  1.61 MB      92ms
dist/src.a142f48a.js         394.14 KB    13.93s
dist/index.html                  330 B     2.19s
dist/rabbit.2642334d.png         309 B     1.10s

npm run build creates 2 .js files.

Thanks for creating this boilerplate.
I have an issue when bundling files for production build.

npm run build command creates 2 .js files. I want to bundle everything into single .js file.
Can you please help to achieve this ?

Thanks in advance.

how to use fontawesome?

hi,
Thanks for your job.
I want to use fontawesome font in pixi.js, could you add this feature?

Typo

One dash is missing in rm -r -force ./pixi-typescript-boilerplate/.git. Should have been --force.

Template performance

Spector js shows too much webgl commands on template's scene and drawcalls, though it got alsmost nothing, why is that?
I am using Phaser at work and have performance problems, especially on apple devices, so I wanted to try PIXI
But so much operations aren't even close to Phaser's debug

Rename to .html, open in browser to watch result or try using Spector.js yourself
result.html.txt
screen

Not working on Chrome 83 | macOS 10.13.6

I can't get it to work on Chrome 83.

It gives me this error:

Renderer.js: 50 Uncaught Error: WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.
    at Function.create (Renderer.js: 50)
    at autoDetectRenderer (autoDetectRenderer.js: 36)
    at new Application (Application.js: 67)
    at Main.createRenderer (index.ts: 40)
    at Main.window.onload (index.ts: 15)
create @ Renderer.js: 50
autoDetectRenderer @ autoDetectRenderer.js: 36
Application @ Application.js: 67
createRenderer @ index.ts: 40
Main.window.onload @ index.ts: 15
load (async)
Main @ index.ts: 14
(anonymous) @ index.ts: 74
parcelRequire.index.ts.pixi.js @ index.ts: 75
newRequire @ src.77de5100.js: 47
(anonymous) @ src.77de5100.js: 81
(anonymous) @ src.77de5100.js: 120
service-worker.js: 10 Attempting to install service worker and cache static assets
(index): 31 ServiceWorker registration successful with scope: http: // localhost: 63647 /
service-worker.js: 44 Activating new service worker ...

I have checked the Chrome WebGL support and it is working correctly and in Firefox the example works.
I played PixiJS for the first time today and I can't imagine where the bug is.

The Best Template on the Net

I want to thank you for your efforts. I have been working on it for last three days. This template is fully functional well maintained and perfectly crafted.
You JavaScript skill are at another level.

Thanks a lot.

Assets Update

Can you update version 7.2 with Assets instead Loader???

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.