Advertisement Jump to content
Sign in to follow this  
RichardoX

OpenGL Quick and Dirty OpenGL font featuring the Super Mario font (NES)

This topic is 4579 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I just wrote a quick font routine that has a built in font and requires no external data files. It uses the famous (?) Super Mario Bros-style font. It is useful for small projects and test applications, when writing a real font is too time/resource consuming. Can be used for retro and arcade games too. Sources and example available at: http://users.tkk.fi/~rsalmin2/font.tar.bz2 See the README for more information.
Sample code:
#include "font.h"

glEnable(GL_TEXTURE_2D);
Font &font = Font::getInstance();
if(font.init() != 0) return -1;

font.drawString("the quick brown fox jumps over the lazy dog");
font.printf("string: %s  float: %f  integer: %d\nnewline ok", "omg!", 3.1415926535, 1234567890);
font.drawChar('q');

font.deinit();		// optional, only glDeleteTextures inside
The code is ugly but working. This was written in an hour or so. All feedback is welcome. -Riku rsalmin2(ät)cc.hut.fi

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!