Jump to content
  • Advertisement
Sign in to follow this  
raidzero

[XNA] Input Textbox

This topic is 2629 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Adding some more features to my game written in C#
I want, at the character creation screen, for the player to be able to name their character.
I've done some research and I've seen things like Xna doesn't really support input and that I would need to individually record key strokes or something.
So far I've only drawn strings of text to the screen.
How do I go about adding a text box to the screen?

Share this post


Link to post
Share on other sites
Advertisement
Most of the ones I've seen are no longer updated or supported. Anyone know of any that are simple and working for Xna 4.0?

Didn't want to make a new topic for this, but how can I get a string of text to follow my player sprite?
I think I need to create an update method for my label...not sure though.

My label class

public class Label
{
public Label()
{
break = false;
}

public override void Update(GameTime gameTime)
{
}

public override void Draw(SpriteBatch spriteBatch)
{
spriteBatch.DrawString(SpriteFont, Text, Position, Color);
}

public override void HandleInput()
{
}
}
}


Code for the position of the text.

private void CreateControls()
{
Label labelOne = new Label();

labelOne.Text = "StringOfText";
labelOne.Size = labelOne.SpriteFont.MeasureString(labelOne.Text);
labelOne.Position = new Vector2(sprite.Position.X, sprite.Position.Y);

ControlManager.Add(labelOne);

ControlManager.NextControl();
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!