Jump to content
  • Advertisement
  • entries
    707
  • comments
    1173
  • views
    436427

Update

Sign in to follow this  
Programmer16

80 views

Making progress on my entry. Spent most of yesterday figuring out the changes between XNA beta and the new release.

Got my BitmapFont class converted from C++ to C#; works better and works right (found a nice little quirk in it.) Here's a screenshot:

(Just random test text.)

Shows vertical-center, center alignment, word-break, and color formatting. I changed the system a tiny bit from before. Now using ^0 resets the color to the color specified by the function call. Here's the code for the sample above:

TimeElapsed += (float)GameTime.ElapsedGameTime.Milliseconds / 1000.0f;
if(TimeElapsed > 1)
{
TimeElapsed = 0;
++LineCount;
}
Graphics.GraphicsDevice.Clear(Color.Black);

SpriteBatch.Begin(SpriteBlendMode.AlphaBlend);
SpriteBatch.Draw(CursorTexture, new Rectangle((int)CursorPosition.X, (int)CursorPosition.Y, 32, 32), Color.White);
SpriteBatch.End();

Font.PreRender();
Font.Print(String.Format("Mouse XY({0},{1})", CursorPosition.X, CursorPosition.Y), 0, CursorPosition + new Vector2(32.0f, 32.0f), FontFormatting.Left, (int)Color.Red.PackedValue);
Font.PostRender();

String[] Lines =
{
"`255,0,0`Delta Squad Leader^0: Alpha Squad, come in.",
"...",
"...",
"`0,0,255`???^0: I. ..at y.. ..als?",
"`255,0,0`Delta Squad Leader^0: Message scrambled; repeat.",
"`0,0,255`???^0: I said, is that you Beals?",
"`255,0,0`Beals^0: About fucking time you assholes made it to high ground. What's your status?",
"`0,0,255`Alpha Squad Leader^0: We're in the `255,255,0`laboratory^0, making our way to the roof. We lost Seraph a couple floors down.",
"`255,0,0`Beals^0: Damnit. Keep moving, we'll try to go back down when we regroup.",
};

if(LineCount > Lines.Length)
LineCount = Lines.Length;

String Output = "";
for(int Index = 0; Index < LineCount; ++Index)
Output += Lines[Index] + "\n";

Mark2.PreRender();
Mark2.Print(Output, 0, new Rectangle(0, 0, 800, 600), FontFormatting.WordBreak | FontFormatting.VCenter | FontFormatting.Center, (int)0xff808080);
Mark2.PostRender();

base.Draw(GameTime);





You can't see it from the screenshot, so here's the gist of things:
Every second a new line of text is added
Escape exits
The cursor is controlled by the mouse or the 360 controller
Pressing back on the 360 controller exits

...
That's about it. More stuff will be coming though.



I have to say I absolutely love writing font engines (and other associated stuff like GUIs.)

Anyway, more stuff coming tomorrow. Oh, and thanks for 44k views and 978 posts; you guys rock!
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 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!