1 decade ago by Aries
Hi, i'm a beginner for impactjs and appmobi, I try to get ig.input.mouse.x so that i can track the touch of entities. However, when i try on different emulator other than Iphone, it shows negative value for ig.input.mouse.x from the top left of the mobile screen, but the position for the entities at top left of screen is (0, 0). I wonder why the mouse.x at top left screen will be show negative value?
my scaling is like following:
my scaling is like following:
if( ig.ua.iPad ) {
// The original iPad on iOS4 is too slow to render the game in fullscreen
// It's rendered in a 480x320 canvas instead
ig.Sound.enabled = false;
ig.main('#canvas', MyGame, 60, 160, 240, 2);
}
else if( ig.ua.mobile ) {
// For iPhone and Android, make sure to always render in the
// native resolution
ig.Sound.enabled = false;
ig.main('#canvas', MyGame, 60, 160, 240, 2 * ig.ua.pixelRatio);
// Set the CSS size of the canvas to 320 (160, scaled up 2x)
// "CSS pixels" will be scaled to native screen pixels by
// the browser internally through the pixelRatio
ig.system.canvas.style.width = '320px';
ig.system.canvas.style.height = '480px';
}
else {
// Scale up 3x for desktop
ig.main('#canvas', MyGame, 60, 160, 240, 3);
}
