Exemple #1
0
        public BLaunchWindow(BState startState)
        {
            InitializeComponent();
            this.startState = startState;

            if (!Directory.Exists(SETTINGS_PATH))
            {
                Directory.CreateDirectory(SETTINGS_PATH);
            }

            if (!File.Exists(Path.Combine(SETTINGS_PATH, $"{AppInfo.APP_FILESAFENAME}.json")))
            {
                this.CloseBox.Checked      = this.close;
                this.FullscreenBox.Checked = AppSettings.SETTING_FULLSCREEN;
                this.VsyncBox.Checked      = AppSettings.SETTING_VSYNC;
                this.VsyncBox.Enabled      = AppSettings.SETTING_FULLSCREEN;
                this.FpsBox.Text           = AppSettings.SETTING_FPS.ToString();
                this.WidthBox.Text         = AppSettings.SETTING_WIDTH.ToString();
                this.HeightBox.Text        = AppSettings.SETTING_HEIGHT.ToString();

                settings = new LaunchSettings(false, AppSettings.SETTING_FULLSCREEN, AppSettings.SETTING_VSYNC, AppSettings.SETTING_FPS, AppSettings.SETTING_WIDTH, AppSettings.SETTING_HEIGHT);
                settings.Save(Path.Combine(SETTINGS_PATH, $"{AppInfo.APP_FILESAFENAME}.json"));
            }
            else
            {
                settings                   = LaunchSettings.Load(Path.Combine(SETTINGS_PATH, $"{AppInfo.APP_FILESAFENAME}.json"));
                this.close                 = settings.CloseOnLaunch;
                this.CloseBox.Checked      = settings.CloseOnLaunch;
                this.FullscreenBox.Checked = settings.Fullscreen;
                this.VsyncBox.Checked      = settings.Vsync;
                this.VsyncBox.Enabled      = settings.Fullscreen;
                this.FpsBox.Text           = settings.Fps.ToString();
                this.WidthBox.Text         = settings.WindowWidth.ToString();
                this.HeightBox.Text        = settings.WindowHeight.ToString();
            }

            this.Text = $"Made with BEngine2D - {AppInfo.APP_NAME}";
        }
Exemple #2
0
 private void SaveSettings(object sender, EventArgs e)
 {
     ApplySettings(sender, e);
     settings.Save(Path.Combine(SETTINGS_PATH, $"{AppInfo.APP_FILESAFENAME}.json"));
 }