Пример #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true);
            Direct3D d3d = new Direct3D();

            d3ddevice = new Device(d3d, 0, DeviceType.Hardware, panel1.Handle, CreateFlags.HardwareVertexProcessing,
                                   new PresentParameters
            {
                Windowed               = true,
                SwapEffect             = SwapEffect.Discard,
                EnableAutoDepthStencil = true,
                AutoDepthStencilFormat = Format.D24X8
            });

            EditorOptions.Initialize(d3ddevice);
            EditorOptions.OverrideLighting   = true;
            EditorOptions.RenderDrawDistance = 10000;
            optionsEditor              = new EditorOptionsEditor(cam);
            optionsEditor.FormUpdated += optionsEditor_FormUpdated;
            optionsEditor.CustomizeKeybindsCommand    += CustomizeControls;
            optionsEditor.ResetDefaultKeybindsCommand += () =>
            {
                actionList.ActionKeyMappings.Clear();

                foreach (ActionKeyMapping keymapping in DefaultActionList.DefaultActionMapping)
                {
                    actionList.ActionKeyMappings.Add(keymapping);
                }

                actionInputCollector.SetActions(actionList.ActionKeyMappings.ToArray());
            };

            actionList = ActionMappingList.Load(Path.Combine(Application.StartupPath, "keybinds.ini"),
                                                DefaultActionList.DefaultActionMapping);

            actionInputCollector = new ActionInputCollector();
            actionInputCollector.SetActions(actionList.ActionKeyMappings.ToArray());
            actionInputCollector.OnActionStart   += ActionInputCollector_OnActionStart;
            actionInputCollector.OnActionRelease += ActionInputCollector_OnActionRelease;

            cammodel = new ModelFile(Properties.Resources.camera).Model;
            cammodel.Attach.ProcessVertexData();
            cammesh = cammodel.Attach.CreateD3DMesh();

            if (Program.Arguments.Length > 0)
            {
                LoadFile(Program.Arguments[0]);
            }
        }
Пример #2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true);
            Direct3D d3d = new Direct3D();

            d3ddevice = new Device(d3d, 0, DeviceType.Hardware, panel1.Handle, CreateFlags.HardwareVertexProcessing,
                                   new PresentParameters
            {
                Windowed               = true,
                SwapEffect             = SwapEffect.Discard,
                EnableAutoDepthStencil = true,
                AutoDepthStencilFormat = Format.D24X8
            });

            settingsfile = SettingsFile.Load();

            EditorOptions.Initialize(d3ddevice);
            EditorOptions.OverrideLighting   = true;
            EditorOptions.RenderDrawDistance = cam.DrawDistance = settingsfile.SA2EventViewer.DrawDistance_General;
            cam.ModifierKey = settingsfile.SA2EventViewer.CameraModifier;
            actionList      = ActionMappingList.Load(Path.Combine(Application.StartupPath, "keybinds", "SA2EventViewer.ini"),
                                                     DefaultActionList.DefaultActionMapping);

            actionInputCollector = new ActionInputCollector();
            actionInputCollector.SetActions(actionList.ActionKeyMappings.ToArray());
            actionInputCollector.OnActionStart   += ActionInputCollector_OnActionStart;
            actionInputCollector.OnActionRelease += ActionInputCollector_OnActionRelease;

            optionsEditor                  = new EditorOptionsEditor(cam, actionList.ActionKeyMappings.ToArray(), DefaultActionList.DefaultActionMapping, false, false);
            optionsEditor.FormUpdated     += optionsEditor_FormUpdated;
            optionsEditor.FormUpdatedKeys += optionsEditor_FormUpdatedKeys;

            cammodel = new ModelFile(Properties.Resources.camera).Model;
            cammodel.Attach.ProcessVertexData();
            cammesh = cammodel.Attach.CreateD3DMesh();

            if (Program.Arguments.Length > 0)
            {
                LoadFile(Program.Arguments[0]);
            }
        }