Fixing the Text

Published April 28, 2011
Advertisement
The text strings in Pac-Hedron are simple chains of squares, with each square's texture coordinates adjusted to display the appropriate bit of the font texture. The entire string is a single mesh, which is saved in a std::map along with all the other meshes so it can be reused. This is bad design.

I came to realize some time ago that displaying the score would break this. Every score update would result in a new string being requested, created, and subsequently stored for later use, causing the program to eat up memory with every pellet eaten. Not good.

So, tomorrow's task is to have each character be a separate mesh, and modify the draw routine to iterate through all the characters of all text to be drawn, compiling them all into a "master" vertex buffer and index buffer, and then draw them with a single [font="Lucida Console"]DrawIndexedInstanced[/font] call.

That sounds right to my 2 a.m. self, although just thinking through it for this post has lead me to adjust the design a bit. I'm concerned it will become a more involved task than I believe it to be. But that's usually the way it goes.

Also, I spilled a very little bit of Red Bull on my keyboard this evening, and it went spastic, sending random characters as if a monkey were banging on the keys. I've been using a spare IBM keyboard my housemate has. We hates it. First order of business tomorrow is to go get a new keyboard.
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement