1
0
forked from s425077/PotatoPlan
JoelForkTest/Game1/Sources/Controlls/Input.cs

73 lines
1.5 KiB
C#
Raw Permalink Normal View History

2020-05-03 13:05:05 +02:00
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Graphics;
class Input
{
private KeyboardState state = Keyboard.GetState();
private GraphicsDeviceManager graphics;
private Vector2 Size;
private int tileSize;
private int Spacing;
private Controller controller = new Controller();
public void init(GraphicsDeviceManager Graphics, Vector2 size, int TileSize, int SPacing)
{
graphics = Graphics;
tileSize = TileSize;
Spacing = SPacing;
Size = size;
controller.init(Graphics);
}
public int changeSpeed(int Speed)
{
return controller.controllSpeed(Speed);
}
public tractorPositionCorrector changeTractorSpeed(float tractorSpeed, Vector2 Position)
{
return controller.controllTractorSpeed(tractorSpeed, Position);
}
private void changeSize()
{
Size = controller.updateWindow(tileSize, Spacing, Size);
}
public void controlWindowSize()
{
tileSize = controller.controllTileSize(Size, tileSize);
changeSize();
graphics.ApplyChanges();
}
public int getTileSize()
{
return tileSize;
}
public int getSpacing()
{
return Spacing;
}
public Vector2 getSize()
{
return Size;
}
public int getSpacingTile()
{
return Spacing + tileSize;
}
public void setTileSize(int newTileSize)
{
tileSize = newTileSize;
}
}