RT @IndieOlympics: #IndieOlympics2017. What do you want to see? What should we create together? RT and reply (Today)

RT @HeartMachineZ: If you or anyone you know is a topnotch GameMaker programmer and interested in helping us with a few things, hit up info… (Yesterday)

@RakurinHD It was Ibuki who I was kinda interested in checking out so maybe it was just destiny (Yesterday)

@Capy_Nathan I think I still like 4 better but that is probably just due to how much time I spent with it, and 5 doesn't have sak ;_; (Yesterday)

@Capy_Nathan hmm yeah I am having fun with mika, karin, and juri but right now the characters feel more samey than they did in SF4 maybe? (Yesterday)

@mattjbaldo It purchased it with my fight money which is the first option in the menu, so when it buffered my input it just selected that. (Yesterday)

@Capy_Nathan yes the core game is really fun and cool and great which is why I am so dang frustrated at everything else (Yesterday)

I cannot help but laugh at what a horrible mess SFV is other than the actual core game itself. It amazes me more and more every day. (Yesterday)

accidentally bought a character in street fighter v because I tried to select a locked char and it lagged and I hit A during the lag fffffff (Yesterday)

@aceriou not an otter thing. You could use some windows api methods on init to force focus I believe. (2 days ago)

@aceriou yeah sorry that's something in windows I think. When you run without debug console it should just focus the game window (2 days ago)

@TyrusPeace I hear guilty gear is pretty good. The new KoF looks... weird. I liked KoF13 a lot though. (2 days ago)

@RakurinHD Yeah they look... alright? But dang between the UI, survival mode, and the excessive DLC I'm amazed it has players (2 days ago)

I like the core system and fighting part of street fighter v but wow everything else surrounding it stinky poop garbage (2 days ago)

@aceriou There was a Flashpunk "port" to C++, and Otter is based off Flashpunk: t.co/PBf41S4KRh Hasn't been touched in awhile though (3 days ago)

@aceriou Not sure, but if you're using C++ I would look into just using SFML directly, or look into C++ built frameworks rather than Otter. (3 days ago)

@StoryFort yaye yaaaaaaye (3 days ago)

@dejobaan I'M FIRED (3 days ago)

Working solo is cool and all but it also means that when I'm in a huge funk I don't have anyone else on the project to snap me out of it x_x (3 days ago)

RT @x01010111: If YOU help make @HaxeFlixel better, I can make better games for YOU to play!!! t.co/glJDPr5Oiw #indiedev t.… (3 days ago)

follow
search

2013 - 2 - 4 / 8:02 am / games

Dev Log: Some Bitmap Text

I guess I'll start calling these posts Dev Logs now? Yeah, that sounds good.

Image
The latest thing I've been chipping away at is handling bitmap text in my Flashpunk extended framework thing. There have been a couple of people that have posted Bitmap Font classes but they didn't do what I wanted, and I'm way better at coding my own thing from scratch vs. trying to modify someone else's code to do what I want.

Right now my bitmap text secret technology can do some cool stuff, like three different align modes (left, center, and right) which sounds pretty simple but it actually took me awhile to think of the proper solution for lining up text in a certain way. I also have some colored text as you can see in that awesome screenshot, and the way I do that is pretty cool (I think.) My code for coloring text ends up looking something like this:

//make da bitmap text
var bmpText:BitmapText = new BitmapText("This text will be #1GREEN!!#0 Yeah.", Global.bitmapFont);
//define the color "1" as green
bmpText.defineColor("1", 0x00FF00);


You can see a little bit how it works. I can define colors, which are assigned to certain characters (any Ascii character can be used) and then I can mark colors with a special character like '#'. Text after that character will then be drawn with a tint of that color. It's super easy to do colored words with this system, but it makes some other stuff pretty difficult.

One thing I still haven't figured out is how to escape the special character. Like if I wanted to actually display a '#' in my string, I don't have a way of doing that right now. I wanted to have '##' just escape out to a '#', and I was trying some fancy stuff with regular expressions for awhile but... yeah, things have not worked out yet. This is something I can probably just tackle later though.

Bitmap text comes in handy for a few reasons, and I think I'll make a more detailed blog post about that at some point down the road!

4 Comments
Avatar

2013 - 2 - 4 10:52 AM

Jake Albano

I assume you're looping through the string a character at a time at some point. Can't you just do something like this?

if (charAt(position) == "#")
{
if (charAt(position + 1) != "#"))
{
changeColor();
}
else
{
result += "#";
}
}

Obviously pseudocode, but that's how I generally handle escaping in situations like this.

Avatar

2013 - 2 - 4 11:59 AM

NounVerber

@jake
In your code the second # would still change the color. ;)

Avatar

2013 - 2 - 4 7:04 PM

Jake Albano

Well, yeah; obviously you would increment the position in the string so it would skip over the next '#'. I should have put that in there. :)

Avatar

2013 - 2 - 5 6:51 AM

Kyle

Yeah, I've tried a number of different ways but they all come with their own complications later. Like right now I'm having problems with typing out bitmap text character by character because of the color code escape stuff.

I was trying a simple technique of doing a string replace on "##" and replacing it with a random ascii character, and then when I hit that ascii character in the string I render the "#" instead. The problem then becomes that the internal length of the string is now one less than the given string because ## is translated into one character, and I use the string length to determine which character to type out next... maybe if I replace ## with two characters it will work... hm!

Avatar

Post your comment!

POST COMMENT

about

About

Hi! My name's Kyle, and I make video games most of the time in Denver, Colorado. Here you will find my thoughts, games, websites, doodles, and other stuff like that. I worked on Snapshot, Offspring Fling, and a whole bunch of other games. I also created and maintain Otter, a 2d game making framework. If you want to get a hold of me use the form on the bottom of the page, leave a comment, or just tweet at me. I try to post three times a week. Thanks for stoppin' by! You're the coolest.

blog stuff

categories

tags

archives

facebook

videos

Do you want to make a Let's Play of one of my games, or a just a video featuring footage of my games? You have my full permission to do so! Even if you are monetizing your videos, you still have my full permission to use any footage from any of my games. Go for it!

contact

Your message has been sent! Thanks :)
SEND MESSAGE