Arkathorn Posted November 24, 2015 Share Posted November 24, 2015 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. Link to comment https://forums.kleientertainment.com/forums/topic/59382-resolution/ Share on other sites More sharing options...
Woodlegs Posted November 24, 2015 Share Posted November 24, 2015 Guess. It shouldn't be hard to tell at all. Link to comment https://forums.kleientertainment.com/forums/topic/59382-resolution/#findComment-688320 Share on other sites More sharing options...
Arkathorn Posted November 24, 2015 Author Share Posted November 24, 2015 Guess. It shouldn't be hard to tell at all.I know my resolution, but I need the code to detect it. Link to comment https://forums.kleientertainment.com/forums/topic/59382-resolution/#findComment-688321 Share on other sites More sharing options...
pickleplayer Posted November 24, 2015 Share Posted November 24, 2015 (edited) 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 theseRESOLUTION_X = 1280RESOLUTION_Y = 720So 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) Edited November 24, 2015 by pickleplayer Link to comment https://forums.kleientertainment.com/forums/topic/59382-resolution/#findComment-688325 Share on other sites More sharing options...
Arkathorn Posted November 24, 2015 Author Share Posted November 24, 2015 RESOLUTION_X = 1280RESOLUTION_Y = 720Those are probably the default resolution. Link to comment https://forums.kleientertainment.com/forums/topic/59382-resolution/#findComment-688332 Share on other sites More sharing options...
Arkathorn Posted November 24, 2015 Author Share Posted November 24, 2015 (edited) 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? Edited November 24, 2015 by Arkathorn Link to comment https://forums.kleientertainment.com/forums/topic/59382-resolution/#findComment-688338 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now