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

フォントデータを表すクラス[未実装]. More...

#include <HashFont.h>

Inherits SDX::IFont.

Public Member Functions

 HashFont (const char *フォント名, int 大きさ, int 太さ=1, int 改行高さ=0, FontType フォントタイプ=FontType::Normal)
 
bool Load (const char *フォント名, int 大きさ, int 太さ=1, int 改行高さ=0, FontType フォントタイプ=FontType::Normal)
 メモリ上にフォントを作成する. More...
 
bool Release () const
 フォントをメモリから開放する. More...
 
FontHandle GetHandle () const
 フォントのハンドルを取得. More...
 
Image MakeImage (Color 文字色, bool 反転フラグ, VariadicStream 描画する文字列) const
 
ImageGetHash (const char *文字) const
 
int GetSize () const
 大きさを取得. More...
 
int Getthick () const
 太さを取得. More...
 
int GetDrawStringWidth (VariadicStream 幅を計算する文字列) const
 描画時の幅を取得. More...
 
void DrawUTFString (const Point &座標, const std::string &文字列) const
 
bool Draw (const Point &座標, Color 色, VariadicStream 描画する文字列) const override
 文字を描画. More...
 
bool DrawRotate (const Point &座標, double 拡大率, double 角度, Color 描画色, bool 反転フラグ, VariadicStream 描画する文字列) const override
 文字を回転して描画. More...
 
bool DrawExtend (const Point &座標, double X拡大率, double Y拡大率, Color 描画色, VariadicStream 描画する文字列) const override
 拡大率を指定して文字を描画. More...
 

Detailed Description

フォントデータを表すクラス[未実装].

毎回レンダリングせず、ハッシュマップにデータを格納する

//©SDXFramework http://sourceforge.jp/projects/dxframework/
//🍣フォントを使って文字列を描画する
bool SampleFont()
{
using namespace SDX;
System::Initialise("sample", 600, 400);
//SDLとDXLIBでフォント指定方法が違うので注意が必要
Font fontA( SystemFont::Gothic , 20 , 1 , 10 );
Font fontB( SystemFont::Mincho , 20 , 1 , 10 );
double angle = 0;
while(System::Update())
{
angle += 0.02;
fontA.Draw({ 10 * angle, 10 }, Color::White, "Hello!\nこんにちは\n今日は");
fontB.Draw({ 10 * angle, 200 }, Color::Blue, "Hello!\nこんにちは\n今日は");
fontA.DrawRotate({ 300, 200 }, 1, angle, Color::White, false, "文字の回転\nてすとしますよ~~~");
fontB.DrawRotate({ 300, 200 }, 1, angle / 2, Color::White, false, "文字の回転\nてすとしますよ~~~");
if(Input::key.Return.on) break;//Enterで終了
}
return true;
}

Member Function Documentation

bool SDX::HashFont::Load ( const char *  フォント名,
int  大きさ,
int  太さ = 1,
int  改行高さ = 0,
FontType  フォントタイプ = FontType::Normal 
)

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

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

bool SDX::HashFont::Release ( ) const

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

FontHandle SDX::HashFont::GetHandle ( ) const

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

int SDX::HashFont::GetSize ( ) const

大きさを取得.

int SDX::HashFont::Getthick ( ) const

太さを取得.

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

描画時の幅を取得.

bool SDX::HashFont::Draw ( const Point 座標,
Color  ,
VariadicStream  描画する文字列 
) const
overridevirtual

文字を描画.

Implements SDX::IFont.

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

文字を回転して描画.

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

Implements SDX::IFont.

bool SDX::HashFont::DrawExtend ( const Point 座標,
double  X拡大率,
double  Y拡大率,
Color  描画色,
VariadicStream  描画する文字列 
) const
overridevirtual

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

Implements SDX::IFont.