# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

computed_string.h

Go to the documentation of this file.
00001 
00007 /* Copyright, 2000 Nevrax Ltd.
00008  *
00009  * This file is part of NEVRAX NEL.
00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2, or (at your option)
00013  * any later version.
00014 
00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018  * General Public License for more details.
00019 
00020  * You should have received a copy of the GNU General Public License
00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00023  * MA 02111-1307, USA.
00024  */
00025 
00026 #ifndef NL_COMPUTED_STRING_H
00027 #define NL_COMPUTED_STRING_H
00028 
00029 #include "nel/misc/types_nl.h"
00030 #include "nel/misc/smart_ptr.h"
00031 #include "3d/primitive_block.h"
00032 #include "3d/driver.h"
00033 #include "3d/vertex_buffer.h"
00034 #include "3d/material.h"
00035 #include <vector>
00036 
00037 
00038 
00039 
00040 namespace NL3D {
00041 
00042 class CTextureFont;
00043 class CMatrix;
00044 struct CFontDescriptor;
00045 
00046 
00047 /*******************************************************************/
00048 
00049 
00050 
00059 struct CComputedString
00060 {
00061 
00062 public:
00063         CVertexBuffer Vertices;
00064         CVertexBuffer VerticesClipped;
00065         CMaterial       *Material;
00066         CRGBA Color;
00067         float StringWidth;
00068         float StringHeight;
00069 
00070         // StringLine is the size from bottom of the whole string image to the hotspot
00071         // for instance if the hotspot is bottomLeft the imaginary line of the string "bpc"
00072         // is under the b, under the loop of the p but over the leg of the p. So StringLine
00073         // is a positive value.
00074         float StringLine; 
00075 
00081         enum THotSpot 
00082         {
00083                 BottomLeft=0,
00084                 MiddleLeft, 
00085                 TopLeft,
00086                 MiddleBottom, 
00087                 MiddleMiddle, 
00088                 MiddleTop, 
00089                 BottomRight, 
00090                 MiddleRight,
00091                 TopRight,
00092 
00093                 HotSpotCount
00094         };
00095 
00099         CComputedString()
00100         {
00101                 StringWidth = 0;
00102                 StringHeight = 0;
00103                 Vertices.setVertexFormat (CVertexBuffer::PositionFlag | CVertexBuffer::TexCoord0Flag);
00104                 VerticesClipped.setVertexFormat (CVertexBuffer::PositionFlag | CVertexBuffer::TexCoord0Flag);
00105         }
00106 
00111         CVector getHotSpotVector(THotSpot hotspot);
00112 
00123         void render2D (IDriver& driver, 
00124                                         float x, float z,
00125                                         THotSpot hotspot = BottomLeft,
00126                                         float scaleX = 1, float scaleZ = 1,
00127                                         float rotateY = 0);
00128 
00129         // Hotspot = bottomLeft
00130         void render2DClip (IDriver& driver, 
00131                                         float x, float z,
00132                                         float xmin=0, float ymin=0, float xmax=1, float ymax=1);
00133 
00140         void render3D (IDriver& driver,CMatrix matrix,THotSpot hotspot = MiddleMiddle);
00141 
00142 };
00143 
00144 
00145 
00146 } // NL3D
00147 
00148 
00149 #endif // NL_COMPUTED_STRING_H
00150 
00151 /* End of computed_string.h */
00152