SDXFrameWork  0.11
SDXFrameWork
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Public Member Functions | List of all members
SDX::FontOld Class Reference

旧フォントクラス. More...

#include <Font_Old.h>

Inherits SDX::IFont.

Public Member Functions

 FontOld (const char *フォント名, int 大きさ, int 太さ=1, int 改行高さ=0)
 デフォルトコンストラクタ. More...
 
bool Load (const char *フォント名, int 大きさ, int 太さ=1, int 改行高さ=0)
 メモリ上にフォントを作成する. More...
 
bool Release () const
 フォントをメモリから開放する. More...
 
TTF_Font * GetHandle () const
 フォントのハンドルを取得. More...
 
Image MakeImage (Color 文字色, bool 反転フラグ, VariadicStream 描画する文字列) const
 フォントから画像を生成
 
int GetSize () const
 大きさを取得. More...
 
int Getthick () const
 太さを取得. More...
 
int GetDrawStringWidth (VariadicStream 幅を計算する文字列) const
 描画時の幅を取得[DXLIB]. More...
 
bool Draw (const Point &座標, const Color &描画色, const VariadicStream &描画する文字列, bool 反転フラグ=false) const override
 文字を描画. 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...
 

Detailed Description

旧フォントクラス.

毎回レンダリングするので遅い

//Copyright © 2014 SDXFramework
//[License]GNU Affero General Public License, version 3
//[Contact]http://sourceforge.jp/projects/dxframework/
//フォントを作成して文字列を描画する
bool SampleFont()
{
using namespace SDX;
System::Initialise("sample", 640, 480);
//フォントの初期化
Font fontA(SystemFont::Gothic, 9, 4,false);
Font fontB(SystemFont::Mincho, 20, 4, true);
//BMPフォントの登録
ImagePack bmpNumber("data/number.png",10,10,1);
ImagePack bmpFont("data/font.png", 30, 10, 3);
fontA.SetImageS("0", &bmpNumber,10);
fontA.SetImageS("a", &bmpFont, 26);
fontA.SetImageS("A", &bmpFont, 26);
fontA.SetImage("×", bmpFont[26]);
fontA.SetImage("□", bmpFont[27]);
fontA.SetImage("○", bmpFont[28]);
fontA.SetImage("☆", bmpFont[29]);
double angle = 0;
while (System::Update())
{
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×");
if (Input::key.Return.on){ break;}//Enterで終了
}
return true;
}

Constructor & Destructor Documentation

SDX::FontOld::FontOld ( const char *  フォント名,
int  大きさ,
int  太さ = 1,
int  改行高さ = 0 
)
inline

デフォルトコンストラクタ.

Member Function Documentation

bool SDX::FontOld::Load ( const char *  フォント名,
int  大きさ,
int  太さ = 1,
int  改行高さ = 0 
)
inline

メモリ上にフォントを作成する.

太さは0~9で指定、大きさと太さは-1にするとデフォルトになる
改行高さは0の場合、改行後の文字が上下くっつく。 SDLとDXLIBではフォント名の指定方法が違うので注意。 SDLでは太さとフォントタイプが無効

bool SDX::FontOld::Release ( ) const
inline

フォントをメモリから開放する.

TTF_Font* SDX::FontOld::GetHandle ( ) const
inline

フォントのハンドルを取得.

int SDX::FontOld::GetSize ( ) const
inline

大きさを取得.

int SDX::FontOld::Getthick ( ) const
inline

太さを取得.

int SDX::FontOld::GetDrawStringWidth ( VariadicStream  幅を計算する文字列) const
inline

描画時の幅を取得[DXLIB].

bool SDX::FontOld::Draw ( const Point 座標,
const Color 描画色,
const VariadicStream 描画する文字列,
bool  反転フラグ = false 
) const
inlineoverridevirtual

文字を描画.

Implements SDX::IFont.

bool SDX::FontOld::DrawRotate ( const Point 座標,
double  拡大率,
double  角度,
const Color 描画色,
const VariadicStream 描画する文字列,
bool  反転フラグ = false 
) const
inlineoverridevirtual

文字を回転して描画.

呼び出す度に画像イメージを作成するので処理は重い

Implements SDX::IFont.

bool SDX::FontOld::DrawExtend ( const Point 座標,
double  X軸拡大率,
double  Y軸拡大率,
const Color 描画色,
const VariadicStream 描画する文字列,
bool  反転フラグ = false 
) const
inlineoverridevirtual

拡大率を指定して文字を描画.

Implements SDX::IFont.