Code review comment for lp:~der-treba/stratagus/stratagus

Revision history for this message
treba (der-treba) wrote :

> So where do I put this code to make it work in the game? I would like to see
> what this code does so how can we get it working?

i'm not sure if i'm getting your question, but if it is about how you can use it inside the game:

well, you can use it for example in the stratagus.lua:
...
local defaultPreferences = {
    ...
    VideoWidth = GetCurrentResolution()[1],
    VideoHeight = GetCurrentResolution()[2],
    ...
}
...

that will give you your native resolution as default. so if the game supports it and you don't specify a particular resolution, you will always have the native one, regardles what monitor you are using.

GetAvailableResolutions allows to build a dynamic list of resolutions in the options menu.
this will print them to stdout:

if GetAvailableResolutions() then
 for _,v in ipairs(GetAvailableResolutions()) do
  print(v[1]..'x'..v[2])
 end
end

« Back to merge proposal