I have an application made in Solar2D (formerly Corona SDK) but it looks different on different devices. How can I make the item positions the same for all resolutions and devices?
My app on LG K10 2017
My app on LG K8
My code part:
local composer = require 'composer';
local bm = require 'backManager';
display.setDefault('background', 0.19,0.23,0.3);
local topBar = display.newRect(display.contentCenterX,0,display.contentWidth, 50);
topBar:setFillColor(0.13,0.16,0.2);
topBar.y = topBar.contentHeight * 0.5 - display.topStatusBarContentHeight / 2;
bm.create(topBar.y);
bm.setVisible(false);
local options = {
text = 'MatUM - Umiem to',
x = topBar.x,
y = topBar.y * 0.5 - display.screenOriginY,
width = topBar.contentWidth,
height = topBar.contentHeight,
font = native.systemFontBold,
fontSize = 17,
align = 'center',
};
local title = display.newText(options);
title.anchorY = 0;
Hi. I’m a little different from other folks here. In SSK I calculate left, top, right, bottom, and other values then use those. I like the shorthand names and find them easier to remember.
You can get my code from SSK, or a shortened version (minus cleaning steps) here:
I’m using the Solard2D simulator version 2021.3641 on Windows.
I generally use Borderless 640x960, but if you use a different simulated device, and see a problem, let us know so I (and perhaps others) can try that device in the simulator.
And not on the simulator… does it work on your device?
I’m trying to set a baseline with code we (you, I, and anyone else) can modify without messing with your code.
BTW, its a simulator
I mention this because there are emulators (xCode has emulators) and BlueStacks emulators for Android devices. When you say emulator it might confuse the discussion. In this case I know you meant the Corona/Solar2D simulator, but just an FYI.