Planeshift
|
00001 /* 00002 * Author: Roland Schulz 00003 * 00004 * Copyright (C) 2007 Atomic Blue ([email protected], http://www.atomicblue.org) 00005 * 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation (version 2 of the License) 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 * 00018 */ 00019 00020 #ifndef PS_EFFECT_OBJ_LABEL_HEADER 00021 #define PS_EFFECT_OBJ_LABEL_HEADER 00022 00023 #include "pseffectobj.h" 00024 #include <imesh/genmesh.h> 00025 #include <csutil/cscolor.h> 00026 #include "pseffectobjtextable.h" 00027 00028 struct iGraphics3D; 00029 struct iGraphics2D; 00030 struct iTextureManager; 00031 struct iTextureWrapper; 00032 struct iFont; 00033 struct iParticle; 00034 class psEffect2DRenderer; 00035 00040 class psEffectObjLabel : public psEffectObj, public psEffectObjTextable 00041 { 00042 private: 00043 // needed managers 00044 csRef<iTextureManager> txtmgr; 00045 csRef<iGeneralFactoryState> facState; 00046 csRef<iGeneralMeshState> genState; 00047 00048 // font 00049 csString sizeFileName; 00050 float labelwidth; 00051 csArray<uint16> xpos; 00052 csArray<uint16> ypos; 00053 csArray<uint16> width; 00054 csArray<uint16> height; 00055 00056 public: 00057 psEffectObjLabel(iView* parentView, psEffect2DRenderer* renderer2d); 00058 virtual ~psEffectObjLabel(); 00059 00062 virtual bool SetText(const csArray<psEffectTextElement> &elements); 00063 virtual bool SetText(const csArray<psEffectTextRow> &rows); 00064 virtual bool SetText(int rows, ...); 00065 00066 bool Load(iDocumentNode* node, iLoaderContext* ldr_context); 00067 void LoadGlyphs(csString name); 00068 psEffectObj* Clone() const; 00069 // inherited function overloads 00070 virtual bool Render(const csVector3 &up); 00071 virtual bool Update(csTicks elapsed); 00072 virtual void CloneBase(psEffectObj* newObj) const; 00073 00074 protected: 00078 bool PostSetup(); 00079 00080 void DrawTextElement(const psEffectTextElement &element); 00081 00084 virtual bool CreateMeshFact(); 00085 00086 }; 00087 00090 #endif