/*---------------------------------------------------------------------------* Project: Horizon File: font_DispStringBuffer.h Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Revision: 25674 $ *---------------------------------------------------------------------------*/ #ifndef NN_FONT_CTR_FONT_DISP_STRING_BUFFER_H_ #define NN_FONT_CTR_FONT_DISP_STRING_BUFFER_H_ #include namespace nn { namespace font { namespace CTR { struct CharAttribute { math::VEC4 pos; util::Color8 color[internal::TEXTCOLOR_MAX]; math::VEC4 tex; const internal::TextureObject* pTexObj; //!< テクスチャオブジェクトへのポインタ }; //--------------------------------------------------------------------------- //! :private //! //! @brief 文字列表示用バッファを管理するクラスです。 //--------------------------------------------------------------------------- struct DispStringBuffer { const u32 charCountMax; //!< 格納可能な文字数 u16 charCount; //!< 格納した文字数 u16 drawCharCount; //!< 描画コマンドを生成する文字数 u8 generatedCommand; //!< コマンドが生成された。 u8 padding[3]; u8* drawFlags; //!< フラグ配列 u32* commandBuffer; //!< コマンドバッファ u32 commandBufferSize; //!< 使用しているコマンドバッファサイズ u32 commandBufferCapacity; //!< コマンドバッファのキャパシティ u32 textColorCommandOffset; //!< テキストカラーのコマンドのオフセット //! 頂点属性配列 CharAttribute* GetCharAttrs() const { return reinterpret_cast( reinterpret_cast(this) + sizeof(*this) ); } static u32 CalcCommandBufferCapacity(u32 charNum); //! コンストラクタです。 DispStringBuffer(u32 charNum); //! コマンドをクリアします。 void ClearCommand() { generatedCommand = false; } //! コマンドが生成済みかどうかを判定します。 bool IsGeneratedCommand() { return 0 != generatedCommand; } //! コマンドが空かどうかを判定します。 bool IsCommandEmpty() { return 0 == commandBufferSize; } //! 描画コマンドを生成する文字数を取得します。 u16 GetDrawCharCount() const { return drawCharCount; } //! 描画コマンドを生成する文字数を設定します。 void SetDrawCharCount(u16 count) { drawCharCount = count; } //! 描画コマンドを生成する文字数をリセットします。 void ResetDrawCharCount() { SetDrawCharCount(0xFFFF); } }; } // namespace CTR } // namespace font } // namespace nn #endif // NN_FONT_CTR_FONT_DISP_STRING_BUFFER_H_