Exemplo n.º 1
0
        void infoButton_Click(object sender, EventArgs e)
        {
            Dialog.SetRefreshTime((float)FrameworkTimer.GetTime());
            Thread thread = new Thread(new ThreadStart(LaunchWebSiteRun));

            thread.Start();
        }
Exemplo n.º 2
0
 void buttonOk_Click(object sender, EventArgs e)
 {
     SaveSettings();
     owner.Player.FlightModel.Paused = false;
     Dialog.SetRefreshTime((float)FrameworkTimer.GetTime());
     parent.HideDialog();
 }
Exemplo n.º 3
0
 void buttonOk_Click(object sender, EventArgs e)
 {
     if (changed)
     {
         AircraftInfo ai = aircraftCombo.GetSelectedData() as AircraftInfo;
         if (ai != null)
         {
             if (checkboxStartOnWater.IsChecked && checkboxStartOnWater.IsVisible)
             {
                 owner.Player.TakeOffFromWater = true;
             }
             else
             {
                 owner.Player.TakeOffFromWater = false;
             }
             owner.Player.LoadModel(ai.ParFile);
             if (owner.Player.AircraftParameters.AllowsTowing)
             {
                 owner.CenterHud.ShowGameText("Press 'T' to start towing", 30f);
             }
             else
             {
                 owner.CenterHud.ShowGameText("", 0f);
             }
         }
         Program.Instance.SetWaterCamera(owner.Player.TakeOffFromWater);
     }
     owner.Player.FlightModel.Paused = false;
     Dialog.SetRefreshTime((float)FrameworkTimer.GetTime());
     owner.CenterHud.SetCrashPicture(owner.Player.AircraftParameters.AdLocation, url, owner.Player.AircraftParameters.FolderName);
     parent.HideDialog();
 }
Exemplo n.º 4
0
        void buttonOk_Click(object sender, EventArgs e)
        {
            owner.Player.FlightModel.Paused = false;

            Dialog.SetRefreshTime((float)FrameworkTimer.GetTime());

            if (changed)
            {
                // The device needs to be updated
                if (globalSettings.presentParams.Windowed)
                {
                    globalSettings.presentParams.FullScreenRefreshRateInHz = 0;
                    globalSettings.presentParams.BackBufferWidth           = (int)windowWidth;
                    globalSettings.presentParams.BackBufferHeight          = (int)windowHeight;
                }

                if (globalSettings.presentParams.MultiSample != MultiSampleType.None)
                {
                    globalSettings.presentParams.PresentFlag &= ~PresentFlag.LockableBackBuffer;
                }

                // Save settings
                Bonsai.Utils.Settings.SetValue("FullScreen", fullscreen.ToString());
                if (fullscreen)
                {
                    Bonsai.Utils.Settings.SetValue("ResolutionWidth", resX.ToString());
                    Bonsai.Utils.Settings.SetValue("ResolutionHeight", resY.ToString());
                }

                // Create a device
                parent.CreateDeviceFromSettings(globalSettings);
            }
            parent.HideDialog();
        }
Exemplo n.º 5
0
 /// <summary>
 /// Handles the click event of the demo button.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void demoButton_Click(object sender, EventArgs e)
 {
     Dialog.SetRefreshTime((float)FrameworkTimer.GetTime());
     if (DemoClicked != null)
     {
         DemoClicked(this, EventArgs.Empty);
     }
 }
Exemplo n.º 6
0
 public virtual void OnShowDialog()
 {
     Dialog.SetRefreshTime((float)FrameworkTimer.GetTime());
     if (centered)
     {
         Center();
     }
 }
Exemplo n.º 7
0
 void crashPicture_Click(object sender, EventArgs e)
 {
     if (crashUrl != null)
     {
         Dialog.SetRefreshTime((float)FrameworkTimer.GetTime());
         Thread thread = new Thread(new ThreadStart(LaunchWebSiteRun));
         thread.Start();
     }
 }
Exemplo n.º 8
0
        private void ModelRun()
        {
            double currentTime  = FrameworkTimer.GetTime();
            double previousTime = currentTime;

            while (running)
            {
                float elapsedTime = (float)(currentTime - previousTime);
                MoveScene(elapsedTime);
                previousTime = currentTime;
                Thread.Sleep(2);
                currentTime = FrameworkTimer.GetTime();
            }
        }
Exemplo n.º 9
0
 void buttonOk_Click(object sender, EventArgs e)
 {
     if (changed)
     {
         SceneryInfo sceneryInfo = comboSceneries.GetSelectedData() as SceneryInfo;
         if (sceneryInfo != null)
         {
             Program.Instance.Scenery.LoadDefinition(sceneryInfo.ParFile);
         }
         Program.Instance.Player.Reset();
     }
     owner.Player.FlightModel.Paused = false;
     Dialog.SetRefreshTime((float)FrameworkTimer.GetTime());
     parent.HideDialog();
 }
Exemplo n.º 10
0
 void Device_DeviceReset(object sender, EventArgs e)
 {
     base.OnResetDevice();
     Dialog.SetRefreshTime((float)FrameworkTimer.GetTime());
 }
Exemplo n.º 11
0
        /// <summary>Changes the UI defaults to the current device settings</summary>
        public void Refresh()
        {
            // Get some information
            globalSettings = parent.DeviceSettings.Clone();
            System.Drawing.Rectangle client = parent.WindowClientRectangle;
            windowWidth  = (uint)client.Width;
            windowHeight = (uint)client.Height;

            // Fill the UI with the current settings
            if (!deviceCombo.ContainsItem(globalSettings.DeviceType.ToString()))
            {
                deviceCombo.AddItem(globalSettings.DeviceType.ToString(), globalSettings.DeviceType.ToString());
            }

            SetWindowed(globalSettings.presentParams.Windowed);
            clipBox.IsChecked = ((globalSettings.presentParams.PresentFlag & PresentFlag.DeviceClip) != 0);

            if (!adapterFormatCombo.ContainsItem(globalSettings.AdapterFormat.ToString()))
            {
                adapterFormatCombo.AddItem(globalSettings.AdapterFormat.ToString(), globalSettings.AdapterFormat);
            }

            AddResolution((short)globalSettings.presentParams.BackBufferWidth, (short)globalSettings.presentParams.BackBufferHeight);
            AddRefreshRate(globalSettings.presentParams.FullScreenRefreshRateInHz);

            if (!backBufferCombo.ContainsItem(globalSettings.presentParams.BackBufferFormat.ToString()))
            {
                backBufferCombo.AddItem(globalSettings.presentParams.BackBufferFormat.ToString(), globalSettings.presentParams.BackBufferFormat);
            }

            if (!depthStencilCombo.ContainsItem(globalSettings.presentParams.AutoDepthStencilFormat.ToString()))
            {
                depthStencilCombo.AddItem(globalSettings.presentParams.AutoDepthStencilFormat.ToString(), globalSettings.presentParams.AutoDepthStencilFormat);
            }

            if (!multiSampleTypeCombo.ContainsItem(globalSettings.presentParams.MultiSample.ToString()))
            {
                multiSampleTypeCombo.AddItem(globalSettings.presentParams.MultiSample.ToString(), globalSettings.presentParams.MultiSample);
            }

            if (!multiSampleQualityCombo.ContainsItem(globalSettings.presentParams.MultiSampleQuality.ToString()))
            {
                multiSampleQualityCombo.AddItem(globalSettings.presentParams.MultiSampleQuality.ToString(), globalSettings.presentParams.MultiSampleQuality);
            }

            if (!presentCombo.ContainsItem(globalSettings.presentParams.PresentationInterval.ToString()))
            {
                presentCombo.AddItem(globalSettings.presentParams.PresentationInterval.ToString(), globalSettings.presentParams.PresentationInterval);
            }

            if (!textureFilterCombo.ContainsItem(globalSettings.TextureFilter.ToString()))
            {
                textureFilterCombo.AddItem(globalSettings.TextureFilter.ToString(), globalSettings.TextureFilter);
            }

            BehaviorFlags flags = new BehaviorFlags(globalSettings.BehaviorFlags);

            if (flags.PureDevice)
            {
                AddVertexProcessing(CreateFlags.PureDevice);
            }
            else if (flags.HardwareVertexProcessing)
            {
                AddVertexProcessing(CreateFlags.HardwareVertexProcessing);
            }
            else if (flags.SoftwareVertexProcessing)
            {
                AddVertexProcessing(CreateFlags.SoftwareVertexProcessing);
            }
            else if (flags.MixedVertexProcessing)
            {
                AddVertexProcessing(CreateFlags.MixedVertexProcessing);
            }

            // Get the adapters list from Enumeration object
            ArrayList adapterInfoList = Enumeration.AdapterInformationList;

            if (adapterInfoList.Count == 0)
            {
                throw new NoCompatibleDevicesException();
            }

            adapterCombo.Clear();

            // Add all of the adapters
            for (int iAdapter = 0; iAdapter < adapterInfoList.Count; iAdapter++)
            {
                EnumAdapterInformation adapterInfo = adapterInfoList[iAdapter] as EnumAdapterInformation;
                if (!adapterCombo.ContainsItem(adapterInfo.UniqueDescription))
                {
                    adapterCombo.AddItem(adapterInfo.UniqueDescription, iAdapter);
                }
            }
            adapterCombo.SetSelectedByData(globalSettings.AdapterOrdinal);

            // The adapter changed, call the handler
            OnAdapterChanged(adapterCombo, System.EventArgs.Empty);

            Dialog.SetRefreshTime((float)FrameworkTimer.GetTime());
        }