Giter Club home page Giter Club logo

Comments (3)

bySabi avatar bySabi commented on May 18, 2024 1

@jkanchelov In the end I have created my own template.

Aside from the changes I mentioned above:

  • remove the rabbit.png import so that Parcel ignores it and now it is copied along with the entire assets folder to dist

This is the repo: https://github.com/bySabi/pixijs-typescript-template
I have put you in the credits :-)

from pixi-typescript-boilerplate.

bySabi avatar bySabi commented on May 18, 2024

Sorry it's my fault for not adding window.onload to handle the app's lifecycle.

I have taken the liberty of refactoring the code a little to make it clearer. IMHO the current approach with a single Class that contains everything is much more difficult to maintain.

What I have done is:

  • Move constants like, GAME_WIDTH, GAME_HEIGHT to constants.ts
  • The creation part of the renderer is all boilerplate, it does not change. I've taken it to the get-app.ts module and it works as a Singleton
  • And in index.ts I have left the part that is customized like the functions of Sprites creation like "rabbit" and "bunny", the loading of images and the management of events.

The "index" module is handled by the window.onload callback, which is where the app's life cycle is managed.

It seems clearer to me like that, but it's just my opinion. If you don't think it's correct, tell me the errors, please, to correct them.

This is my fork: https://github.com/bySabi/first-pixi

from pixi-typescript-boilerplate.

yordan-kanchelov avatar yordan-kanchelov commented on May 18, 2024

Sorry for the slow response. For sure your fork is a lot more cleaner what I wanted the boilerplate to have is everything which I consider as important in one place to be easier for someone new to break it down. Not sure if it's right tho

from pixi-typescript-boilerplate.

Related Issues (14)

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.