Open PedroAlvesq opened 10 years ago
You might be able to do that, by checking if the Console is focused or not.
Example logic.
if (Console.Focused == false) {
//Allow Character movement
}
Or you can toggle the state of the TextBox on the Console with the property TextBoxVisible
and do the same checks.
i put like this and don´t work what is wrong
public override void Update(GameTime gameTime)
{
var pointerState = pointer.GetState();
if (pointerState.Points.Count > 0 && pointerState.Points[0].EventType == PointerEventType.Released)
{
// Go to next model when pressing key space
model = models[(models.IndexOf(model) + 1) % models.Count];
}
// Calculate the bounds of this model
modelBounds = model.CalculateBounds();
// Calculates the world and the view based on the model size
const float MaxModelSize = 10.0f;
var scaling = MaxModelSize / modelBounds.Radius;
view = Matrix.LookAtRH(new Vector3(0, 0, MaxModelSize * 2.5f), new Vector3(0, 0, 0), Vector3.UnitY);
projection = Matrix.PerspectiveFovRH(0.9f, (float)GraphicsDevice.BackBuffer.Width / GraphicsDevice.BackBuffer.Height, 0.1f, MaxModelSize * 10.0f);
world = Matrix.Translation(-modelBounds.Center.X, -modelBounds.Center.Y, -modelBounds.Center.Z) * Matrix.Scaling(scaling) * Matrix.RotationY((float)gameTime.TotalGameTime.TotalSeconds);
if (con1.TextBoxVisible == false) {
HandleInput();
}
// NeoManager.Update(gameTime);
base.Update(gameTime);
// NeoManager.Update(gameTime);
// get the total elapsed seconds since the start of the game
}
if (con1.TextBoxVisible == false) { HandleInput(); }
I'm guessing your now unable to press anything if the console has no focus.
You should still run HandleInput but move the player controls to another method and inside HandleInput check the console and execute player input when the console is not focused.
For example
private void HandleInput() {
if(!console.TextBoxVisible) {
HandlePlayerInput();
}
else {
//Focused Input
}
}
private void HandlePlayerInput();
i put like this but don´t work don´t show the new windows when i using the console but when is not focus i can use it
TomShane.Neoforce.Controls.Console con1;
private void HandleInput()
{
if (!con1.TextBoxVisible)
{
HandlePlayerInput();
}
else
{
con1.Focused = true;
//Focused Input
}
}
public override void Update(GameTime gameTime)
{
HandleInput();
base.Update(gameTime);
}
how i put my console when is use don´t move the my character your opens a new windows this is my code i using only the sharpdx