/*---------------------------------------------------------------------------* Project: Horizon File: TextWriter.h Copyright (C)2009-2012 Nintendo Co., Ltd. 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. $Rev: 46365 $ *---------------------------------------------------------------------------*/ #ifndef NN_COMMON_SCENE_TEXTWRITER_H_ #define NN_COMMON_SCENE_TEXTWRITER_H_ #include #include #include namespace scene { /* Please see man pages for details */ class TextWriter { public: /* Please see man pages for details */ TextWriter(); /* Please see man pages for details */ virtual ~TextWriter(); /* Please see man pages for details */ void Initialize(nn::fnd::ExpHeap* pExpHeap); /* Please see man pages for details */ void Finalize(); /* Please see man pages for details */ void BeginRender(GLenum targetDisplay); /* Please see man pages for details */ void EndRender(); /* Please see man pages for details */ void Printf(f32 x, f32 y, const wchar_t* pFormat, ...); /* Please see man pages for details */ void PutString(f32 x, f32 y, const wchar_t* pString); /* Please see man pages for details */ void SetTextColor(u8 red, u8 green, u8 blue, u8 alpha = 255); /* Please see man pages for details */ f32 GetFontSize(); /* Please see man pages for details */ void SetFontSize(f32 size); /* Please see man pages for details */ f32 GetFontScale(); /* Please see man pages for details */ void SetFontScale(f32 scale); /* Please see man pages for details */ f32 GetCharSpace(); /* Please see man pages for details */ void SetCharSpace(f32 charSpace); /* Please see man pages for details */ f32 CalculateStringWidth(const wchar_t* pString); /* Please see man pages for details */ f32 CalculateStringHeight(const wchar_t* pString); protected: // Perform font initialization. bool InitializeFont(); // Perform shader initialization. bool InitializeShader(); // Allocate the string buffer. nn::font::DispStringBuffer* AllocateStringBuffer(s32 charMax); protected: // Heap nn::fnd::ExpHeap* m_pExpHeap; // Font nn::font::ResFont m_font; // Render object nn::font::RectDrawer m_drawer; nn::font::WideTextWriter m_writer; // String buffer. nn::font::DispStringBuffer*m_pStringBuffer; // Character color nn::util::Color8 m_textColor; // Shader buffer void* m_pShaderBuffer; // Render target u32 m_targetDisplay; }; } // namespace scene #endif // NN_COMMON_SCENE_TEXTWRITER_H_