Answer the question
In order to leave comments, you need to log in
How to scale a pixi.js scene for different resolutions?
There was a need to create a single game client code for web and mobile. On the web, the client works correctly, but the apk built with cordova has problems with scaling.
The essence of the problem: on a 720x1280 device, the following code gives the scene dimensions 360x615, and the images added to the scene have a real size, and as a result, an image with a width of 480 pixels does not fit on a screen of 360 pixels, which should have a width of 720 pixels:
var renderer;
var stage;
window.onload = function() {
var w = screen.width;
var h = screen.height;
stage = new PIXI.Container();
renderer = PIXI.autoDetectRenderer(w, h);
document.body.appendChild(renderer.view);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question