testing mouselook stuff

pull/1/head
cosmonaut 2020-08-06 15:29:23 -07:00
parent a4a2a8e719
commit c97df29e28
3 changed files with 18 additions and 8 deletions

View File

@ -25,7 +25,7 @@ namespace KavTest.Engines
foreach (var rotateMessage in ReadMessages<RotateCameraMessage>()) foreach (var rotateMessage in ReadMessages<RotateCameraMessage>())
{ {
transform = transform.RotateLocal(-rotateMessage.Yaw * 0.25f * (float)dt, rotateMessage.Pitch * 0.25f * (float)dt); transform = transform.RotateLocal(rotateMessage.Yaw * 0.25f * (float)dt, rotateMessage.Pitch * 0.25f * (float)dt);
} }
SetComponent(cameraEntity, new ArcballTransformComponent(transform)); SetComponent(cameraEntity, new ArcballTransformComponent(transform));

View File

@ -18,18 +18,21 @@ namespace KavTest.Engines
public InputEngine(int centerX, int centerY) public InputEngine(int centerX, int centerY)
{ {
System.Console.WriteLine(centerX);
System.Console.WriteLine(centerY);
this.centerX = centerX; this.centerX = centerX;
this.centerY = centerY; this.centerY = centerY;
Mouse.SetPosition(centerX, centerY); Mouse.SetPosition(centerX, centerY);
System.Console.WriteLine("initialize mouse position");
System.Console.WriteLine(Mouse.GetState().X); System.Console.WriteLine(Mouse.GetState().X);
System.Console.WriteLine(Mouse.GetState().Y);
} }
public override void Update(double dt) public override void Update(double dt)
{ {
var keyboardState = Keyboard.GetState(); var keyboardState = Keyboard.GetState();
var mouseState = Mouse.GetState(); var mouseState = Mouse.GetState();
System.Console.WriteLine("mouse position");
System.Console.WriteLine(mouseState.X);
System.Console.WriteLine(mouseState.Y);
if (keyboardState.IsKeyDown(Keys.W)) if (keyboardState.IsKeyDown(Keys.W))
{ {

View File

@ -31,6 +31,18 @@ namespace KavTest
protected override void LoadContent() protected override void LoadContent()
{ {
}
protected override void UnloadContent()
{
base.UnloadContent();
}
protected override void Initialize()
{
base.Initialize();
var rustyBallModel = Kav.ModelLoader.Load( var rustyBallModel = Kav.ModelLoader.Load(
GraphicsDevice, GraphicsDevice,
Smuggler.Importer.ImportGLB(GraphicsDevice, File.OpenRead("Content/rustysphere.glb")) Smuggler.Importer.ImportGLB(GraphicsDevice, File.OpenRead("Content/rustysphere.glb"))
@ -85,11 +97,6 @@ namespace KavTest
World = WorldBuilder.Build(); World = WorldBuilder.Build();
} }
protected override void UnloadContent()
{
base.UnloadContent();
}
protected override void Update(GameTime gameTime) protected override void Update(GameTime gameTime)
{ {
World.Update(gameTime.ElapsedGameTime.TotalSeconds); World.Update(gameTime.ElapsedGameTime.TotalSeconds);