Jump to content

PixiJS equivalent Canvas functions


wiseDev
 Share

Recommended Posts

I'm interested in migrating a game I'm making to PixiJS. Currently I'm using just HTML5 Canvas. I assume PixiJS has fully compatible methods with HTML5 Canvas, since it's its fallback if WebGL doesn't work. So how I would proceed?

For example:

Let's say I have a drawText function that uses this:

ctx.font

ctx.fillStyle

ctx.strokeStyle

ctx.strokeText

ctx.fillText

And a drawImg function that uses this:

canvas[layer].ctx.drawImage(...)

canvas[capa].ctx.globalAlpha

So I don't load sprites and toy with them. The sprites are loaded, and then I just draw on screen whatever it's necessary in my main loop.

My question, in other words, is: Can I replace my main functions with PixiJS functions, or I would have to re-think the graphics logic of my game? 

Link to comment
Share on other sites

17 hours ago, wiseDev said:

 

17 hours ago, wiseDev said:

My question, in other words, is: Can I replace my main functions with PixiJS functions, or I would have to re-think the graphics logic of my game? 

You'll have to re-think your view code.

Pixi does all the low-level rendering Canvas/WebGL for you, so programming a Pixi application happens at the much higher level of stateful sprite objects.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...