As you see I been developing the videosettings scripting class to allow Lua to control the video card display settings. This will allow for users to make their own custom video setting page. The one i'm scripting will be include in each template, and it will have 100% of the features.
I will also be updating the UI scripting class to return the id when creating a new control. the Example bellow has combo boxes using this new method.
dofile("Scripting\\Base\\Keys.lua")
Scripting_RegisterClass("ui")
Scripting_RegisterClass("engine")
Scripting_RegisterClass("camera")
Scripting_RegisterClass("videosettings")
dialogID = nil
CBResolution = nil
CBAdapter = nil
function loadUI()
_width = Engine.GetWindowWidth()
_height = Engine.GetWindowHeight()
_offsetX = _width - 160
dialogID = UI.Dialog.Add(0, 0, _width , _height )
UI.Label.Add(dialogID, 22, "Display Adapter", 10, 50, 180, 23)
CBAdapter = UI.ComboBox.Add(dialogID,200, 180, 300, 23)
UI.RadioButton.Add(dialogID, 16, 0, "Windowed", 240, 105, 300, 16, true)
UI.RadioButton.Add(dialogID, 17, 0, "Full Screen",240, 147, 300, 16, false)
UI.Label.Add(dialogID, 1, "Resolution",10, 205, 180, 23)
CBResolution = UI.ComboBox.Add(dialogID, 200, 205, 300, 23)
UI.Button.Add(dialogID, 13, "OK", 0, 24, 150, 20, " OnOK_Clicked()", Keys.Enter)
SetEvents()
SetControlsData()
end
function SetEvents()
UI.ComboBox.SetChangedEvent(dialogID,CBAdapter , "VideoSettings.OnAdapterChanged(" .. dialogID .. "," .. CBAdapter .. ")")
UI.ComboBox.SetChangedEvent(dialogID,CBResolution , "VideoSettings.OnResolutionChanged(" .. dialogID .. "," .. CBResolution .. ")")
UI.RadioButton.SetChangedEvent(dialogID, 17, "OnWindowedFullscreenChanged()")
UI.RadioButton.SetChangedEvent(dialogID, 16, "OnWindowedFullscreenChanged()")
end
function SetControlsData()
VideoSettings.FillResolutions(dialogID, CBResolution)
VideoSettings.FillAdapters(dialogID,CBAdapter)
isWindowed = VideoSettings.GetIsWindowed()
UI.RadioButton.SetChecked(dialogID, 16, isWindowed)
UI.RadioButton.SetChecked(dialogID, 17, not isWindowed)
SetControlsEnabled(isWindowed)
end
function OnWindowedFullscreenChanged()
_isWindowed = UI.RadioButton.GetChecked(dialogID, 16)
SetControlsEnabled(_isWindowed)
VideoSettings.OnWindowedFullscreenChanged(_isWindowed)
VideoSettings.OnResolutionChanged( dialogID, CBResolution )
end
function OnOK_Clicked()
VideoSettings.OnOkClicked(nil,nil)
UI.Load('MainMenu.lua', true)
end
function SetControlsEnabled(isWindowed)
UI.SetEnable(dialogID, CBResolution, not isWindowed)
end
loadUI()
Also here what that script look like so far. It a bit of a mess, but working great.