a way to get a players screen resolution

Post Reply
CmdrKeen
Long Handed Inserter
Long Handed Inserter
Posts: 98
Joined: Tue Sep 29, 2015 9:03 pm
Contact:

a way to get a players screen resolution

Post by CmdrKeen »

I'd like to get implemented a way to pull information on a players screen size to make it possible to adjust a large dialog to the players screen without the player having to input the resolution themselves.

It'd also require an event to handle resolution changes in order to resize the dialog.

Bilka
Factorio Staff
Factorio Staff
Posts: 3129
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: a way to get a players screen resolution

Post by Bilka »

To save some dev time: Not gonna happen. This isn't deterministic.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: a way to get a players screen resolution

Post by eradicator »

Yep. Very unlikely to ever happen. If you absolutely need this you can make per-player mod options for it. Or just use a "scroll-pane". (I can relate to the problem though *sigh*)
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: a way to get a players screen resolution

Post by Rseding91 »

As other have said: that's not currently possible. However since it sounds like it could be quite useful for mod developers I may look into adding support for it.
If you want to get ahold of me I'm almost always on Discord.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: a way to get a players screen resolution

Post by eradicator »

Rseding91 wrote:As other have said: that's not currently possible. However since it sounds like it could be quite useful for mod developers I may look into adding support for it.
To me the "i want the screen resolution" thing is mostly a dilemma because it's not currently possible to specify relative sizes for GUI elements. I.e. i'd like to specify "this GUI frame should be 70% of the current window width and 60% of the current window height". Resolution would (to me) be simply an entry point to calculate those percentages myself. So personally i'd be far more interested in something like LuaGuiElement.style.relative_width = 0.6. Tho i guess knowing the absolute dimensions might still have some benefits when trying to work with very small windows...
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: a way to get a players screen resolution

Post by Rseding91 »

eradicator wrote:
Rseding91 wrote:As other have said: that's not currently possible. However since it sounds like it could be quite useful for mod developers I may look into adding support for it.
To me the "i want the screen resolution" thing is mostly a dilemma because it's not currently possible to specify relative sizes for GUI elements. I.e. i'd like to specify "this GUI frame should be 70% of the current window width and 60% of the current window height". Resolution would (to me) be simply an entry point to calculate those percentages myself. So personally i'd be far more interested in something like LuaGuiElement.style.relative_width = 0.6. Tho i guess knowing the absolute dimensions might still have some benefits when trying to work with very small windows...
That could work but since there's no such concept in the GUI logic it's not something that can be done in any acceptable amount of time. Knowing the players screen resolution and display scale value would allow mods to set up their GUIs exactly how the core game does and that can be done in an acceptable amount of time.
If you want to get ahold of me I'm almost always on Discord.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: a way to get a players screen resolution

Post by eradicator »

Rseding91 wrote: That could work but since there's no such concept in the GUI logic it's not something that can be done in any acceptable amount of time. Knowing the players screen resolution and display scale value would allow mods to set up their GUIs exactly how the core game does and that can be done in an acceptable amount of time.
I'm definetly not going to complain if we can get on_resolution_changed and player.resolution :D. It's still far superior than asking the player to manually add mod settings... (i kinda suspected relative size would be to time consuming to integrate now)
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

CmdrKeen
Long Handed Inserter
Long Handed Inserter
Posts: 98
Joined: Tue Sep 29, 2015 9:03 pm
Contact:

Re: a way to get a players screen resolution

Post by CmdrKeen »

eradicator wrote:
Rseding91 wrote:...
I'm definetly not going to complain if we can get on_resolution_changed and player.resolution :D. It's still far superior than asking the player to manually add mod settings... (i kinda suspected relative size would be to time consuming to integrate now)
I'm not gonna complain either. I'll probably go the route of helmod for now and have a dropdown available on the per-user mod configuration menu.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: a way to get a players screen resolution

Post by Rseding91 »

I've added support to read a given players display resolution for 0.16.

The resolution will be what ever the game window is running at.
If you want to get ahold of me I'm almost always on Discord.

Bilka
Factorio Staff
Factorio Staff
Posts: 3129
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: a way to get a players screen resolution

Post by Bilka »

How will that not turn into broken replays?
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: a way to get a players screen resolution

Post by Rseding91 »

Bilka wrote:How will that not turn into broken replays?
It operates the same way keyboard and mouse input does so you aren't actually reading the live display resolution but what the game was last told it is.
If you want to get ahold of me I'm almost always on Discord.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: a way to get a players screen resolution

Post by eradicator »

Rseding91 wrote:I've added support to read a given players display resolution for 0.16.

The resolution will be what ever the game window is running at.
All hail to the great Rsed. :mrgreen:
(and once again i notice a severe lack of a :worship: simley on the forums :lol: )
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Post Reply

Return to “Implemented mod requests”