Question

I'm working with crafty on a game with an open world and i want to use the full window screen. But when i start the game, the scene is not the full width.
I have tried:
Crafty.init(window.innerWidth, window.innerHeight);
Crafty.viewport.init(window.innerWidth, window.innerHeight);
It seems that it takes the biggest sprite width & height and uses that. But when i try to create a bigger rectangle so it would use that, it still uses that sprites' height & width

Crafty.canvas.init(..) seems to create a new canvas.

How do i create a full size canvas-scene in crafty?

Was it helpful?

Solution

In crafty 0.5.4 in the Crafty.viewport.init() function, the width and height of crafty is initialized as: this.width = (!w ? w : Crafty.DOM.width (something like that))

same for height

Change Crafty.DOM.width to window.innerWidth and it is fixed

PS. Crafty 0.6(beta) solves this too.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top