51 TextColor( 1.0f, 1.0f, 1.0f )
55 DefaultVertexMaterial->Set_Diffuse( 0, 0, 0 );
56 DefaultVertexMaterial->Set_Opacity(1);
57 DefaultVertexMaterial->Set_Emissive( 1, 1, 1 );
81 DefaultVertexMaterial->Release_Ref();
107 TranslateScale.X = (dest_lr.
X - dest_ul.
X) / (src_lr.
X - src_ul.
X);
108 TranslateScale.Y = (dest_lr.
Y - dest_ul.
Y) / (src_lr.
Y - src_ul.
Y);
109 TranslateOffset.X = dest_ul.
X - TranslateScale.X * src_ul.
X;
110 TranslateOffset.Y = dest_ul.
Y - TranslateScale.Y * src_ul.
Y;
112 PixelSize.X = fabs((src_lr.
X - src_ul.
X) / 640.0f);
113 PixelSize.Y = fabs((src_lr.
Y - src_ul.
Y) / 480.0f);
123 x0 = x0 * TranslateScale.X + TranslateOffset.X;
124 x1 = x1 * TranslateScale.X + TranslateOffset.X;
125 y0 = y0 * TranslateScale.Y + TranslateOffset.Y;
126 y1 = y1 * TranslateScale.Y + TranslateOffset.Y;
128 bool flip_faces = ((x1-x0) * (y1-y0)) > 0;
131 Vertex( x0, y0, 0, u0, v0);
133 Vertex( x1, y0, 0, u1, v0);
134 Vertex( x0, y1, 0, u0, v1);
136 Vertex( x0, y1, 0, u0, v1);
137 Vertex( x1, y0, 0, u1, v0);
139 Vertex( x1, y1, 0, u1, v1);
153 a.
X = _a.
X * TranslateScale.X + TranslateOffset.X;
154 a.
Y = _a.
Y * TranslateScale.Y + TranslateOffset.Y;
155 b.
X = _b.
X * TranslateScale.X + TranslateOffset.X;
156 b.
Y = _b.
Y * TranslateScale.Y + TranslateOffset.Y;
160 float temp = corner_offset.
X;
161 corner_offset.
X = corner_offset.
Y;
162 corner_offset.
Y = -temp;
164 corner_offset *= width / 2;
167 Vertex( a + corner_offset );
168 Vertex( a - corner_offset );
169 Vertex( b + corner_offset );
170 Vertex( b - corner_offset );
179 Line( a, a_, width );
183 Line( b, b_, width );
199 float total_width = 0.0f;
204 while (*message != 0) {
253 float screen_x0 = screen_x + spacing/2 - width/2;
254 screen_x0 = floor(screen_x0 / PixelSize.X + 0.5f) * PixelSize.X;
255 float screen_x1 = screen_x0 + width;
256 screen_x1 = floor(screen_x1 / PixelSize.X + 0.5f) * PixelSize.X;
257 float screen_y0 = screen_y;
258 screen_y0 = floor(screen_y0 / PixelSize.Y + 0.5f) * PixelSize.Y;
260 screen_y1 = floor(screen_y1 / PixelSize.Y + 0.5f) * PixelSize.Y;
263 screen_x0 += PixelSize.X / 2;
264 screen_x1 += PixelSize.X / 2;
265 screen_y0 += PixelSize.Y / 2;
266 screen_y1 += PixelSize.Y / 2;
282 Quad( screen_x0, screen_y0, screen_x1, screen_y1, font_uv.
Left, font_uv.
Top, font_uv.
Right, font_uv.
Bottom );
310 float total_width = 0.0f;
315 while (*message != 0) {
316 float width =
Print( font, *message++, screen_x, screen_y );
318 total_width += width;
338 float size_x = PixelSize.X * 256;
339 float size_y = PixelSize.Y * 256;
343 Quad( screen_x, screen_y, screen_x + size_x, screen_y + size_y *
WWMath::Sign( -TranslateScale.Y ) );
DynamicMeshClass(int max_poly, int max_vert)
void Reset_Mesh_Counters()
bool Vertex(float x, float y, float z, float u, float v)
int Set_Shader(const ShaderClass &shader, int pass=0)
int Set_Texture(int idx, int pass=0)
int Set_Vertex_Material(int idx, int pass=0)
void Begin_Tri_Strip(void)
float Char_Spacing(WCHAR ch) const
RectClass Char_UV(WCHAR ch)
TextureClass * Peek_Texture(void)
float Char_Width(WCHAR ch) const
float Char_Height(void) const
@ DSTBLEND_ONE_MINUS_SRC_ALPHA
void Quad(float x0, float y0, float x1, float y1, float u0=0, float v0=0, float u1=1, float v1=1)
float Print(Font3DInstanceClass *font, char ch, float screen_x, float screen_y)
void Show_Font(Font3DInstanceClass *font, float screen_x, float screen_y)
void Set_Coordinate_Ranges(const Vector2 ¶m_ul, const Vector2 ¶m_lr, const Vector2 &dest_ul, const Vector2 &dest_lr)
void Line(const Vector2 &a, const Vector2 &b, float width)
float Get_Width(Font3DInstanceClass *font, const char *message)
TextDrawClass(int max_chars)
float Get_Inter_Char_Width(Font3DInstanceClass *font)
float Get_Height(Font3DInstanceClass *font, const char *message="")
void Line_Ends(const Vector2 &a, const Vector2 &b, float width, float end_percent)
WWINLINE void Normalize(void)
static bool Is_Screen_UV_Biased(void)
static float Sign(float val)
static WWINLINE float Fabs(float val)