Screen scaling problems

  • I'm trying to scale my game based on the resolution of the device it's running on, and based on the ScreenScale demo, it looks like I want to do something like this:

    HXP.screen.scaleMode = new haxepunk.screen.ScaleMode();
    HXP.screen.scaleMode.setBaseSize(800, 600);
    HXP.resize(HXP.screen.width, HXP.screen.height);

    However, the end result is not what I would have expected. The non-scaled version looks like this:

    But the scaled version appears like this (scaled to 1200x900):

    Also notice the mouse position shown in the console. In both screenshots the mouse is in the top left corner, but when the game is scaled everything seems to be offset by at least 100 pixels vertically and horizontally.

    I've tried various ScreenScaleModes but to no effect. Am I missing something obvious or is this broken? Until somewhat recently HaxePunk allowed accessing the stage object so I scaled apps using that; this is the first time I've had to use HXP.resize().

    I'd appreciate any help or advice.

Log in to reply

Looks like your connection to NodeBB was lost, please wait while we try to reconnect.