I SOLVED THE PROBLEM.
Edited by Pepsi, 19 September 2012 - 07:33 PM.
Posted 19 September 2012 - 01:27 PM
SDL_Rect glyphBounds[256];
// load into file
std::ifstream fs( "bitmap_font.txt" );
for ( int idx = 0; idx < 256 && fs >> glyphBounds[idx]; ++idx )
;
// draw:
std::string str = "Hello";
int x = 0, y = 0;
for ( int idx = 0; idx < str.length(); ++idx ) {
const SDL_Rect& r = glyphBounds[str[idx]];
draw( x, y, bmpFont, r );
x += r.width;
}
Edited by fastcall22, 19 September 2012 - 01:34 PM.