开发者

iPhone Game - Open GL ES - How to Display an Integer?

开发者 https://www.devze.com 2023-02-07 04:06 出处:网络
Just a quick question. I have written a game in Open gles. How can I render a val开发者_开发技巧ue such as an integer on the screen ? (In this case int level).I don\'t think open gl has any font suppo

Just a quick question. I have written a game in Open gles. How can I render a val开发者_开发技巧ue such as an integer on the screen ? (In this case int level).


I don't think open gl has any font support, but there are a few font libraries knocking about the internet. There is some discussion of that here:

Is there a decent OpenGL text drawing library for the iPhone SDK?

I needed to do the same thing as you, that fonts are probably overkill for. So, I simply made an array of images 0 to 9, then broke down the integer into a series of those images, by using % 10 to find which digit, then / 10 to move onto the next (more significant) digit.

0

精彩评论

暂无评论...
验证码 换一张
取 消