mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-07-07 15:21:59 +03:00
Most of the files were already using LF (UNIX) newlines but some were using CRLF (Windows) newlines.
44 lines
1.3 KiB
C++
44 lines
1.3 KiB
C++
#ifndef SFONTPLUS_H
|
|
#define SFONTPLUS_H
|
|
|
|
#include <SDL.h>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#define SFONTPLUS_CHARSET "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~¡¿ÀÁÈÉÌÍÒÓÙÚÝÄËÏÖÜŸÂÊÎÔÛÅÃÕÑÆÇČĎĚĽĹŇÔŘŔŠŤŮŽàáèéìíòóùúýäëïöüÿâêîôûåãõñæçčďěľĺňôřŕšťžůðßÐÞþАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюяØøąćęłńśżźĄĆĘŁŃŚŻŹ"
|
|
#ifdef _WIN32
|
|
typedef unsigned int uint;
|
|
#endif
|
|
using std::vector;
|
|
using std::string;
|
|
|
|
class SFontPlus {
|
|
private:
|
|
Uint32 getPixel(Sint32 x, Sint32 y);
|
|
|
|
SDL_Surface *surface;
|
|
vector<uint> charpos;
|
|
string characters;
|
|
uint height, lineHeight;
|
|
|
|
public:
|
|
SFontPlus();
|
|
SFontPlus(SDL_Surface *font);
|
|
SFontPlus(const string &font);
|
|
~SFontPlus();
|
|
|
|
bool utf8Code(unsigned char c);
|
|
|
|
void initFont(SDL_Surface *font, const string &characters = SFONTPLUS_CHARSET);
|
|
void initFont(const string &font, const string &characters = SFONTPLUS_CHARSET);
|
|
void freeFont();
|
|
|
|
void write(SDL_Surface *s, const string &text, int x, int y);
|
|
|
|
uint getTextWidth(const string &text);
|
|
uint getHeight();
|
|
uint getLineHeight();
|
|
};
|
|
|
|
#endif /* SFONTPLUS_H */
|