本文整理汇总了C#中Input类的典型用法代码示例。如果您正苦于以下问题:C# Input类的具体用法?C# Input怎么用?C# Input使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Input类属于命名空间,在下文中一共展示了Input类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
protected override void Update(TimeSpan gameTime)
{
input = WaveServices.Input;
if (input.KeyboardState.IsConnected)
{
keyboardState = input.KeyboardState;
if (keyboardState.W == ButtonState.Pressed)
{
MoveCamera(ref forward);
}
if (keyboardState.S == ButtonState.Pressed)
{
MoveCamera(ref back);
}
if (keyboardState.A == ButtonState.Pressed)
{
MoveCamera(ref left);
}
if (keyboardState.D == ButtonState.Pressed)
{
MoveCamera(ref right);
}
}
var rotationMatrix = (Matrix.CreateRotationX(MathHelper.ToRadians(45.0f)) * Matrix.CreateRotationY(MathHelper.ToRadians(30.0f)));
Vector3 transformedReference = Vector3.Transform(Vector3.Down, rotationMatrix);
Vector3 cameraLookat = Camera.Position + transformedReference;
var width = WaveServices.Platform.ScreenWidth / 24;
var height = WaveServices.Platform.ScreenHeight / 24;
//camera.Projection = Matrix.CreateOrthographic(width, height, camera.NearPlane, camera.FarPlane);
Camera.LookAt = cameraLookat;
}
示例2: Paddle
public Paddle(ContentManager theContent, string theAssetName, Input theInput, PaddlePosition thePosition)
: base(theContent, theAssetName)
{
SourceRectangle = new Rectangle(0, 0, 1, 1);
Scale = new Vector2(10.0f, 100.0f);
mColor = Color.SlateBlue;
mPaddlePosition = thePosition;
switch (thePosition)
{
case PaddlePosition.Left:
{
Boundary = new Rectangle(140, 185, 10, 833);
break;
}
case PaddlePosition.Right:
{
Boundary = new Rectangle(1130, 185, 10, 833);
break;
}
}
Position = Center(Boundary);
mInput = theInput;
}
示例3: HandleInput
public override void HandleInput(Input input)
{
if (input.IsKeyDown(Keys.Q))
{
move(8);
}
}
示例4: SimulateMouseMove
/// <summary>
/// Performs mouse move
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
public void SimulateMouseMove(int x, int y)
{
Input[] MouseEvent = new Input[1];
MouseEvent[0].Type = 0;
MouseEvent[0].Data = CreateMouseInput(x, y, 0, 0, MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE);
SendInput((uint)MouseEvent.Length, MouseEvent, Marshal.SizeOf(MouseEvent[0].GetType()));
}
示例5: Handle
void Handle(Input.Buy input)
{
var order = new Billing.Order();
order.Offer = (Billing.Offer)this.Data;
order.DateTime = DateTime.Now;
Transaction.Commit();
}
示例6: WeatherReport
public WeatherReport(Input userInput, MeteoData meteoData)
{
this.userInput = userInput;
this.meteoData = meteoData;
this.meteoData.addObserver(this);
showWeatherReport();
}
示例7: OnProcessInput
// OnProcessInput
protected override void OnProcessInput(Input input)
{
if (input.ButtonJustPressed((int)E_UiButton.A)) {
if (Menu.GetByValue() == 0) {
NugettaHandler connection = MyNugettaHandler.getInstance();
connection.FindGames((GetGamesResponse response) => {
List<NGame> list = response.getGames();
_UI.Screen.AddScreen(new JoinGame(list));
});
//_UI.Screen.AddScreen(new Screen_Popup(E_PopupType.NewGame));
}
else
if (Menu.GetByValue() == 1) {
_UI.Screen.SetNextScreen(null);
}
else
if (Menu.GetByValue() == 2) {
_UI.Screen.SetNextScreen(new Screen_Options());
}
else
if (Menu.GetByValue() == 3) {
_UI.Screen.AddScreen(new Screen_Popup(E_PopupType.Quit));
}
}
else
if (input.ButtonJustPressed((int)E_UiButton.B)) {
SetScreenTimers(0.0f, 0.5f);
_G.UI.SS_FromMainMenu = true;
_UI.Screen.SetNextScreen(new Screen_Start());
}
}
示例8: OnInputChange
public override void OnInputChange(Input input)
{
var r = (int) double.Parse(Inputs[0].Value);
var g = (int) double.Parse(Inputs[1].Value);
var b = (int) double.Parse(Inputs[2].Value);
if (r < 0 || r > 255)
{
LogIncorrectInputValueError(Inputs[0]);
ResetOutputs();
return;
}
if (g < 0 || g > 255)
{
LogIncorrectInputValueError(Inputs[1]);
ResetOutputs();
return;
}
if (b < 0 || b > 255)
{
LogIncorrectInputValueError(Inputs[2]);
ResetOutputs();
return;
}
var result = r.ToString("X2")
+ g.ToString("X2")
+ b.ToString("X2");
Outputs[0].Value = result;
}
示例9: OnMouseLeftButtonUp
protected override void OnMouseLeftButtonUp(Input.MouseButtonEventArgs e)
{
base.OnMouseLeftButtonUp(e);
startTracking = false;
Mouse.Capture(this, CaptureMode.None);
}
示例10: Initialize
protected override void Initialize()
{
input = new Input();
// State
input.AddKeyBinding("quit", Keys.Escape);
// Camera
input.AddKeyBinding("zoom_out", Keys.Q);
input.AddKeyBinding("zoom_in", Keys.E);
input.AddKeyBinding("pan_up", Keys.W);
input.AddKeyBinding("pan_down", Keys.S);
input.AddKeyBinding("pan_left", Keys.A);
input.AddKeyBinding("pan_right", Keys.D);
// ColorMaps
input.AddKeyBinding("toggle_coloring", Keys.Tab);
input.AddKeyBinding("cycle_map", Keys.Tab, Modifier.Shift);
input.AddKeyBinding("generate_random_map", Keys.Space);
// Pen
input.AddKeyBinding("pen_add", MouseButton.Left);
input.AddKeyBinding("pen_sub", MouseButton.Right);
input.AddKeyBinding("pen_size_inc", Keys.Up);
input.AddKeyBinding("pen_size_dec", Keys.Down);
input.AddKeyBinding("pen_pressure_inc", Keys.Right);
input.AddKeyBinding("pen_pressure_dec", Keys.Left);
//Map Size
input.AddKeyBinding("map_size_inc", Keys.OemCloseBrackets);
input.AddKeyBinding("map_size_dec", Keys.OemOpenBrackets);
base.Initialize();
}
示例11: Update
public override void Update(GameTime gameTime, Input input)
{
time += (float)gameTime.ElapsedGameTime.TotalMilliseconds;
//Input handling doorgeven aan PlayingGrid
if (input.KeyDown(Keys.Left))
grid.MoveTetrominoLeft();
if (input.KeyDown(Keys.Right))
grid.MoveTetrominoRight();
if (input.KeyDown(Keys.Up))
grid.RotateTetromino();
if (input.KeyDown(Keys.Down))
updateTime /= 10;
else if (input.KeyUp(Keys.Down))
updateTime *= 10;
//Als genoeg tijd verstreken is, wordt de PlayingGrid geupdated
if (time >= updateTime)
{
grid.Update(input);
time = 0;
}
if (input.KeyDown(Keys.Escape))
TetrisGame.currentState = new PauseState(this);
}
示例12: OnProcessInput
// OnProcessInput
protected override void OnProcessInput(Input input)
{
if (LeftBar.ChildrenWidget.Count > 0)
{
if (input.ButtonJustPressed((int)E_UiButton.Down))
{
LeftBar.IncreaseCurrent();
}
else if (input.ButtonJustPressed((int)E_UiButton.Up))
{
LeftBar.DecreaseCurrent();
}
}
if (RightBar.ChildrenWidget.Count > 0)
{
if (input.ButtonJustPressed((int)E_UiButton.Back))
{
RightBar.DecreaseCurrent();
}
else if (input.ButtonJustPressed((int)E_UiButton.Enter))
{
RightBar.IncreaseCurrent();
}
}
}
示例13: GetDigitalState
protected static Int32 GetDigitalState(Input.InputFrame inputFrame, DigitalControlIdentifier identifier)
{
return
inputFrame.DigitalControlStates.ContainsKey (identifier)
? inputFrame.DigitalControlStates [identifier]
: 0;
}
示例14: GetButtonState
protected static ButtonState GetButtonState(Input.InputFrame inputFrame, BinaryControlIdentifier identifier)
{
return
inputFrame.BinaryControlStates.Contains (identifier)
? ButtonState.Pressed
: ButtonState.Released;
}
示例15: GetAnalogState
protected static Single GetAnalogState(Input.InputFrame inputFrame, AnalogControlIdentifier identifier)
{
return
inputFrame.AnalogControlStates.ContainsKey (identifier)
? inputFrame.AnalogControlStates [identifier]
: 0.0f;
}