本文整理汇总了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();
}
}
示例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);
}
示例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();
}
//.........这里部分代码省略.........