Skip to main content

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

Are you using a Retina/High-DPI display? I had no idea this would affect it but after reading a bunch of StackOverflow posts I think I see what's happening. I appreciate you showing me what you're seeing as it is working fine on my old 2012 Macbook Pro but obviously they have come a long way in 10 years.

Yeah, I think you hit the nail on the head. I do indeed have a Retina display, I just tried the game on my other monitor and it worked perfectly!

Can you try it one more time on your Retina display please? I just pushed an update that should hopefully fix high-DPI issues if my understanding of the issue is correct.

(+1)

Yeah that fixed it, works perfectly!

(1 edit) (+1)

Hey man I really can't thank you enough for showing me there was a problem with the scaling on Macs; not sure how I ever would have known. Posting a little code snippet here for anyone else using mouse positions in case Google brings them to this corner of the internet while fighting with WebGL and Retina displays. Technically it could work for any tile-based game to easily say what tile (or even pixel on a low-res game like this) the mouse is over. Thank you!!!

Position WhatTileIsMouseIn() {
    Vector2 mousePos = Input.mousePosition;
    mousePos = new Vector2 (mousePos.x, mousePos.y);
    float scaledMouseX = ((mousePos.x / Screen.width)) * 8; // the 8 here is how many tiles across your screen has
    float scaledMouseY = ((mousePos.y / Screen.height)) * 8 - 1; // the 8 is vertical tiles, minus 1 for the bottom border in my game
    return new Position((int)scaledMouseY, (int)scaledMouseX); // casting the floats to integers truncates them
}