1 /*---------------------------------------------------------------------------* 2 Project: NintendoWare 3 File: font_ResFont.h 4 5 Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain proprietary 8 information of Nintendo and/or its licensed developers and are protected by 9 national and international copyright laws. They may not be disclosed to third 10 parties or copied or duplicated in any form, in whole or in part, without the 11 prior written consent of Nintendo. 12 13 The content herein is highly confidential and should be handled accordingly. 14 15 $Revision: 31311 $ 16 *---------------------------------------------------------------------------*/ 17 18 #ifndef NW_FONT_RESFONT_H_ 19 #define NW_FONT_RESFONT_H_ 20 21 #include <nn/types.h> 22 #include <nw/font/font_ResFontBase.h> 23 24 namespace nw { 25 namespace font { 26 27 //--------------------------------------------------------------------------- 28 //! @brief フォントリソースに対する操作を実装するクラスです。 29 //--------------------------------------------------------------------------- 30 class ResFont : public ResFontBase 31 { 32 public: 33 /* ------------------------------------------------------------------------ 34 関数 35 ------------------------------------------------------------------------ */ 36 37 //! @name コンストラクタ / デストラクタ 38 //@{ 39 40 //! コンストラクタです。 41 ResFont(); 42 43 //! デストラクタです。 44 virtual ~ResFont(); 45 46 //@} 47 48 //! @name リソースの関連付け / 解除 49 //@{ 50 51 //! @brief フォントリソースを関連付けてフォントを使用可能にします。 52 //! 53 //! @param[in,out] bfnt ResFont に関連付ける bfnt へのポインタ。 54 //! 128byte アライメントされている必要があります。 55 //! 56 //! @return リソースの関連付けが成功したなら true を、 57 //! そうでなければ false を返します。@n 58 //! リソース bfnt が不正であると失敗します。 59 //! 60 bool SetResource(void* bfnt); 61 62 //! @brief フォントリソースの割り当てを解除します。 63 //! 64 //! @return リソースが関連付けされている場合は、関連付けされているリソースへの 65 //! ポインタを返します。 66 //! 関連付けされていない場合は NULL を返します。 67 //! 68 void* RemoveResource(); 69 70 using ResFontBase::IsManaging; 71 72 //! @brief 描画に必要なバッファのサイズを計算します。 73 //! 74 //! @param[in] bfnt フォントリソースの先頭部分へのポインタ。 75 //! 76 //! @return 描画に必要なバッファのサイズを返します。 77 //! 78 static u32 GetDrawBufferSize(const void* bfnt); 79 80 //! @brief 描画に必要なバッファへのポインタを取得します。 81 //! 82 //! @return 描画に必要なバッファへのポインタを返しします。 83 //! GetDrawBuffer()84 void* GetDrawBuffer() 85 { 86 return GetTextureObjectsBufferPtr(); 87 } 88 89 //! @brief 描画に必要なバッファをセットします。 90 //! セットするバッファのサイズは、GetDrawBufferSize()で取得します。 91 //! 92 //! NULLを指定すると、描画バッファを使用しない状態に戻ります。 93 //! 94 //! @param[in] buffer バッファへのポインタ。 95 //! 4byte アライメントされている必要があります。 96 //! 97 //! @return 以前に設定されていた内容(初期値はNULL)を返します。 98 //! 99 void* SetDrawBuffer(void* buffer); 100 101 //@} 102 103 104 private: 105 /* ------------------------------------------------------------------------ 106 関数 107 ------------------------------------------------------------------------ */ 108 109 //! @brief メモリ上にロードされたbrfntファイルを再構築して 110 //! 使用できるようにします。 111 //! 112 //! @param[in,out] fileHeader メモリ上にロードしたbrfntファイルの 113 //! ファイルヘッダへのポインタ 114 //! 115 //! @return 再構築に成功した場合はFINFブロック本体へのポインタを返します。 116 //! 再構築に失敗した場合はNULLを返します。 117 //! 118 static FontInformation* Rebuild(ut::BinaryFileHeader* fileHeader); 119 }; 120 121 } // namespace font 122 } // namespace nw 123 124 #endif // NW_FONT_RESFONT_H_ 125