|
| Font (const char *フォント名, int 大きさ, int 行間=0, bool 高品質レンダリングフラグ=true) |
| コンストラクタ
|
|
bool | Load (const char *フォント名, int 大きさ, int 行間=0, bool 高品質レンダリングフラグ=true) |
| フォントを作成する. More...
|
|
bool | Release () const |
| フォントハンドルをメモリから開放する. More...
|
|
TTF_Font * | GetHandle () const |
| フォントのハンドルを取得. More...
|
|
Image | MakeImage (Color 文字色, bool 反転フラグ, const VariadicStream &描画する文字列) const |
| FontからImageを生成. More...
|
|
void | SetSize (int 大きさ, int 行間=0) |
| フォントの行間を再指定する. More...
|
|
bool | MakeBMPFont (const std::string テキストファイル名) |
| BMPフォントデータを生成する. More...
|
|
bool | LoadBMPFont (const Image &BMPフォント, const std::string テキストファイル名) |
| MakeBMPFontで生成したBMPフォントデータを読み込む. More...
|
|
int | GetSize () const |
| 大きさを取得. More...
|
|
int | GetDrawStringWidth (const VariadicStream &幅を計算する文字列) const |
| 描画時の幅を取得. More...
|
|
bool | Draw (const Point &座標, const Color &描画色, const VariadicStream &描画する文字列, bool 反転フラグ=false) const override |
| 文字を描画. More...
|
|
bool | DrawShadow (const Point &座標, Color 表色, Color 影色, const VariadicStream &描画する文字列) const |
| 文字を影付きで描画. More...
|
|
bool | DrawRotate (const Point &座標, double 拡大率, double 角度, const Color &描画色, const VariadicStream &描画する文字列, bool 反転フラグ=false) const override |
| 文字を回転して描画. More...
|
|
bool | DrawExtend (const Point &座標, double X拡大率, double Y拡大率, const Color &描画色, const VariadicStream &描画する文字列, bool 反転フラグ=false) const override |
| 拡大率を指定して文字を描画. More...
|
|
void | SetImage (const std::string &文字, Image *対応画像) |
| 指定した文字に対応するImageを設定. More...
|
|
void | SetImageS (const std::string &文字列, ImagePack *対応画像, int 登録数) |
| 指定した文字から連続してに対応するImageをまとめて設定. More...
|
|
TrueTypeFontとBMPFontをまとめて扱うクラス.
毎回レンダリングせず、ハッシュマップにImageを格納する 一度も表示していない文字が必要になった場合生成し以後使いまわす
- Todo:
- 高さが違う文字が混ざった場合の仕様が未定、現状上揃え
bool SampleFont()
{
using namespace SDX;
Font fontA(SystemFont::Gothic, 9, 4,
false);
Font fontB(SystemFont::Mincho, 20, 4,
true);
fontA.MakeBMPFont("data/jyouyoukannji.txt");
Image bmpFont(
"data/bmpfont.png");
fontA.LoadBMPFont(bmpFont, "data/jyouyoukannji.txt");
ImagePack bmpNumber(
"data/number.png",10,10,1);
ImagePack bmpFont2(
"data/font.png", 30, 10, 3);
fontA.SetImageS("0", &bmpNumber,10);
fontA.SetImageS("a", &bmpFont2, 26);
fontA.SetImageS("A", &bmpFont2, 26);
fontA.SetImage("×", bmpFont2[26]);
fontA.SetImage("□", bmpFont2[27]);
fontA.SetImage("○", bmpFont2[28]);
fontA.SetImage("☆", bmpFont2[29]);
double angle = 0;
{
angle += 0.02;
fontA.Draw({ 10 , 10 },
Color::White,
"Hello○\nこん☆にちは\n今日は1234");
fontB.Draw({ 10 , 200 },
Color::Blue,
"Hello○\nこん☆にちは\n今日は1234");
fontA.DrawRotate({ 300, 100 }, 1, angle,
Color::White,
false,
"文字の回転□\nてすと1234×");
fontB.DrawRotate({ 300, 200 }, 1, angle,
Color::White,
false,
"文字の回転□\nてすと1234×");
}
return true;
}