gfxFontRenderBatcher.h
Engine/source/gfx/gfxFontRenderBatcher.h
Classes:
Public Defines
define
TEXT_MAG() 1
Detailed Description
Public Defines
TEXT_MAG() 1
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _GFXFONTBATCHER_H_ 25#define _GFXFONTBATCHER_H_ 26 27#include "core/dataChunker.h" 28#include "gfx/gfxDevice.h" 29#include "gfx/gFont.h" 30 31#define TEXT_MAG 1 32 33class FontRenderBatcher 34{ 35 struct CharMarker 36 { 37 S32 c; 38 F32 x; 39 GFXVertexColor color; 40 PlatformFont::CharInfo *ci; 41 }; 42 43 struct SheetMarker 44 { 45 S32 numChars; 46 S32 startVertex; 47 CharMarker charIndex[1]; 48 }; 49 50 DataChunker mStorage; 51 Vector<SheetMarker*> mSheets; 52 GFont *mFont; 53 U32 mLength; 54 GFXStateBlockRef mFontSB; 55 56 SheetMarker &getSheetMarker(U32 sheetID); 57 58public: 59 FontRenderBatcher(); 60 61 void init(GFont *font, U32 n); 62 63 void queueChar(UTF16 c, S32 ¤tX, GFXVertexColor ¤tColor); 64 65 void render(F32 rot, const Point2F &offset ); 66}; 67 68#endif 69