void InitializeOptions() { DisplayMode.Initialize(System.Enum.GetNames(typeof(Settings.DisplayMode)), (int)Settings._displayMode); ResolutionIndex.Initialize(Vector2IntToOptions(Settings.Resolution), Settings._resolutionIndex); FramerateLimitIndex.Initialize(IntToOptions(Settings.FramerateLimit), Settings._framerateLimitIndex); ConsoleEnabled.Initialize(Settings._devConsoleEnabled); MouseSensitivity.Initialize(Settings._mouseSensitivity); InvertedLook.Initialize(Settings._invertedLook); MasterVolume.Initialize(Settings._masterVolume); SFXVolume.Initialize(Settings._sfxVolume); MusicVolume.Initialize(Settings._musicVolume); }
void InitializeOptions() { DisplayMode.Initialize(System.Enum.GetNames(typeof(Settings.DisplayMode)), (int)Settings._displayMode); ResolutionIndex.Initialize(Vector2IntToOptions(Settings.Resolution), Settings._resolutionIndex); FramerateLimitIndex.Initialize(IntToOptions(Settings.FramerateLimit), Settings._framerateLimitIndex); TextureQuality.Initialize(System.Enum.GetNames(typeof(Settings.TextureQuality)), (int)Settings._textureQuality); AntiAliasing.Initialize(IntToOptions(Settings.AntiAliasing), Settings._antiAliasingIndex); ViewDistance.Initialize(System.Enum.GetNames(typeof(Settings.ViewDistance)), (int)Settings._viewDistance); MouseSensitivity.Initialize(Settings._mouseSensitivity); InvertedLook.Initialize(Settings._invertedLook); MasterVolume.Initialize(Settings._masterVolume); SFXVolume.Initialize(Settings._sfxVolume); MusicVolume.Initialize(Settings._musicVolume); QuickBlackout.Initialize(Settings._quickBlackout); VoiceVolume.Initialize(Settings._voiceVolume); }
static void Main(string[] args) { WindowCreateInfo windowCI = new WindowCreateInfo() { X = 100, Y = 100, WindowWidth = 960, WindowHeight = 540, WindowTitle = "SimpleGui Example" }; Sdl2Window window = VeldridStartup.CreateWindow(ref windowCI); _graphicsDevice = VeldridStartup.CreateGraphicsDevice(window); gui = new Gui(window, _graphicsDevice); control = new Control() { Size = new Vector2(500, 500), Position = new Vector2(5, 5), ColorType = ControlColorType.Form, IsHoverable = false, IsClickable = false }; control.Initialize(); control.SetCenterScreen(); gui.SceneGraph.Root.AddChild(control); text = new Text("Text") { Position = new Vector2(5, 5), Size = new Vector2(100, 34), }; text.Initialize(); control.AddChild(text); button = new Button("Button") { Size = new Vector2(100, 34), Position = new Vector2(5, 40), }; button.Initialize(); control.AddChild(button); button.MouseUp = () => { text.Content = "Hello"; text.Recreate(); colorPicker = new ColorPicker() { }; colorPicker.Initialize(); colorPicker.SetCenterScreen(); gui.SceneGraph.Root.AddChild(colorPicker); colorPicker.Closed = () => { gui.SceneGraph.Root.RemoveChild(colorPicker); colorPicker.Dispose(); }; }; textBox = new TextBox() { Size = new Vector2(160, 34), Position = new Vector2(5, 80), Text = "TextBox" }; textBox.Initialize(); control.AddChild(textBox); checkbox = new Checkbox() { Size = new Vector2(120, 24), Position = new Vector2(5, 120), Text = "Checkbox" }; checkbox.Initialize(); control.AddChild(checkbox); image = new Image("gui/Test.png") { Size = new Vector2(150, 150), Position = new Vector2(5, 160), }; image.Initialize(); control.AddChild(image); listBox = new ListBox() { Size = new Vector2(120, 120), Position = new Vector2(180, 5), }; listBox.Initialize(); listBox.AddItem("ListBoxItem 1"); listBox.AddItem("ListBoxItem 2"); listBox.AddItem("ListBoxItem 3"); control.AddChild(listBox); CreateResources(); while (window.Exists) { var snap = window.PumpEvents(); if (window.Exists) { gui.Update(snap); Draw(); Thread.Sleep(1); } } DisposeResources(); }