#include <hash_map> |
#include <hash_map> |
#include <fstream> |
#include <fstream> |
#include <cstdlib> |
#include <cstdlib> |
|
#include <iostream> |
|
|
#include "BitmapFont.h" |
#include "BitmapFont.h" |
class BitmapFontFile{ |
class BitmapFontFile{ |
private: |
private: |
hash_map<int,BitmapFont> fonts; |
std::hash_map<int,BitmapFont> fonts; |
public: |
public: |
BitmapFontFile(const string& filename){ |
BitmapFontFile(const std::string& filename){ |
ifstream from(filename.c_str()); |
std::ifstream from(filename.c_str()); |
if(!from) { |
if(!from) { |
cerr << "Cannot open input file " << filename << '\n'; |
std::cerr << "Cannot open input file " << filename << '\n'; |
abort(); |
abort(); |
} |
} |
long code; |
long code; |
string hexdata; |
std::string hexdata; |
while(!from.eof()){ |
while(!from.eof()){ |
string line; |
std::string line; |
getline(from,line); |
getline(from,line); |
string::size_type pos=line.find(' '); |
std::string::size_type pos=line.find(' '); |
string key; |
std::string key; |
string rest; |
std::string rest; |
if(pos!=string::npos){ |
if(pos!=std::string::npos){ |
key=line.substr(0,pos); |
key=line.substr(0,pos); |
rest=line.substr(pos+1); |
rest=line.substr(pos+1); |
} |
} |