当前位置: 首页>>代码示例>>C#>>正文


C# Input.Bind方法代码示例

本文整理汇总了C#中Input.Bind方法的典型用法代码示例。如果您正苦于以下问题:C# Input.Bind方法的具体用法?C# Input.Bind怎么用?C# Input.Bind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Input的用法示例。


在下文中一共展示了Input.Bind方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnLoad

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            try
            {
                Gorgon.Initialize(true, false);

                VideoMode videoMode;
                bool fullScreen;

                using (Configuration configuration = new Configuration())
                {
                    configuration.FillResolutionList();
                    configuration.ShowDialog(this);
                    if (configuration.DialogResult != DialogResult.OK)
                    {
                        Close();
                        return;
                    }
                    videoMode = configuration.VideoMode;
                    fullScreen = configuration.FullScreen;
                }

                Gorgon.SetMode(this, videoMode.Width, videoMode.Height, BackBufferFormats.BufferRGB888, !fullScreen);

                Gorgon.Idle += Gorgon_Idle;

                //Gorgon.FrameStatsVisible = true;

                _input = Input.LoadInputPlugIn(Environment.CurrentDirectory + @"\GorgonInput.DLL", "Gorgon.RawInput");
                _input.Bind(this);

                _keyboard = _input.Keyboard;
                _keyboard.Enabled = true;
                _keyboard.Exclusive = true;
                _keyboard.KeyDown += KeyboardOnKeyDown;

                _gameMain = new GameMain();

                string reason;
                if (!_gameMain.Initialize(Gorgon.Screen.Width, Gorgon.Screen.Height, this, out reason))
                {
                    MessageBox.Show(string.Format("Error loading game resources, error message: {0}", reason));
                    Close();
                    return;
                }

                Gorgon.Go();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
                Close();
            }
        }
开发者ID:Zeraan,项目名称:Xasteroids,代码行数:56,代码来源:Xasteroids.cs

示例2: SetupInput

        private void SetupInput()
        {
            var inputPath = Path.Combine(Environment.CurrentDirectory,"GorgonInput.dll");
            _input = Input.LoadInputPlugIn(inputPath, "Gorgon.RawInput");
            _input.Bind(this);

            Cursor.Hide();

            ResizeEnd += MainWindowResizeEnd;

            _input.Mouse.Enabled = true;
            _input.Mouse.Exclusive = false;
            _input.Mouse.AllowBackground = false;
            _input.Mouse.MouseDown += MouseDownEvent;
            _input.Mouse.MouseUp += MouseUpEvent;
            _input.Mouse.MouseMove += MouseMoveEvent;
            _input.Mouse.MouseWheelMove += MouseWheelMoveEvent;

            _input.Keyboard.Enabled = true;
            _input.Keyboard.Exclusive = true;
            _input.Keyboard.KeyDown += KeyDownEvent;
            _input.Keyboard.KeyUp += KeyUpEvent;
            IoCManager.Resolve<IKeyBindingManager>().Initialize(_input.Keyboard);

            _input.Mouse.SetPositionRange(0, 0, Gorgon.CurrentClippingViewport.Width,
                                          Gorgon.CurrentClippingViewport.Height);
        }
开发者ID:Gartley,项目名称:ss13remake,代码行数:27,代码来源:MainWindow.cs

示例3: OnLoad

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            try
            {
                List<DirectoryInfo> dataSets = new List<DirectoryInfo>();
                try
                {
                    //Check to see if there's data in program directory that's not copied to general application data folder
                    DirectoryInfo di = new DirectoryInfo(Path.Combine(Application.StartupPath, "Data"));
                    DirectoryInfo target = new DirectoryInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Beyond Beyaan"));
                    if (!target.Exists)
                    {
                        target.Create();
                    }
                    foreach (var directory in di.GetDirectories())
                    {
                        CopyOrUpdateDirectory(directory, new DirectoryInfo(Path.Combine(target.FullName, directory.Name)));
                    }
                    //Get list of available datasets from general application data folder
                    foreach (var directory in target.GetDirectories())
                    {
                        //Sanity check to ensure that it's a valid dataset
                        dataSets.Add(directory);
                    }
                }
                catch (Exception exception)
                {
                    MessageBox.Show(string.Format("Failed to copy directories.  Error: {0}", exception.Message));
                    Close();
                    return;
                }
                if (dataSets.Count == 0)
                {
                    MessageBox.Show(Resources.BeyondBeyaan_OnLoad_There_are_no_available_datasets_to_choose_from___Ensure_that_the_program_is_installed_correctly_);
                    Close();
                    return;
                }

                dataSets.Sort((a, b) => String.Compare(a.Name, b.Name, StringComparison.CurrentCultureIgnoreCase));

                Gorgon.Initialize(true, false);

                VideoMode videoMode;
                DirectoryInfo dataset;
                bool fullScreen;
                bool showTutorial;

                using (Configuration configuration = new Configuration())
                {
                    configuration.FillResolutionList();
                    configuration.FillDatasetList(dataSets);
                    configuration.ShowDialog(this);
                    if (configuration.DialogResult != DialogResult.OK)
                    {
                        Close();
                        return;
                    }
                    videoMode = configuration.VideoMode;
                    fullScreen = configuration.FullScreen;
                    dataset = dataSets[configuration.DataSetIndex];
                    showTutorial = configuration.ShowTutorial;
                }

                Gorgon.SetMode(this, videoMode.Width, videoMode.Height, BackBufferFormats.BufferRGB888, !fullScreen);

                Gorgon.Idle += new FrameEventHandler(Gorgon_Idle);
                Gorgon.FastResize = false;

                //Gorgon.FrameStatsVisible = true;

                input = Input.LoadInputPlugIn(Environment.CurrentDirectory + @"\GorgonInput.DLL", "Gorgon.RawInput");
                input.Bind(this);

                keyboard = input.Keyboard;
                keyboard.Enabled = true;
                keyboard.Exclusive = false;
                keyboard.KeyDown += keyboard_KeyDown;

                string reason;
                FileInfo fileInfo = new FileInfo(Path.Combine(dataset.FullName, "configuration.xml"));
                if (!GameConfiguration.Initialize(fileInfo, out reason))
                {
                    MessageBox.Show(string.Format("Error loading configuration, reason: {0}", reason));
                    Close();
                    return;
                }

                gameMain = new GameMain();

                if (!gameMain.Initalize(Gorgon.Screen.Width, Gorgon.Screen.Height, dataset, showTutorial, this, out reason))
                {
                    MessageBox.Show(string.Format("Error loading game resources, error message: {0}", reason));
                    Close();
                    return;
                }

                Gorgon.Go();
            }
//.........这里部分代码省略.........
开发者ID:Beyonders,项目名称:Beyond-Beyaan,代码行数:101,代码来源:BeyondBeyaan.cs


注:本文中的Input.Bind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。