Jump to content

Phaser canvas context 2d?


Recommended Posts



I want to write my own javascript as part of my game, so I'm loading another js file such as menu.js and then inside that file I want to draw my own image to the canvas so I write the following code;


var canvas = document.getElementById('canvas');var ctx = canvas.getContext('2d');var backpackBtn = new Image();	backpackBtn.onload = function() {	ctx.drawImage(backpackBtn, 50, 630);	};	backpackBtn.src = '././sprites/ui/item_btn.png';

But phaser uses the canvas in webgl mode, and a canvas can't have both webgl and 2d, so can i make phaser use 2d so I can write my own javascript along side? 

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.

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.


  • Recently Browsing   0 members

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