Results 1 to 2 of 2

Thread: XNA - Scaling text?

  1. #1

    Thread Starter
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    XNA - Scaling text?

    Hey peeps.
    So I'm working on my first "real" XNA project, which is nothing more than a simple Tetris game.
    I'm drawing some text here and there in the game, but something that puzzles me is the size of the text.
    Take this for instance... When the player presses space a small box comes up, containing the text "PAUSED". The size of this box depends on the size of the window. Of course, I'd also like the text to adjust to this aswell...As it is right now it wont matter if the box is 320x240 or 1280x1024...the text size remains the size I set it to in the SpriteFont object, which is 18.

    Now, I've tried adjusting the scale parameter when drawing the text, based on the size of the window. But this makes the text very blurred once the box gets just a bit bigger.
    How can I adjust the size of my text and still keep a good quality? How do you guys do it?
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  2. #2
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,712

    Re: XNA - Scaling text?

    Have you tried making the text very large and scaling it down? It should retain it's detail when blown up to large (i.e. "normal" size).

    The other option would be to adjust the font size based on a fixed scale, such as the game-area width or height (as long as the game area has a fixed aspect ratio).
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width