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

Scrollbar in XNA

Last post 11/14/2009 11:50 AM by Segados. 4 replies.
  • 11/14/2009 9:27 AM

    Scrollbar in XNA

    I'm making my own component library at the moment, but I'm having trouble making a scrollbar for my textarea.

    Is it possible to mask a part of the textarea (sprite), so I can give my mask different y coordinates depending on what part my scrollbar is.

    Thanks!

    - Kevin
  • 11/14/2009 10:38 AM In reply to

    Re: Scrollbar in XNA

    Why is your textarea a sprite? Shouldn't it be text, in which case you would simply select which lines of text to render at what location? (To answer the question asked: look at the sourceRectangle parameter to SpriteBatch.Draw)
  • 11/14/2009 10:44 AM In reply to

    Re: Scrollbar in XNA

    You need to render (draw) the text, right? You can't just put up real text, correct me if I'm wrong though.

    - Kevin
  • 11/14/2009 11:48 AM In reply to

    Re: Scrollbar in XNA

    Well is your text precreated in a 2D editor such as Paint and loaded as a Texture2D? If so that's usually the wrong way to do it for general text - load a SpriteFont and use SpriteBatch.DrawString.

    As for scrollbars, check out the link in my sig for the ScrollbarComponent. It might do what you want.
    "Software is never finished, it is in varying states of 'less broken'" because "If it ain't broke, it doesn't have enough features yet"

    In Playtest: Avatar Land | The MANLY Game for MANLY Men

    The signature that was too big for the 512 char limit
  • 11/14/2009 11:50 AM In reply to

    Re: Scrollbar in XNA

    My textarea IS a sprite, though my text is not. My text is, just like you said a spritefont;).

    - Kevin
Page 1 of 1 (5 items) Previous Next