Jump to content

Resolution


Arkathorn

Recommended Posts

Guess. It shouldn't be hard to tell at all.

???

 

Does anyone happen to know how to fetch the current resolution? I've been rooting through the options screen, but it's quite dense, so I wondered if anyone knows already.

 

I don't know, but at the top of constants.lua there are these

RESOLUTION_X = 1280RESOLUTION_Y = 720
So maybe the resolution is the same no matter what your screen size is? It would explain why the game window stays the same dimension when you try and shrink it down in non-fullscreen mode.

(or maybe that's not how it works, not sure)

Link to comment
Share on other sites

I found it! Well, mostly...

AddGlobalClassPostConstruct("frontend", "FrontEnd", function(self)	self.GetResolution = function(inst)		local go = inst:GetGraphicsOptions()		local id = go:GetFullscreenDisplayID()		local mode_id = go:GetCurrentDisplayModeID(id)		return go:GetDisplayMode(id, mode_id)	endend)

This code adds a function to TheFrontEnd that returns the width, height, and refresh rate of the display. Unfortunately, it only works if the game is in fullscreen. If otherwise, it will return the settings that it has stored for fullscreen play.

 

I think it is unlikely that we will be able to fetch the resolution of a window, that being an OS/Framework operation. If there is nothing referencing it in the lua, I doubt we will be able to access such functionality.

 

A general function that fetches the resolution is definitely something I would suggest to the developers, whenever the base game is next updated. However, I am unsure how to make such a suggestion.

 

 

It is probably worth mentioning that this line of questioning arose from trying to calculate the cursor's position relative to the center of the screen (as widget coordinates are expressed), rather than the lower left-hand corner. I don't suppose anyone knows some magical way to do this, besides the calculation using the game's resolution?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...