dofile("Scripting\\Base\\Keys.lua")
Scripting_RegisterClass("ui")
Scripting_RegisterClass("engine")
Scripting_RegisterClass("camera")
Scripting_RegisterClass("videosettings")
dialogID = nil
CBResolution = nil
CBAdapter = nil
CBDevice = nil
CBAdapterFormat = nil
CBRefresh = nil
function loadUI()
_width = Engine.GetWindowWidth()
_height = Engine.GetWindowHeight()
_offsetX = _width - 160
dialogID = UI.Dialog.Add(0, 0, _width , _height )
UI.Label.Add(dialogID, "Display Adapter", 10, 50, 180, 23)
CBAdapter = UI.ComboBox.Add(dialogID,200, 50, 300, 23)
UI.Label.Add(dialogID, "Render Device", 10, 75, 180, 23);
CBDevice = UI.ComboBox.Add(dialogID, 200, 75, 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,"Adapter Format", 10, 180, 180, 23);
CBAdapterFormat = UI.ComboBox.Add(dialogID, 200, 180, 300, 23);
UI.Label.Add(dialogID,"Resolution",10, 205, 180, 23)
CBResolution = UI.ComboBox.Add(dialogID, 200, 205, 300, 23)
-- Refresh Rate
UI.Label.Add(dialogID, "Refresh Rate", 10, 230, 180, 23);
CBRefresh = UI.ComboBox.Add(dialogID, 200, 230, 300, 23);
-- BackBuffer Format
UI.Label.Add(dialogID, "Back Buffer Format", 10, 265, 180, 23 );
backBufferCombo = UI.ComboBox.Add(dialogID, 200, 265, 300, 23 );
-- Depth Stencil
UI.Label.Add(dialogID,"Depth/Stencil Format", 10, 290, 180, 23 );
depthStencilCombo = UI.ComboBox.Add(dialogID, 200, 290, 300, 23 );
-- Multisample Type
UI.Label.Add(dialogID,"Multisample Type", 10, 315, 180, 23 );
multiSampleTypeCombo = UI.ComboBox.Add(dialogID, 200, 315, 300, 23 );
-- Multisample Quality
UI.Label.Add(dialogID,"Multisample Quality", 10, 340, 180, 23 );
multiSampleQualityCombo = UI.ComboBox.Add(dialogID, 200, 340, 300, 23 );
-- Vertex Processing
UI.Label.Add(dialogID,"Vertex Processing", 10, 365, 180, 23 );
vertexCombo = UI.ComboBox.Add(dialogID, 200, 365, 300, 23 );
-- Present Interval
UI.Label.Add(dialogID,"Present Interval", 10, 390, 180, 23 );
presentCombo = UI.ComboBox.Add(dialogID, 200, 390, 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()