Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Good to know that you can read the texture. It would be awesome if there was a function that would let you grab a rect from that texture. 

If it doesn't fit on your roadmap, I am pretty sure you can do it with js as is (or with a use of library). Which makes me think - can you add your own libraries? 

(4 edits)

Until something like this is supported by Pixelbox, you could drop down to the native html canvas and do something like this:
https://www.w3schools.com/tags/canvas_getimagedata.asp
I typically avoid w3schools examples, but this pretty succinctly describes what you're trying to do. You can use document.querySelector('canvas') to find the canvas that Pixelbox is drawing to, and use the getImageData()/putImageData() methods on the context from the canvas.

actually the global $screen Texture stores the canvas as $screen.tilesheet and the context2d as $screen.ctx, so you should be able to use $screen.ctx.getImageData()/putImageData().