XNA Creators Club Online
Page 1 of 1 (6 items)
Sort Posts: Previous Next

Drawing Text?

Last post 16/10/2007 20:21 by Jam. 5 replies.
  • 16/10/2007 18:11

    Drawing Text?

    Hey everybody, I have a pretty simple question for you this time.
    I'm just trying to figure out how to write a string to screen using text.
    I want to do something more advanced with it later, of course, but I won't bother you with that; right now, I'm basically trying to build the amazing "Hello, world!" app in XNA, and it's harder than I thought it would be, hahah!

    I searched the forums and the C# help files, but couldn't find anything pertaining to drawing text in XNA. = \
    Thanks guys!
  • 16/10/2007 18:50 In reply to

    Re: Drawing Text?

    Jeez, right in the "How to:" section, huh? Now I look like a jackass, hahah.
    Thank you for the help though, very much appreciated! :)
  • 16/10/2007 20:13 In reply to

    Re: Drawing Text?

    Ah, crap. I'm having another problem now. When I go to load my sprite font file, I keep on getting a "File not Found" exception.
    Code:

             if (loadAllContent)
                {
                    spriteFont = content.Load<SpriteFont>(@"SpriteFont1.spritefont");
                    spriteBatch = new SpriteBatch(graphics.GraphicsDevice);
                }


    I don't know what the problem is; I clicked New Item in the left-click drop down menu of my project in the solution explorer, and it made the new spritefont file for me...but in the solution explorer, the spritefont's icon is that generic "window's doesn't know what kind of file this is" icon. So I dunno....suggestions? Thanks again guys, sorry to trouble you.

    Edit:
    And blah, double post. Why can't I delete my messages? XP
  • 16/10/2007 20:16 In reply to

    Re: Drawing Text?

    When loading things in using the ContentManager,you don't specify the file extension. So your code should just be

    spriteFont = content.Load<SpriteFont>(@"SpriteFont1");

    and that should take care of it.
  • 16/10/2007 20:21 In reply to

    Re: Drawing Text?

    *smacks head*
    God I'm an idiot. That was indeed the problem, hahah. I've been off C# for a few months now so I'm a little rusty and you know...excuse excuse excuse, etc etc.

    Heh, thanks again. That was a pretty noobish mistake on my part. X3
Page 1 of 1 (6 items) Previous Next