FineKernelToolKit  2.9.0
 全て クラス ネームスペース ファイル 関数 変数 型定義 列挙型 列挙型の値 フレンド マクロ定義 ページ
SpriteModel.h
説明を見る。
1 /****************************************************************************
2  *
3  * Copyright (c) 1999-2014, Fine Kernel Project, All rights reserved.
4  *
5  * Redistribution and use in source and binary forms,
6  * with or without modification, are permitted provided that the
7  * following conditions are met:
8  *
9  * - Redistributions of source code must retain the above
10  * copyright notice, this list of conditions and the
11  * following disclaimer.
12  *
13  * - Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the
15  * following disclaimer in the documentation and/or
16  * other materials provided with the distribution.
17  *
18  * - Neither the name of the copyright holders nor the names
19  * of its contributors may be used to endorse or promote
20  * products derived from this software without specific
21  * prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
32  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
33  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  ****************************************************************************/
37 /****************************************************************************
38  *
39  * Copyright (c) 1999-2014, Fine Kernel Project, All rights reserved.
40  *
41  * 本ソフトウェアおよびソースコードのライセンスは、基本的に
42  * 「修正 BSD ライセンス」に従います。以下にその詳細を記します。
43  *
44  * ソースコード形式かバイナリ形式か、変更するかしないかを問わず、
45  * 以下の条件を満たす場合に限り、再頒布および使用が許可されます。
46  *
47  * - ソースコードを再頒布する場合、上記の著作権表示、本条件一覧、
48  * および下記免責条項を含めること。
49  *
50  * - バイナリ形式で再頒布する場合、頒布物に付属のドキュメント等の
51  * 資料に、上記の著作権表示、本条件一覧、および下記免責条項を
52  * 含めること。
53  *
54  * - 書面による特別の許可なしに、本ソフトウェアから派生した製品の
55  * 宣伝または販売促進に、本ソフトウェアの著作権者の名前または
56  * コントリビューターの名前を使用してはならない。
57  *
58  * 本ソフトウェアは、著作権者およびコントリビューターによって「現
59  * 状のまま」提供されており、明示黙示を問わず、商業的な使用可能性、
60  * および特定の目的に対する適合性に関す暗黙の保証も含め、またそれ
61  * に限定されない、いかなる保証もないものとします。著作権者もコン
62  * トリビューターも、事由のいかんを問わず、損害発生の原因いかんを
63  * 問わず、かつ責任の根拠が契約であるか厳格責任であるか(過失その
64  * 他の)不法行為であるかを問わず、仮にそのような損害が発生する可
65  * 能性を知らされていたとしても、本ソフトウェアの使用によって発生
66  * した(代替品または代用サービスの調達、使用の喪失、データの喪失、
67  * 利益の喪失、業務の中断も含め、またそれに限定されない)直接損害、
68  * 間接損害、偶発的な損害、特別損害、懲罰的損害、または結果損害に
69  * ついて、一切責任を負わないものとします。
70  *
71  ****************************************************************************/
72 #ifndef __FK_SPRITE_MODEL_HEADER__
73 #define __FK_SPRITE_MODEL_HEADER__
74 
75 #include <FK/UniCode.h>
76 #include <FK/Model.h>
77 #include <FK/TextImage.h>
78 #include <FK/Texture.h>
79 #include <FK/Scene.h>
80 #include <FK/Window.h>
81 
83 
105 class fk_SpriteModel : public fk_Model {
106 private:
107  friend class fk_AppWindow;
108 
109  fk_RectTexture texShape;
110  fk_Material absMate;
111  fk_Model pixelBase;
112 
113  fk_UniStr textStr;
114  bool fontReady;
115 
116  static double distPut;
117 
118 public:
120 
128 
130  fk_SpriteModel(void);
132  ~fk_SpriteModel(void);
133 
135 
150  bool entryFirst(fk_Window *win, fk_Scene *scene, fk_Model *camera = NULL);
151 
153 
161  bool readBMP(const std::string filename);
162 
164 
172  bool readPNG(const std::string filename);
173 
175 
183  bool readJPG(const std::string filename);
184 
186 
191  void setImage(fk_Image &image);
192 
194 
204  fk_Image * getImage(void);
205 
207 
232  void setPositionLT(double x, double y);
233 
235 
247  void setSpriteArea(double x, double y, double w, double h);
248 
250 
262  void setSpriteSize(double width = -1.0, double height = -1.0);
263 
265 
275 
277 
287  void setSpriteSmoothMode(bool mode);
288 
290 
298  bool getSpriteSmoothMode(void);
299 
301 
318  bool initFont(const std::string fontFileName);
319 
321 
337  void drawText(const std::string str, fk_StringCode code = FK_STR_SJIS);
338 
340 
361  void drawText(const std::string str, bool mode, fk_StringCode code = FK_STR_SJIS);
362 
364 
370  void clearText(void);
371 
372 #ifndef FK_DOXYGEN_USER_PROCESS
373  void MakePixelBase(fk_Window *argWin, fk_Scene *argScn);
374 #endif
375 
376 };
377 
378 #endif
fk_SpriteModel(void)
コンストラクタ
アプリケーションウィンドウクラス
Definition: SimpleWindow.h:126
void setSpriteSmoothMode(bool mode)
画像表示モード設定関数
文字列板を管理するクラス
Definition: TextImage.h:136
文字列板に表示する文字列を制御するクラス
Definition: UniCode.h:195
void setPositionLT(double x, double y)
画像位置指定関数
モデルを生成、管理するクラス
Definition: Model.h:139
fk_Image * getImage(void)
画像データ参照関数
fk_StringCode
日本語文字コードを表す列挙型
Definition: UniCode.h:82
bool entryFirst(fk_Window *win, fk_Scene *scene, fk_Model *camera=NULL)
fk_Scene へのエントリー関数
bool initFont(const std::string fontFileName)
文字列描画用フォント設定関数
fk_TexCoord getSpriteSize(void)
表示サイズ取得関数
シーンを制御するクラス
Definition: Scene.h:109
void setSpriteSize(double width=-1.0, double height=-1.0)
表示サイズ設定関数
void setImage(fk_Image &image)
画像データセット関数
矩形テクスチャを生成、管理するクラス
Definition: Texture.h:448
bool readJPG(const std::string filename)
JPEG(JPG)画像読み込み関数
マテリアル(質感)を管理するクラス
Definition: Material.h:311
画像を生成、管理するクラス
Definition: Image.h:235
Shift-JIS (SJISコード)
Definition: UniCode.h:86
void clearText(void)
文字列消去関数
bool readBMP(const std::string filename)
Windows Bitmap (BMP)画像読み込み関数
~fk_SpriteModel(void)
デストラクタ
bool readPNG(const std::string filename)
PNG画像読み込み関数
fk_TextImage text
文字列描画設定用オブジェクト
Definition: SpriteModel.h:127
テクスチャ座標を管理するクラス
Definition: Texture.h:107
FLTK 用シーン描画ウィジェットクラス
Definition: Window.h:189
void drawText(const std::string str, fk_StringCode code=FK_STR_SJIS)
文字列表示関数
bool getSpriteSmoothMode(void)
画像表示モード取得関数
void setSpriteArea(double x, double y, double w, double h)
画像表示領域指定関数
2D スプライトモデルクラス
Definition: SpriteModel.h:105