In a game I’m trying to finish up I’ve run into a problem using a specific font (one I’ve included, not one of the built-in fonts). The problem is text using that font is about 3 pixels different on the Y axis from simulator to device.
I get it looking good in the simulator, do a device build, and all the positioning is wrong.
It’s hard to get things just right when, in your development, it has to look wrong to be correct on the device.
I ended up using a global variable and this little chunk of code in main.lua:
if system.getInfo("environment") == "simulator" then simulator = true end simYFudge = 3 if simulator then simYFudge = 0 end
Then whenever I set the Y value for the text I always add that fudge factor:
myMessage.y = 20 + simYFudge
For me that turned out to be the fastest/easiest solution. Due to one thing or another there’s usually a variable with the word “fudge” in it somewhere in each of my projects.
Thankfully, I like fudge.