Author Topic: [SUG][EDITOR] Screen start rect should reflect more typical screen size.  (Read 2204 times)

0 Members and 1 Guest are viewing this topic.

Offline namida

  • Administrator
  • Posts: 12398
    • View Profile
    • NeoLemmix Website
The screen start rectangle currently covers a 320x160 region, but that's not particularly accurate for most setups using a modern screen.

We'll assume a default of that most levels are still 160px tall - I believe this is still by far the most common height. (EDIT: Actually, this doesn't matter IIRC. As long as they're not tall, narrow levels, the same result would still hold.) Under such circumstances, and default NeoLemmix settings, the initial viewable area will be, on various common screen resolutions:

1366x768: 455x216
1600x900: 400x185
1920x1080: 384x176
2560x1440: 365x165
3840x2160: 384x176

EDIT: These figures might not be accurate, as I got different results when I calculated similar stuff for another topic (which I paid closer attention while doing). I'll re-calculate at some point.

X x Y, assuming X is a fair bit larger than Y, and a fairly normal level size:
let Z = floor(Y / 200)
startWidth = screenWidth / Z
startHeight = (screenHeight - (Z * 40)) / Z

From this, 384 x 176 seems like the most obvious option, due to it being used on two of the common screen sizes. 455x216 seems like the most obvious alternative, since I believe 1366x768 is still the most common of these options (especially for laptops). (EDIT: Or maybe not. A Steam survey on display resolutions suggests 1920x1080 is the most common, and while 1366x768 is second, there's a huge gap. While the nature of Steam would likely mean a bias towards higher resolutions, given how big the gap is I'd suspect 1920x1080 is still the most common ultimately.)

Or, if we want to keep one dimension as-is, then at least the other should be changed to reflect that 16:9, not 4:3, is the standard screen resolution these days. In such a case, either 355x160 or 320x140 should be used. (These are not 16:9 ratios themself; because the 16:9 area of the actual screen includes the skill panel, whereas the initial viewable area region does not.)
« Last Edit: March 31, 2019, 09:42:05 AM by namida »
My Lemmings projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)

Offline Nepster

  • Posts: 1829
    • View Profile
The editor actually tries to get the current monitor resolution and read the user settings (like the zoom factor) from the player settings, so that it can set the screen start rectangle to exactly the size you will see on your current computer. Only if this fails, the editor reverts to the standard 320x160.
This looks like there is still some bug in the algorithm, so that it falls back to the default. Will have a look.

Offline namida

  • Administrator
  • Posts: 12398
    • View Profile
    • NeoLemmix Website
I'm not too sure how you're doing this, so just in case, from memory this is how NL's zoom algorithm works. If it doesn't seem to line up, let me know and I'll check this more closely.

Firstly, NeoLemmix is DPI-unaware. This means, a screen size (or window size, if playing windowed) of 3840x2160, with a 200% scaling (ie: 192dpi), appears to NeoLemmix as 1920x1080. If the editor is DPI-aware, it would need to also be aware of NL's DPI-unawareness.

Secondly, any time a non-integer results from a calculation, immediately round towards zero, unless explicitly stated otherwise.

Anyway, the play area will be zoomed to the user's zoom setting; OR, if they have "increase zoom on small levels" enabled, then it may further increase to whichever is the larger zoom of, the largest where a 320px wide level completely fits on screen horizontally, or the largest where a 160px tall level completely fits on screen vertically. For this calculation, it is assumed the skill panel will zoom to the same factor as the level, even if this is not possible for the screen size / selected skill panel.

After this, the skill panel is zoomed to whichever is less - the largest zoom that will still allow it to fit on screen (reminder: 320px wide for compact, 416px wide for standard, 48px tall either way), or the zoom factor the level has been increased to. The remaining on-screen space, after this, is what will be initially displayed of the level. (This final step can sometimes result in fractions of a pre-zoom pixel being visible on-screen - eg a 3x zoom, on a screen 1280px wide, on either the left or the right 2/3rds of a pre-zoom pixel will be visible - but I don't think the editor needs to have that level of accuracy.)
My Lemmings projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)