コード例 #1
0
ファイル: Form1.cs プロジェクト: nian0601/Spaceshooter
        public ModelViewerWindow()
        {
            InitializeComponent();

            if (myDataFolderPath == "")
            {
                Properties.Settings.Default.DefaultDataFolderPath = Directory.GetCurrentDirectory();
                myDataFolderPath = Properties.Settings.Default.DefaultDataFolderPath;
                Properties.Settings.Default.Save();
            }

            DataFolderBrowser.SelectedPath = myDataFolderPath;

            myPreviousMousePosition = MousePosition;

            myChooseDataFolderButton.Text = "Open";
            myChooseDataFolderButton.Location = new Point(Location.X + 5, Location.Y+10);
            myChooseDataFolderButton.Size = new Size(50, 20);
            myChooseDataFolderButton.Show();
            myChooseDataFolderButton.Click += new EventHandler(this.Btn_OpenDataFolder_Click);
            Menu_Panel.Controls.Add(myChooseDataFolderButton);

            myModelList = new CSharpUtilities.Components.DropDownComponent(new Point(Location.X + 60, Location.Y+10), new Size(250, 13), "Model: ");
            myModelList.AddSelectedIndexChangeEvent(this.ModelList_SelectedIndexChanged);
            myModelList.BindToPanel(Menu_Panel);
            myModelList.Show();

            myShaderList = new CSharpUtilities.Components.DropDownComponent(new Point(Location.X + 310, Location.Y+10), new Size(250, 13), "Shader: ");
            myShaderList.AddSelectedIndexChangeEvent(this.ShaderList_SelectedIndexChanged);
            myShaderList.BindToPanel(Menu_Panel);
            myShaderList.Show();

            myCubeMapList = new CSharpUtilities.Components.DropDownComponent(new Point(Location.X + 560, Location.Y + 10), new Size(250, 13), "Cube Map: ");
            myCubeMapList.AddSelectedIndexChangeEvent(this.CubeMapList_SelectedIndexChanged);
            myCubeMapList.BindToPanel(Menu_Panel);
            myCubeMapList.Show();

            myPreviewWindow = new CSharpUtilities.Components.DLLPreviewComponent(new Point(ModelViewer.Location.X, ModelViewer.Location.Y - 20), ModelViewer.Size, "Preview", true);
            myPreviewWindow.BindToPanel(ModelViewer);
            myPreviewWindow.Show();

            myDirectionalLightRotation = new CSharpUtilities.Components.Vector3SliderComponent(new Point(0, 0), new Size(200, 50), "Directional Light Rotation", -360, 360, 180, true);
            myDirectionalLightRotation.AddSelectedValueChangedEvent(this.DirectionalLight_Scroll);
            myDirectionalLightRotation.BindToPanel(ModelViewerMenu);
            myDirectionalLightRotation.Show();

            myDirectionalLightRotation.SetXValue(CSharpUtilities.DLLImporter.NativeMethods.GetDirectionaLightXRotation());
            myDirectionalLightRotation.SetYValue(CSharpUtilities.DLLImporter.NativeMethods.GetDirectionaLightYRotation());
            myDirectionalLightRotation.SetZValue(CSharpUtilities.DLLImporter.NativeMethods.GetDirectionaLightZRotation());

            myObjectManualRotation = new CSharpUtilities.Components.Vector3SliderComponent(new Point(0, 60), new Size(200, 50), "Object Manual Rotation", -180, 180, 0, false);
            myObjectManualRotation.AddSelectedXValueChangedEvent(this.ManualObjectXRotation_Scroll);
            myObjectManualRotation.AddSelectedYValueChangedEvent(this.ManualObjectYRotation_Scroll);
            myObjectManualRotation.AddSelectedZValueChangedEvent(this.ManualObjectZRotation_Scroll);
            myObjectManualRotation.BindToPanel(ModelViewerMenu);
            myObjectManualRotation.Hide();

            myObjectAutoRotation = new CSharpUtilities.Components.Vector3SliderComponent(new Point(0, 60), new Size(200, 50), "Object Auto Rotation", -360, 360, 0, true);
            myObjectAutoRotation.AddSelectedValueChangedEvent(this.AutoRotation_Scroll);
            myObjectAutoRotation.BindToPanel(ModelViewerMenu);
            myObjectAutoRotation.Show();

            myEnableAutoRotation.Text = "Activate Auto Rotation";
            myEnableAutoRotation.CheckedChanged += new EventHandler(this.EnableAutoRotation_CheckStateChanged);
            myEnableAutoRotation.Location = new Point(10, 120);
            myEnableAutoRotation.Size = new Size(200, 20);
            myEnableAutoRotation.Checked = true;
            myEnableAutoRotation.Show();
            ModelViewerMenu.Controls.Add(myEnableAutoRotation);

            myMouseSensitivitySlider = new CSharpUtilities.Components.SliderComponent(new Point(0, 150), new Size(200, 15), "Mouse Sens", 0, 1000, 1, true, 0.0f, 100.0f);
            myMouseSensitivitySlider.AddSelectedValueChangedEvent(this.MouseSensitivity_Changed);
            myMouseSensitivitySlider.SetValue(Properties.Settings.Default.DefaultSettingMouseSensitivity);
            myMouseSensitivitySlider.BindToPanel(ModelViewerMenu);
            myMouseSensitivitySlider.Show();

            myCameraSettingsSliders = new CSharpUtilities.Components.Vector3SliderComponent(new Point(0, 175), new Size(200, 50), "Camera Settings", -1000, 1000, 0, true, "Zoom: ", "Movement: ", "Rotation: ", -10.0f, 10.0f);
            myCameraSettingsSliders.SetXValue(Properties.Settings.Default.DefaultSettingCameraZoom);
            myCameraSettingsSliders.SetYValue(Properties.Settings.Default.DefaultSettingCameraMovement);
            myCameraSettingsSliders.AddSelectedValueChangedEvent(this.CameraSettings_Changed);
            myCameraSettingsSliders.SetZValue(Properties.Settings.Default.DefaultSettingCameraRotation);
            myCameraSettingsSliders.BindToPanel(ModelViewerMenu);
            myCameraSettingsSliders.Show();

            FillModelList();
            FillShaderList();
            FillCubeMapList();

            UpdateTimer.Start();
        }
コード例 #2
0
        public ModelViewerWindow()
        {
            InitializeComponent();

            if (myDataFolderPath == "")
            {
                Properties.Settings.Default.DefaultDataFolderPath = Directory.GetCurrentDirectory();
                myDataFolderPath = Properties.Settings.Default.DefaultDataFolderPath;
                Properties.Settings.Default.Save();
            }

            DataFolderBrowser.SelectedPath = myDataFolderPath;

            myPreviousMousePosition = MousePosition;

            myChooseDataFolderButton.Text     = "Open";
            myChooseDataFolderButton.Location = new Point(Location.X + 5, Location.Y + 10);
            myChooseDataFolderButton.Size     = new Size(50, 20);
            myChooseDataFolderButton.Show();
            myChooseDataFolderButton.Click += new EventHandler(this.Btn_OpenDataFolder_Click);
            Menu_Panel.Controls.Add(myChooseDataFolderButton);

            myModelList = new CSharpUtilities.Components.DropDownComponent(new Point(Location.X + 60, Location.Y + 10), new Size(250, 13), "Model: ");
            myModelList.AddSelectedIndexChangeEvent(this.ModelList_SelectedIndexChanged);
            myModelList.BindToPanel(Menu_Panel);
            myModelList.Show();

            myShaderList = new CSharpUtilities.Components.DropDownComponent(new Point(Location.X + 310, Location.Y + 10), new Size(250, 13), "Shader: ");
            myShaderList.AddSelectedIndexChangeEvent(this.ShaderList_SelectedIndexChanged);
            myShaderList.BindToPanel(Menu_Panel);
            myShaderList.Show();

            myCubeMapList = new CSharpUtilities.Components.DropDownComponent(new Point(Location.X + 560, Location.Y + 10), new Size(250, 13), "Cube Map: ");
            myCubeMapList.AddSelectedIndexChangeEvent(this.CubeMapList_SelectedIndexChanged);
            myCubeMapList.BindToPanel(Menu_Panel);
            myCubeMapList.Show();

            myPreviewWindow = new CSharpUtilities.Components.DLLPreviewComponent(new Point(ModelViewer.Location.X, ModelViewer.Location.Y - 20), ModelViewer.Size, "Preview", true);
            myPreviewWindow.BindToPanel(ModelViewer);
            myPreviewWindow.Show();

            myDirectionalLightRotation = new CSharpUtilities.Components.Vector3SliderComponent(new Point(0, 0), new Size(200, 50), "Directional Light Rotation", -360, 360, 180, true);
            myDirectionalLightRotation.AddSelectedValueChangedEvent(this.DirectionalLight_Scroll);
            myDirectionalLightRotation.BindToPanel(ModelViewerMenu);
            myDirectionalLightRotation.Show();

            myDirectionalLightRotation.SetXValue(CSharpUtilities.DLLImporter.NativeMethods.GetDirectionaLightXRotation());
            myDirectionalLightRotation.SetYValue(CSharpUtilities.DLLImporter.NativeMethods.GetDirectionaLightYRotation());
            myDirectionalLightRotation.SetZValue(CSharpUtilities.DLLImporter.NativeMethods.GetDirectionaLightZRotation());

            myObjectManualRotation = new CSharpUtilities.Components.Vector3SliderComponent(new Point(0, 60), new Size(200, 50), "Object Manual Rotation", -180, 180, 0, false);
            myObjectManualRotation.AddSelectedXValueChangedEvent(this.ManualObjectXRotation_Scroll);
            myObjectManualRotation.AddSelectedYValueChangedEvent(this.ManualObjectYRotation_Scroll);
            myObjectManualRotation.AddSelectedZValueChangedEvent(this.ManualObjectZRotation_Scroll);
            myObjectManualRotation.BindToPanel(ModelViewerMenu);
            myObjectManualRotation.Hide();

            myObjectAutoRotation = new CSharpUtilities.Components.Vector3SliderComponent(new Point(0, 60), new Size(200, 50), "Object Auto Rotation", -360, 360, 0, true);
            myObjectAutoRotation.AddSelectedValueChangedEvent(this.AutoRotation_Scroll);
            myObjectAutoRotation.BindToPanel(ModelViewerMenu);
            myObjectAutoRotation.Show();

            myEnableAutoRotation.Text            = "Activate Auto Rotation";
            myEnableAutoRotation.CheckedChanged += new EventHandler(this.EnableAutoRotation_CheckStateChanged);
            myEnableAutoRotation.Location        = new Point(10, 120);
            myEnableAutoRotation.Size            = new Size(200, 20);
            myEnableAutoRotation.Checked         = true;
            myEnableAutoRotation.Show();
            ModelViewerMenu.Controls.Add(myEnableAutoRotation);

            myMouseSensitivitySlider = new CSharpUtilities.Components.SliderComponent(new Point(0, 150), new Size(200, 15), "Mouse Sens", 0, 1000, 1, true, 0.0f, 100.0f);
            myMouseSensitivitySlider.AddSelectedValueChangedEvent(this.MouseSensitivity_Changed);
            myMouseSensitivitySlider.SetValue(Properties.Settings.Default.DefaultSettingMouseSensitivity);
            myMouseSensitivitySlider.BindToPanel(ModelViewerMenu);
            myMouseSensitivitySlider.Show();

            myCameraSettingsSliders = new CSharpUtilities.Components.Vector3SliderComponent(new Point(0, 175), new Size(200, 50), "Camera Settings", -1000, 1000, 0, true, "Zoom: ", "Movement: ", "Rotation: ", -10.0f, 10.0f);
            myCameraSettingsSliders.SetXValue(Properties.Settings.Default.DefaultSettingCameraZoom);
            myCameraSettingsSliders.SetYValue(Properties.Settings.Default.DefaultSettingCameraMovement);
            myCameraSettingsSliders.AddSelectedValueChangedEvent(this.CameraSettings_Changed);
            myCameraSettingsSliders.SetZValue(Properties.Settings.Default.DefaultSettingCameraRotation);
            myCameraSettingsSliders.BindToPanel(ModelViewerMenu);
            myCameraSettingsSliders.Show();

            FillModelList();
            FillShaderList();
            FillCubeMapList();

            UpdateTimer.Start();
        }