i porting my game in xna 4.0 with neoforce to sharpdx with neoforce
the problem it is i can´t put in my game the keyboard input working
public World(Game game, Manager ola, string text)
: base(game)
{
NeoManager = ola;
// HandleInput();
// Keyboard = new KeyboardManager(game); if uncomment this line say this service is allredy registed
texto = text;
System.Console.Write(texto);
// graphicsDeviceManager.PreferredGraphicsProfile = new FeatureLevel[] { FeatureLevel.Level_9_1, };
pointer = new PointerManager(game);
// keyboarManager = new KeyboardManager(game);
// this game system has something to draw - enable drawing by default
// this can be disabled to make objects drawn by this system disappear
Visible = true;
// this game system has logic that needs to be updated - enable update by default
// this can be disabled to simulate a "pause" in logic update
Enabled = true;
// add the system itself to the systems list, so that it will get initialized and processed properly
// this can be done after game initialization - the Game class supports adding and removing of game systems dynamically
Game.GameSystems.Add(this);
}
private void HandleInput()
{
KeyboardState currentKeyboardState =new KeyboardState();
// Keyboard.GetState();
// Check for exit.
// Now move the sphere. First, we want to check to see if the sphere should
// turn. turnAmount will be an accumulation of all the different possible
// inputs.
if (currentKeyboardState.IsKeyDown(Keys.A) ||
currentKeyboardState.IsKeyDown(Keys.Left))
{
// turnAmount += 1;
}
if (currentKeyboardState.IsKeyDown(Keys.D) ||
currentKeyboardState.IsKeyDown(Keys.Right))
{
// turnAmount -= 1;
}
// clamp the turn amount between -1 and 1, and then use the finished
// value to turn the sphere.
// Next, we want to move the sphere forward or back. to do this,
// we'll create a Vector3 and modify use the user's input to modify the Z
// component, which corresponds to the forward direction.
if (currentKeyboardState.IsKeyDown(Keys.W) ||
currentKeyboardState.IsKeyDown(Keys.Up))
{
}
if (currentKeyboardState.IsKeyDown(Keys.S) ||
currentKeyboardState.IsKeyDown(Keys.Down))
{
}
if (currentKeyboardState.IsKeyPressed(Keys.I))
{
inventory.Show();
}
if (currentKeyboardState.IsKeyDown(Keys.B))
{
Charactersstatus.Show();
}
/* if (currentKeyboardState.IsKeyDown(Keys.Escape))
{
if(tbc.Focused==true){
tbc.Visible = false;
}
//else
//{
// tbc.Show();
//}
// InitConsole(text).Show();
//windows();
}
*/
// next, we'll create a rotation matrix from the sphereFacingDirection, and
// use it to transform the vector. If we didn't do this, pressing "up" would
// always move the ball along +Z. By transforming it, we can move in the
// direction the sphere is "facing."
// Now we know how much the user wants to move. We'll construct a temporary
// vector, newSpherePosition, which will represent where the user wants to
// go. If that value is on the heightmap, we'll allow the move.
// now we need to roll the ball "forward." to do this, we first calculate
// how far it has moved.
// once we've finished all computations, we can set spherePosition to the
// new position that we calculated.
}
the error i have is this An unhandled exception of type 'System.NullReferenceException' occurred in TomShane.Neoforce.Central.exe
Additional information: A referência de objecto não foi definida como uma instância de um objecto.