• entries
    707
  • comments
    1173
  • views
    434029

BitmapFont System Update

Sign in to follow this  
Programmer16

83 views

Ok, I updated my bitmap font system a little. Before I had the ^# to change the color, but this is really limited and be a pain (say if you have a black background and the player changes the color to black.) So, I implemented argb colors. Here's an example:

"`255,0,0`Donny^0:This is a test of the BitmapFont rendering system. It starts on one line and goes to the next.\n`128,0,0,0`System: `255,0,0`CRITICAL SYSTEM FAILURE!!!"

'Donny' will come out red, the rest of the text will come out to whatever color is stored in BitmapFontColorTable[0], 'System:' will come out half-alpha black, and then 'CRITICAL SYSTEM FAILURE!!!' will come out red.

Here's a screenshot (using Anime Ace at size 14) and another(using Courier New at size 10.)

As you can see the size calculation skips over the formatters (I'm thinking I screwed up somewhere for the ^# formatters though, as it seems a little off, but it's fine for now.)



I updated the site a little more (added a projects and milestone system.) I also fixed a couple small bugs in the comment system. You can check it out here. Just click on a project name and it's information will show up. It's kind of bland at the moment, but it should look better once I get a nice theme in place.



I'm heading to a friend's house tonight, so I'll try to get Ascension's script part two up by tomorrow night.

-edit-
Btw, once I get the image gallery system in place, pretty much every image here is going to break. All of my project images at the very least. I'll probably fix all of the ones that I've posted over the last month or so, but that's about it.

-edit-
If anybody wants to see how my font system works, here's the code for it. It's obviously not going to be copy and pasteable as I use all kinds of helpers, but the important stuff is there (FormatString(), CalculateStringWidth(), CalculateStringHeight(), CalculateStringRect(), and Print().) If it's useful, take it and do what you will, but I'd appreciate a heads up if you find any bugs!

Header | Source
Sign in to follow this  


3 Comments


Recommended Comments

Quote:
Original post by HopeDagger
Looking very nice. I'd really like to get my hands on this, as I've always loathed dealing with fonts in OpenGL. [smile]


Hey HopeDagger, I'd have no problem sharing it with you, but it uses DirectX instead of OpenGL (I use LMNOpc for the texture and letter info.) But, if you give me a few days I could probably convert it to OpenGL and zip it up for you.

Share this comment


Link to comment
Quote:
Original post by Programmer16
Hey HopeDagger, I'd have no problem sharing it with you, but it uses DirectX instead of OpenGL (I use LMNOpc for the texture and letter info.) But, if you give me a few days I could probably convert it to OpenGL and zip it up for you.


Whoops, there I go even forgetting what API you're using, hehe. No, you don't need to go through the trouble; thanks though. [grin]

Share this comment


Link to comment

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