示例#1
0
        public void Initialize()
        {
            dialog = new Dialog(Framework.Instance);
            dialog.SetFont(0, "Arial", 14, FontWeight.Normal);
            dialog.SetFont(1, "Arial", 20, FontWeight.Bold);
            dialog.SetSize(600, 400);
            dialog.SetBackgroundColors(
                new ColorValue(0.5f, 0.5f, 0.5f, 128f),
                new ColorValue(0.5f, 0.5f, 0.5f, 128f),
                new ColorValue(0, 0, 0, 128f),
                new ColorValue(0, 0, 0, 128f));

            text = dialog.AddStatic((int)WelcomeDialogControlIds.Static,
                                    "Hi, and welcome to R/C Desk Pilot.\nDownloading news, please wait...",
                                    dialog.Width / 2 - 290, 10, 580, 265);
            Element e = text[0];

            e.FontIndex  = 1;
            e.textFormat = DrawTextFormat.Top | DrawTextFormat.Center | DrawTextFormat.WordBreak;

            infoButton        = dialog.AddButton((int)WelcomeDialogControlIds.InfoButton, "website", dialog.Width / 2 - 70, dialog.Height - 120, 140, 30);
            infoButton.Click += new EventHandler(infoButton_Click);
            e            = infoButton[0];
            e.FontIndex  = 1;
            e.textFormat = DrawTextFormat.VerticalCenter | DrawTextFormat.Center | DrawTextFormat.WordBreak;
            e            = infoButton[1];
            e.FontIndex  = 1;
            e.textFormat = DrawTextFormat.VerticalCenter | DrawTextFormat.Center | DrawTextFormat.WordBreak;

            startText = dialog.AddStatic((int)WelcomeDialogControlIds.Static,
                                         "Click one of the buttons below to start flying or watch the demo.",
                                         dialog.Width / 2 - 290, dialog.Height - 80, 580, 30);
            e            = startText[0];
            e.FontIndex  = 1;
            e.textFormat = DrawTextFormat.Top | DrawTextFormat.Center | DrawTextFormat.WordBreak;

            startButton        = dialog.AddButton((int)WelcomeDialogControlIds.StartButton, "Start", dialog.Width / 4 - 60, dialog.Height - 40, 120, 30);
            startButton.Click += new EventHandler(startButton_Click);
            e            = startButton[0];
            e.FontIndex  = 1;
            e.textFormat = DrawTextFormat.VerticalCenter | DrawTextFormat.Center | DrawTextFormat.WordBreak;
            e            = startButton[1];
            e.FontIndex  = 1;
            e.textFormat = DrawTextFormat.VerticalCenter | DrawTextFormat.Center | DrawTextFormat.WordBreak;

            demoButton        = dialog.AddButton((int)WelcomeDialogControlIds.DemoButton, "Demo", 3 * dialog.Width / 4 - 60, dialog.Height - 40, 120, 30);
            demoButton.Click += new EventHandler(demoButton_Click);
            e            = demoButton[0];
            e.FontIndex  = 1;
            e.textFormat = DrawTextFormat.VerticalCenter | DrawTextFormat.Center | DrawTextFormat.WordBreak;
            e            = demoButton[1];
            e.FontIndex  = 1;
            e.textFormat = DrawTextFormat.VerticalCenter | DrawTextFormat.Center | DrawTextFormat.WordBreak;
        }
示例#2
0
        /// <summary>Initializes the application</summary>
        public void InitializeApplication()
        {
            isUsingPreshader = true;

            for (int i = 0; i < MaxNumberLights; i++)
            {
                lightControl[i] = new DirectionWidget();
                lightControl[i].LightDirection = new Vector3((float)Math.Sin((float)Math.PI
                                                                             * 2 * i / MaxNumberLights - (float)Math.PI / 6), 0, -(float)Math.Cos((float)Math.PI
                                                                                                                                                  * 2 * i / MaxNumberLights - (float)Math.PI / 6));
            }

            activeLight        = 0;
            numberActiveLights = 1;
            lightScale         = 1.0f;

            int y = 10;
            // Initialize the dialogs
            Button fullScreen   = hud.AddButton(ToggleFullscreen, "Toggle full screen", 35, y, 125, 22);
            Button toggleRef    = hud.AddButton(ToggleReference, "Toggle reference (F3)", 35, y += 24, 125, 22);
            Button changeDevice = hud.AddButton(ChangeDevice, "Change Device (F2)", 35, y += 24, 125, 22);

            // Hook the button events for when these items are clicked
            fullScreen.Click   += new EventHandler(OnFullscreenClicked);
            toggleRef.Click    += new EventHandler(OnRefClicked);
            changeDevice.Click += new EventHandler(OnChangeDevicClicked);

            // Now add the sample specific UI
            y = 10;
            sampleUi.AddStatic(NumberLightsStatic, string.Format("# Lights: {0}", numberActiveLights), 35, y += 24, 125, 22);
            Slider lightSlider = sampleUi.AddSlider(NumberLights, 50, y += 24, 100, 22, 1, MaxNumberLights, numberActiveLights, false);

            y += 24;
            sampleUi.AddStatic(LightScaleStatic, string.Format("Light scale: {0}", lightScale.ToString("f2",
                                                                                                       System.Globalization.CultureInfo.CurrentUICulture)), 35, y += 24, 125, 22);
            Slider scaleSlider = sampleUi.AddSlider(LightScaleControl, 50, y += 24, 100, 22, 0, 20, (int)(lightScale * 10.0f), false);

            y += 24;
            Button activeLightControl = sampleUi.AddButton(ActiveLightControl, "Change active light (K)", 35, y += 24, 125, 22,
                                                           System.Windows.Forms.Keys.K, false);
            Checkbox preShader = sampleUi.AddCheckBox(EnablePreshader, "Enable preshaders", 35, y += 24, 125, 22, isUsingPreshader);

            // Hook the events
            preShader.Changed        += new EventHandler(OnPreshaderClick);
            lightSlider.ValueChanged += new EventHandler(OnNumberLightsChanged);
            activeLightControl.Click += new EventHandler(OnActiveLightClick);
            scaleSlider.ValueChanged += new EventHandler(OnLightScaleChanged);
        }
示例#3
0
        /// <summary>
        /// Initializes the application
        /// </summary>
        public void InitializeApplication()
        {
            int y = 10;
            // Initialize the HUD
            Button fullScreen   = hud.AddButton(ToggleFullscreen, "Toggle full screen", 35, y, 125, 22);
            Button toggleRef    = hud.AddButton(ToggleReference, "Toggle reference (F3)", 35, y += 24, 125, 22);
            Button changeDevice = hud.AddButton(ChangeDevice, "Change Device (F2)", 35, y += 24, 125, 22);

            // Hook the button events for when these items are clicked
            fullScreen.Click   += new EventHandler(OnFullscreenClicked);
            toggleRef.Click    += new EventHandler(OnRefClicked);
            changeDevice.Click += new EventHandler(OnChangeDevicClicked);

            // Now add the sample specific UI
            y = 10;
            Checkbox fillModeBox = sampleUi.AddCheckBox(FillModeButton, "WireFrame (F8)", 35, y, 150, 20, false,
                                                        System.Windows.Forms.Keys.F8, false);

            sampleUi.AddStatic(SegmentLabel, "Number of segments: 2", 10, y += 30, 150, 16);
            Slider   segmentSlider = sampleUi.AddSlider(SegmentSlider, 10, y += 14, 150, 24, 1, 10, 2, false);
            Checkbox hwPatch       = sampleUi.AddCheckBox(HwPatchButton, "User hardware N-patches", 10, y += 26, 150, 20, true,
                                                          System.Windows.Forms.Keys.H, false);

            // Hook the events
            fillModeBox.Changed        += new EventHandler(OnFillmodeChanged);
            segmentSlider.ValueChanged += new EventHandler(OnSegmentChanged);
            hwPatch.Changed            += new EventHandler(OnHardwareChanged);
        }
示例#4
0
        /// <summary>
        /// Initializes the application
        /// </summary>
        public void InitializeApplication()
        {
            int y = 10;
            // Initialize the HUD
            Button fullScreen   = hud.AddButton(ToggleFullscreen, "Toggle full screen", 35, y, 125, 22);
            Button toggleRef    = hud.AddButton(ToggleReference, "Toggle reference (F3)", 35, y += 24, 125, 22);
            Button changeDevice = hud.AddButton(ChangeDevice, "Change Device (F2)", 35, y += 24, 125, 22);

            // Hook the button events for when these items are clicked
            fullScreen.Click   += new EventHandler(OnFullscreenClicked);
            toggleRef.Click    += new EventHandler(OnRefClicked);
            changeDevice.Click += new EventHandler(OnChangeDevicClicked);

            // Now add the sample specific UI
            y = 10;
            sampleUi.IsUsingKeyboardInput = true;
            sampleUi.AddStatic(DetailLabel, "Level of Detail:", 0, y, 200, 16);
            Checkbox opt = sampleUi.AddCheckBox(UseOptimizedCheckBox, "Use optimized mesh", 50, y, 200, 20, true);
            Slider   sl  = sampleUi.AddSlider(Detail, 10, y += 16, 200, 16, 4, 4, 4, false);

            // Hook the sample events
            opt.Changed     += new EventHandler(OnOptimizedChanged);
            sl.ValueChanged += new EventHandler(OnDetailChanged);

            // Set button masks
            camera.SetButtonMasks((int)MouseButtonMask.Left, (int)MouseButtonMask.Wheel, 0);
        }
示例#5
0
        private StaticText AddStaticText(int y)
        {
            StaticText text = dialog.AddStatic((int)CenterHudControlIds.Static, "", 10, y, dialog.Width, 20);
            Element    e    = text[0];

            e.FontIndex    = 0;
            e.textFormat   = DrawTextFormat.Left;
            text.IsVisible = false;
            return(text);
        }
示例#6
0
        public void Initialize()
        {
            dialog = new Dialog(Framework.Instance);
            dialog.SetFont(0, "Arial", 14, FontWeight.Normal);
            dialog.SetFont(1, "Arial", 28, FontWeight.Bold);

            captionText = dialog.AddStatic((int)CenterHudControlIds.Static, "Hello world", 0, dialog.Height - 50, dialog.Width, 22);
            Element e = captionText[0];

            e.FontIndex = 1;

            infoText           = dialog.AddStatic((int)CenterHudControlIds.Static, "", 5, 5, 630, 40);
            e                  = infoText[0];
            e.FontIndex        = 0;
            e.textFormat       = DrawTextFormat.Left;
            infoText.IsVisible = false;

            gameText     = dialog.AddStatic((int)CenterHudControlIds.Static, "", 150, 30, dialog.Width - 300, 60);
            e            = gameText[0];
            e.FontIndex  = 1;
            e.textFormat = DrawTextFormat.Center | DrawTextFormat.WordBreak;

            //crashPicture = dialog.AddPicture((int)CenterHudControlIds.CrashPicture, "/data/crash.png", dialog.Width / 4, dialog.Height / 4, dialog.Width / 2, dialog.Height / 2);
            //crashPicture.SourceRectangle = new System.Drawing.Rectangle(0, 0, 512, 512);
            //crashPicture.IsVisible = crashed;

#if LOGO
            if (Utility.MediaExists("/data/logo.png"))
            {
                logoPicture = dialog.AddPicture((int)CenterHudControlIds.LogoPicture, "/data/logo.png", dialog.Width - 100, dialog.Height - 60, 50, 28);
                logoPicture.SourceRectangle = new System.Drawing.Rectangle(0, 0, 128, 64);
            }
#endif

            messages.Add(AddStaticText(dialog.Height - 70));
            messages.Add(AddStaticText(dialog.Height - 50));
            messages.Add(AddStaticText(dialog.Height - 30));

            int y = 10;

            menuButton        = dialog.AddButton((int)CenterHudControlIds.MenuButton, "menu", 10, y += 30, 120, 21);
            menuButton.Click += new EventHandler(menuButton_Click);

            resetButton        = dialog.AddButton((int)CenterHudControlIds.ResetButton, "reset (ENTER)", 10, y += 30, 120, 21);
            resetButton.Click += new EventHandler(resetButton_Click);

            toggleSmokeButton        = dialog.AddButton((int)CenterHudControlIds.ToggleSmokeButton, "toggle smoke (S)", 10, y += 30, 120, 21);
            toggleSmokeButton.Click += new EventHandler(toggleSmokeButton_Click);

            viewButton        = dialog.AddButton((int)CenterHudControlIds.ViewButton, "change view (V)", 10, y += 30, 120, 21);
            viewButton.Click += new EventHandler(viewButton_Click);

            autozoomButton        = dialog.AddButton((int)CenterHudControlIds.AutozoomButton, "camera mode (B)", 10, y += 30, 120, 21);
            autozoomButton.Click += new EventHandler(autozoomButton_Click);

            zoomInButton        = dialog.AddButton((int)CenterHudControlIds.ZoomInButton, "zoom in (+)", 10, y += 30, 120, 21);
            zoomInButton.Click += new EventHandler(zoomInButton_Click);

            zoomOutButton        = dialog.AddButton((int)CenterHudControlIds.ZoomOutButton, "zoom out (-)", 10, y += 30, 120, 21);
            zoomOutButton.Click += new EventHandler(zoomOutButton_Click);

            gameRestartButton           = dialog.AddButton((int)CenterHudControlIds.GameRestartButton, "restart challenge", 10, 10, 120, 21);
            gameRestartButton.IsVisible = false;
            gameRestartButton.Click    += new EventHandler(gameRestartButton_Click);

            mapPicture = dialog.AddPicture((int)CenterHudControlIds.MapPicture, "data/scenery/default/map_1.png", 10, 10, 128, 128);
            mapPicture.SourceRectangle = new System.Drawing.Rectangle(0, 0, 128, 128);

            mapOverlay = dialog.AddPicture((int)CenterHudControlIds.MapOverlayPicture, "data/map_overlay.png", 10, 10, 128, 128);
            mapOverlay.SourceRectangle = new System.Drawing.Rectangle(0, 0, 128, 128);

            altituteText = dialog.AddStatic((int)CenterHudControlIds.AltitudeText, "alt: 0m", 10, 74, 128, 64);
            e            = altituteText[0];
            e.FontIndex  = 0;
            e.textFormat = DrawTextFormat.Center | DrawTextFormat.WordBreak;

            MapVisible = Convert.ToBoolean(Settings.GetValue("CompassVisible", "true"));

            Framework.Instance.Window.MouseMove += new System.Windows.Forms.MouseEventHandler(Window_MouseMove);
        }
示例#7
0
        /// <summary>
        /// Creates the controls for use in the dialog
        /// </summary>
        private void CreateControls()
        {
            dialog = new Dialog(parent);
            dialog.IsUsingKeyboardInput = true;
            dialog.SetFont(0, "Arial", 15, FontWeight.Normal);
            dialog.SetFont(1, "Arial", 28, FontWeight.Bold);

            // Right justify static controls
            Element e = dialog.GetDefaultElement(ControlType.StaticText, 0);

            e.textFormat = DrawTextFormat.VerticalCenter | DrawTextFormat.Right;

            // Title
            StaticText title = dialog.AddStatic((int)SettingsDialogControlIds.Static, "Direct3D Settings", 10, 5, 400, 50);

            e            = title[0];
            e.FontIndex  = 1;
            e.textFormat = DrawTextFormat.Top | DrawTextFormat.Left;

            // Adapter
            dialog.AddStatic((int)SettingsDialogControlIds.Static, "Display Adapter", 10, 50, 180, 23);
            adapterCombo = dialog.AddComboBox((int)SettingsDialogControlIds.Adapter, 200, 50, 300, 23);

            // Device Type
            dialog.AddStatic((int)SettingsDialogControlIds.Static, "Render Device", 10, 75, 180, 23);
            deviceCombo = dialog.AddComboBox((int)SettingsDialogControlIds.DeviceType, 200, 75, 300, 23);

            // Windowed / Fullscreen
            windowedButton = dialog.AddRadioButton((int)SettingsDialogControlIds.Windowed, (int)SettingsDialogControlIds.RadioButtonGroup,
                                                   "Windowed", 240, 105, 300, 16, false);
            clipBox = dialog.AddCheckBox((int)SettingsDialogControlIds.DeviceClip, "Clip to device when window spans across multiple monitors",
                                         250, 126, 400, 16, false);
            fullscreenButton = dialog.AddRadioButton((int)SettingsDialogControlIds.Fullscreen, (int)SettingsDialogControlIds.RadioButtonGroup, "Full Screen",
                                                     240, 147, 300, 16, false);

            // Adapter Format
            adapterFormatStatic = dialog.AddStatic((int)SettingsDialogControlIds.AdapterFormatLabel, "Adapter Format",
                                                   10, 180, 180, 23);
            adapterFormatCombo = dialog.AddComboBox((int)SettingsDialogControlIds.AdapterFormat, 200, 180, 300, 23);

            // Resolution
            resolutionStatic = dialog.AddStatic((int)SettingsDialogControlIds.ResolutionLabel, "Resolution", 10, 205, 180, 23);
            resolution       = dialog.AddComboBox((int)SettingsDialogControlIds.Resolution, 200, 205, 300, 23);
            resolution.SetDropHeight(106);

            // Refresh Rate
            refreshStatic = dialog.AddStatic((int)SettingsDialogControlIds.RefreshRateLabel, "Refresh Rate", 10, 230, 180, 23);
            refreshCombo  = dialog.AddComboBox((int)SettingsDialogControlIds.RefreshRate, 200, 230, 300, 23);

            // BackBuffer Format
            dialog.AddStatic((int)SettingsDialogControlIds.Static, "Back Buffer Format", 10, 265, 180, 23);
            backBufferCombo = dialog.AddComboBox((int)SettingsDialogControlIds.BackBufferFormat, 200, 265, 300, 23);

            // Depth Stencil
            dialog.AddStatic((int)SettingsDialogControlIds.Static, "Depth/Stencil Format", 10, 290, 180, 23);
            depthStencilCombo = dialog.AddComboBox((int)SettingsDialogControlIds.DepthStencil, 200, 290, 300, 23);

            // Multisample Type
            dialog.AddStatic((int)SettingsDialogControlIds.Static, "Multisample Type", 10, 315, 180, 23);
            multiSampleTypeCombo = dialog.AddComboBox((int)SettingsDialogControlIds.MultisampleType, 200, 315, 300, 23);

            // Multisample Quality
            dialog.AddStatic((int)SettingsDialogControlIds.Static, "Multisample Quality", 10, 340, 180, 23);
            multiSampleQualityCombo = dialog.AddComboBox((int)SettingsDialogControlIds.MultisampleQuality, 200, 340, 300, 23);

            // Vertex Processing
            dialog.AddStatic((int)SettingsDialogControlIds.Static, "Vertex Processing", 10, 365, 180, 23);
            vertexCombo = dialog.AddComboBox((int)SettingsDialogControlIds.VertexProcessing, 200, 365, 300, 23);

            // Present Interval
            dialog.AddStatic((int)SettingsDialogControlIds.Static, "Present Interval", 10, 390, 180, 23);
            presentCombo = dialog.AddComboBox((int)SettingsDialogControlIds.PresentInterval, 200, 390, 300, 23);

            // Add the ok/cancel buttons
            Button okButton     = dialog.AddButton((int)SettingsDialogControlIds.OK, "OK", 230, 435, 73, 31);
            Button cancelButton = dialog.AddButton((int)SettingsDialogControlIds.Cancel, "Cancel", 315, 435, 73, 31, 0, true);

            okButton.Click     += new EventHandler(OnOkClicked);
            cancelButton.Click += new EventHandler(OnCancelClicked);
        }
示例#8
0
        /// <summary>
        /// Initializes the application
        /// </summary>
        public void InitializeApplication()
        {
            int y = 10;
            // Initialize the HUD
            Button fullScreen   = hud.AddButton(ToggleFullscreen, "Toggle full screen", 35, y, 125, 22);
            Button toggleRef    = hud.AddButton(ToggleReference, "Toggle reference (F3)", 35, y += 24, 125, 22);
            Button changeDevice = hud.AddButton(ChangeDevice, "Change Device (F2)", 35, y += 24, 125, 22);

            // Hook the button events for when these items are clicked
            fullScreen.Click   += new EventHandler(OnFullscreenClicked);
            toggleRef.Click    += new EventHandler(OnRefClicked);
            changeDevice.Click += new EventHandler(OnChangeDevicClicked);

            // Update some fonts
            sampleUi.SetFont(1, "Comic Sans MS", 24, FontWeight.Normal);
            sampleUi.SetFont(2, "Courier New", 16, FontWeight.Normal);

            // Now add the sample specific UI
            y = 10;
            sampleUi.AddStatic(StaticControl, "This is a static control.", 0, 0, 200, 30);
            sampleUi.AddStatic(OutputStaticControl, "This static control provides feedback for your action.  It will change as you interact with the UI controls.",
                               20, 50, 620, 300);

            sampleUi.GetStaticText(OutputStaticControl)[0].FontColor.States[(int)ControlState.Normal] = new ColorValue(0.0f, 1.0f, 0.0f, 1.0f); // Change color to green
            sampleUi.GetStaticText(OutputStaticControl)[0].textFormat = DrawTextFormat.Left | DrawTextFormat.Top | DrawTextFormat.WordBreak;
            sampleUi.GetStaticText(OutputStaticControl)[0].FontIndex  = 1;

            // Edit box
            EditBox edit = sampleUi.AddEditBox(EditBoxControl, "Edit control with default styles.  Type text here and press Enter.",
                                               20, 440, 600, 32);

            // Slider
            Slider sl = sampleUi.AddSlider(SliderControl, 200, 450, 200, 24, 0, 1000, 500, false);

            // Check boxes
            Checkbox hotKey = sampleUi.AddCheckBox(CheckBoxControl, "This is a checkbox with hotkey.  Press 'C' to toggle the check state.",
                                                   150, 450, 350, 24, false, System.Windows.Forms.Keys.C, false);
            Checkbox clearEdit = sampleUi.AddCheckBox(ClearEditControl, "This checkbox controls whether the edit control text is cleared when Enter is pressed.",
                                                      150, 460, 430, 24, false);

            // Combo box
            ComboBox combo = sampleUi.AddComboBox(ComboBoxControl, 0, 0, 200, 24);

            if (combo != null)
            {
                // Add some items
                combo.SetDropHeight(100);
                combo.AddItem("Combo box item", 0x11111111);
                combo.AddItem("Placeholder", 0x12121212);
                combo.AddItem("One more", 0x13131313);
                combo.AddItem("I can't get enough", 0x14141414);
                combo.AddItem("Ok, last one, I promise", 0x15151515);
            }

            // Radio buttons
            sampleUi.AddRadioButton(RadioButton1A, 1, "Radio group 1 Amy", 0, 50, 200, 24, false);
            sampleUi.AddRadioButton(RadioButton1B, 1, "Radio group 1 Brian", 0, 50, 200, 24, false);
            sampleUi.AddRadioButton(RadioButton1C, 1, "Radio group 1 Clark", 0, 50, 200, 24, false);

            sampleUi.AddRadioButton(RadioButton2A, 2, "Single", 0, 50, 70, 24, false);
            sampleUi.AddRadioButton(RadioButton2B, 2, "Double", 0, 50, 70, 24, false);
            sampleUi.AddRadioButton(RadioButton2C, 2, "Trouble", 0, 50, 70, 24, false);

            // List boxes
            ListBox singleBox = sampleUi.AddListBox(ListBoxControl, 30, 400, 200, 150, ListBoxStyle.SingleSelection);

            for (int i = 0; i < 15; i++)
            {
                singleBox.AddItem("Single-selection listbox item " + i.ToString(), i);
            }

            ListBox multiBox = sampleUi.AddListBox(ListBoxControlMulti, 30, 400, 200, 150, ListBoxStyle.Multiselection);

            for (int i = 0; i < 30; i++)
            {
                multiBox.AddItem("Multi-selection listbox item " + i.ToString(), i);
            }

            // Hook some events
            sl.ValueChanged   += new EventHandler(OnValueChanged);
            hotKey.Changed    += new EventHandler(OnHotkeyBoxChanged);
            clearEdit.Changed += new EventHandler(OnClearEditChanged);
            combo.Changed     += new EventHandler(OnComboChanged);
            edit.Changed      += new EventHandler(OnEditChanged);
            edit.Enter        += new EventHandler(OnEnterHit);
            // All the radio buttons
            sampleUi.GetRadioButton(RadioButton1A).Changed += new EventHandler(OnRadioButtonChanged);
            sampleUi.GetRadioButton(RadioButton1B).Changed += new EventHandler(OnRadioButtonChanged);
            sampleUi.GetRadioButton(RadioButton1C).Changed += new EventHandler(OnRadioButtonChanged);
            sampleUi.GetRadioButton(RadioButton2A).Changed += new EventHandler(OnRadioButtonChanged);
            sampleUi.GetRadioButton(RadioButton2B).Changed += new EventHandler(OnRadioButtonChanged);
            sampleUi.GetRadioButton(RadioButton2C).Changed += new EventHandler(OnRadioButtonChanged);
            // Finally the listboxes
            singleBox.DoubleClick += new EventHandler(OnDoubleClick);
            singleBox.Selection   += new EventHandler(OnSingleSelection);
            multiBox.DoubleClick  += new EventHandler(OnDoubleClick);
            multiBox.Selection    += new EventHandler(OnMultiSelection);
        }
示例#9
0
        /// <summary>Initializes the application</summary>
        public void InitializeApplication()
        {
            lightControl = new DirectionWidget();
            lightControl.LightDirection = new Vector3((float)Math.Sin((float)Math.PI
                                                                      * 2 - (float)Math.PI / 6), 0, -(float)Math.Cos((float)Math.PI
                                                                                                                     * 2 - (float)Math.PI / 6));

            lightScale    = 1.0f;
            ambLightScale = 0.1f;

            int y = 10;
            // Initialize the dialogs
            Button fullScreen   = hud.AddButton(ToggleFullscreen, "Toggle full screen", 35, y, 125, 22);
            Button changeDevice = hud.AddButton(ChangeDevice, "Change Device (F2)", 35, y += 24, 125, 22);

            // Hook the button events for when these items are clicked
            fullScreen.Click   += new EventHandler(OnFullscreenClicked);
            changeDevice.Click += new EventHandler(OnChangeDevicClicked);

            // Now add the sample specific UI
            y = 10;

            //lighting
            sampleUi.AddStatic(LightScaleStatic, string.Format("Light scale: {0}", lightScale.ToString("f2",
                                                                                                       System.Globalization.CultureInfo.CurrentUICulture)), 35, y += 24, 125, 22);
            Slider scaleSlider = sampleUi.AddSlider(LightScaleControl, 50, y += 24, 100, 22, 0, 20, (int)(lightScale * 10.0f), false);
            Button lightButton = sampleUi.AddButton(LightColorPicker, "Change light colour", 35, y += 24, 125, 22);

            sampleUi.AddStatic(AmbLightScaleStatic, string.Format("Ambient light scale: {0}", ambLightScale.ToString("f2",
                                                                                                                     System.Globalization.CultureInfo.CurrentUICulture)), 35, y += 24, 125, 22);
            Slider ambScaleSlider = sampleUi.AddSlider(AmbLightScaleControl, 50, y += 24, 100, 22, 0, 20, (int)(ambLightScale * 10.0f), false);
            Button ambLightButton = sampleUi.AddButton(AmbLightColorPicker, "Change ambient colour", 35, y += 24, 125, 22);

            y += 19;
            ComboBox shaderPicker = sampleUi.AddComboBox(ChangeShader, 35, y += 24, 125, 22);

            shaderPicker.AddItem("Standard", null);
            shaderPicker.AddItem("Color map", "ColorMap");
            shaderPicker.AddItem("Alpha/height map", "HeightMap");
            shaderPicker.AddItem("Normal map", "NormalMap");
            shaderPicker.AddItem("Specular map", "SpecularMap");
            shaderPicker.AddItem("Glow map", "GlowMap");
            shaderPicker.AddItem("Ambient material", "AmbMat");
            shaderPicker.AddItem("Diffuse material", "DifMat");
            shaderPicker.AddItem("Specular material", "SpecMat");
            shaderPicker.AddItem("Emissive material", "GlowMat");
            shaderPicker.AddItem("Vertex position", "vPosition");
            shaderPicker.AddItem("Vertex normals", "vNormal");
            shaderPicker.AddItem("Vertex colours", "vColor");
            shaderPicker.AddItem("Texture coords", "vUV");
            shaderPicker.AddItem("Vertex tangents", "vTangent");
            shaderPicker.AddItem("Vertex binormals", "vBinormal");
            Checkbox wireframeCheckbox = sampleUi.AddCheckBox(WireFrame, "Wireframe", 35, y += 24, 125, 22, false);
            Checkbox cullCheckBox      = sampleUi.AddCheckBox(ToggleCulling, "Backface culling", 35, y += 24, 125, 22, true);

            y += 19;
            ComboBox subsetControl = sampleUi.AddComboBox(SubsetControl, 35, y += 24, 125, 22);

            y += 19;
            Button loadButton = sampleUi.AddButton(LoadMeshButton, "Load mesh", 35, y += 24, 125, 22);

            // Hook the events
            scaleSlider.ValueChanged    += new EventHandler(OnLightScaleChanged);
            lightButton.Click           += new EventHandler(lightButton_Click);
            ambScaleSlider.ValueChanged += new EventHandler(ambScaleSlider_ValueChanged);
            ambLightButton.Click        += new EventHandler(ambLightButton_Click);
            shaderPicker.Changed        += new EventHandler(shaderPicker_Changed);
            wireframeCheckbox.Changed   += new EventHandler(wireframeCheckbox_Changed);
            subsetControl.Changed       += new EventHandler(subsetControl_Changed);
            loadButton.Click            += new EventHandler(loadButton_Click);
            cullCheckBox.Changed        += new EventHandler(cullCheckBox_Changed);
        }