97 if ( screen.
Width() >= 1280 ) {
205 Vector2 bais_add( -0.5f ,-0.5f );
273 for (
int i = 0; i <
Vertices.Count(); i++ ) {
280 unsigned long a = (unsigned)(
WWMath::Clamp( alpha, 0, 1 ) * 255.0f);
282 for (
int i = 0; i <
Colors.Count(); i++ ) {
290 for (
int i = 0; i <
Colors.Count(); i++ ) {
334 unsigned long* colors;
336 colors=
Colors.Uninitialized_Add();
338 colors=
Colors.Uninitialized_Add();
340 colors=
Colors.Uninitialized_Add();
342 colors=
Colors.Uninitialized_Add();
348 unsigned long* colors;
350 colors=
Colors.Uninitialized_Add();
352 colors=
Colors.Uninitialized_Add();
354 colors=
Colors.Uninitialized_Add();
356 colors=
Colors.Uninitialized_Add();
363 unsigned long* colors;
365 colors=
Colors.Uninitialized_Add();
367 colors=
Colors.Uninitialized_Add();
369 colors=
Colors.Uninitialized_Add();
371 colors=
Colors.Uninitialized_Add();
378 unsigned short * indices;
381 indices=
Indices.Uninitialized_Add();
382 *indices = start_vert_index + 1;
383 indices=
Indices.Uninitialized_Add();
384 *indices = start_vert_index + 0;
385 indices=
Indices.Uninitialized_Add();
386 *indices = start_vert_index + 2;
388 indices=
Indices.Uninitialized_Add();
389 *indices = start_vert_index + 1;
390 indices=
Indices.Uninitialized_Add();
391 *indices = start_vert_index + 2;
392 indices=
Indices.Uninitialized_Add();
393 *indices = start_vert_index + 3;
395 indices=
Indices.Uninitialized_Add();
396 *indices = start_vert_index + 0;
397 indices=
Indices.Uninitialized_Add();
398 *indices = start_vert_index + 1;
399 indices=
Indices.Uninitialized_Add();
400 *indices = start_vert_index + 2;
402 indices=
Indices.Uninitialized_Add();
403 *indices = start_vert_index + 2;
404 indices=
Indices.Uninitialized_Add();
405 *indices = start_vert_index + 1;
406 indices=
Indices.Uninitialized_Add();
407 *indices = start_vert_index + 3;
492 int old_vert_count =
Vertices.Count();
513 *
Colors.Uninitialized_Add()=color;
514 *
Colors.Uninitialized_Add()=color;
515 *
Colors.Uninitialized_Add()=color;
518 *
Indices.Uninitialized_Add()=old_vert_count + 0;
519 *
Indices.Uninitialized_Add()=old_vert_count + 1;
520 *
Indices.Uninitialized_Add()=old_vert_count + 2;
532 float temp = corner_offset.
X;
533 corner_offset.
X = corner_offset.
Y;
534 corner_offset.
Y = -temp;
536 corner_offset *= width / 2;
538 Add_Quad( a - corner_offset, a + corner_offset, b - corner_offset, b + corner_offset, uv, color );
552 float temp = corner_offset.
X;
553 corner_offset.
X = corner_offset.
Y;
554 corner_offset.
Y = -temp;
556 corner_offset *= width / 2;
558 Add_Quad_HGradient( a - corner_offset, a + corner_offset, b - corner_offset, b + corner_offset, uv, color,color2);
568 if( border_width > 0 )
575 if( border_width > 0 )
577 fill_rect.
Left += border_width + 1;
578 fill_rect.
Top += border_width + 1;
579 fill_rect.
Right -= border_width - 1;
580 fill_rect.
Bottom -= border_width - 1;
620 int width, height, bits;
623 D3DVIEWPORT8 vp = { 0 };
662 for (
int i=0; i<
Indices.Count(); i++)
717 ClipRect(0, 0, 0, 0),
718 IsClippedEnabled(
false)
738 ClipRect.Set (0, 0, 0, 0);
739 IsClippedEnabled =
false;
746 if ( Font !=
NULL ) {
752 BlockUV.Inflate(
Vector2(-BlockUV.Width()/4, -BlockUV.Height()/4) );
760void Render2DTextClass::Draw_Char( WCHAR ch,
unsigned long color )
768 bool is_clipped =
false;
769 if ( IsClippedEnabled &&
770 (Cursor.
X < ClipRect.
Left ||
771 Cursor.
X + char_spacing > ClipRect.
Right ||
772 Cursor.
Y < ClipRect.
Top ||
773 Cursor.
Y + char_height > ClipRect.
Bottom))
778 if ( ch != (WCHAR)
' ' && !is_clipped ) {
779 RectClass screen( Cursor.X, Cursor.Y, Cursor.X + Font->Char_Width(ch), Cursor.Y + char_height );
786 DrawExtents += screen;
787 TotalExtents += screen;
789 Cursor.X += char_spacing;
805 DrawExtents =
RectClass( Location, Location );
806 if ( TotalExtents.Width() == 0 ) {
807 TotalExtents =
RectClass( Location, Location );
814 bool wrap = ( ch == (WCHAR)
'\n' );
817 if ( ch == (WCHAR)
' ' && WrapWidth > 0 ) {
818 const WCHAR * word = text;
819 float word_width = Font->Char_Spacing(ch);
820 while ( (*word != (WCHAR)0) && (*word > (WCHAR)
' ') ) {
821 word_width += Font->Char_Spacing(*word++);
823 wrap = ( (Cursor.X + word_width) >= (Location.X + WrapWidth) );
827 Cursor.Y += Font->Char_Height();
828 Cursor.X = Location.X;
832 Draw_Char( ch, color );
844 TotalExtents += screen;
849 Vector2 extent (0, Font->Char_Height());
855 if ( ch != (WCHAR)
'\n' ) {
856 extent.
X += Font->Char_Spacing( ch );
static void Set_World_Identity()
static void Set_Vertex_Buffer(const VertexBufferClass *vb, unsigned stream=0)
static void Set_Texture(unsigned stage, TextureBaseClass *texture)
static void Set_View_Identity()
static const DX8Caps * Get_Current_Caps()
static void Set_DX8_Texture_Stage_State(unsigned stage, D3DTEXTURESTAGESTATETYPE state, unsigned value)
static void Set_Index_Buffer(const IndexBufferClass *ib, unsigned short index_base_offset)
static void Draw_Triangles(unsigned buffer_type, unsigned short start_index, unsigned short polygon_count, unsigned short min_vertex_index, unsigned short vertex_count)
static void Set_Viewport(CONST D3DVIEWPORT8 *pViewport)
static void Set_Material(const VertexMaterialClass *material)
static void Set_Shader(const ShaderClass &shader)
static void Get_Transform(D3DTRANSFORMSTATETYPE transform, Matrix4x4 &m)
static void Set_Transform(D3DTRANSFORMSTATETYPE transform, const Matrix4x4 &m)
static void Apply_Render_State_Changes()
static void Set_DX8_Render_State(D3DRENDERSTATETYPE state, unsigned value)
unsigned short * Get_Index_Array()
VertexFormatXYZNDUV2 * Get_Formatted_Vertex_Array()
const FVFInfoClass & FVF_Info() const
unsigned Get_Tex_Offset(unsigned int n) const
unsigned Get_FVF_Size() const
unsigned Get_Diffuse_Offset() const
unsigned Get_Location_Offset() const
float Char_Spacing(WCHAR ch) const
float Char_Height(void) const
WWINLINE void Release_Ref(void) const
void Enable_Additive(bool b)
void Enable_Grayscale(bool b)
added for generals to draw disabled button states - MW
void Internal_Add_Quad_UVs(const RectClass &uv)
void Add_Rect(const RectClass &rect, float border_width=1.0F, uint32 border_color=0xFF000000, uint32 fill_color=0xFFFFFFFF)
void Internal_Add_Quad_Colors(unsigned long color)
void Move(const Vector2 &a)
Vector2 PreAllocatedUVCoordinates[60]
void Add_Quad(const Vector2 &v0, const Vector2 &v1, const Vector2 &v2, const Vector2 &v3, const RectClass &uv, unsigned long color=0xFFFFFFFF)
void Set_Coordinate_Range(const RectClass &range)
static void Set_Screen_Resolution(const RectClass &screen)
void Add_Outline(const RectClass &rect, float width=1.0F, unsigned long color=0xFFFFFFFF)
DynamicVectorClass< unsigned short > Indices
void Enable_Alpha(bool b)
void Internal_Add_Quad_Indicies(int start_vert_index, bool backfaced=false)
void Force_Color(int color)
Vector2 PreAllocatedVertices[60]
void Internal_Add_Quad_Vertices(const Vector2 &v0, const Vector2 &v1, const Vector2 &v2, const Vector2 &v3)
void Add_Quad_Backfaced(const Vector2 &v0, const Vector2 &v1, const Vector2 &v2, const Vector2 &v3, const RectClass &uv, unsigned long color=0xFFFFFFFF)
DynamicVectorClass< Vector2 > UVCoordinates
void Add_Quad_VGradient(const Vector2 &v0, const Vector2 &v1, const Vector2 &v2, const Vector2 &v3, const RectClass &uv, unsigned long top_color, unsigned long bottom_color)
unsigned long PreAllocatedColors[60]
static const RectClass & Get_Screen_Resolution(void)
void Set_Texture(TextureClass *tex)
DynamicVectorClass< Vector2 > Vertices
unsigned short PreAllocatedIndices[60]
Vector2 BiasedCoordinateOffset
void Add_Line(const Vector2 &a, const Vector2 &b, float width, unsigned long color=0xFFFFFFFF)
void Add_Quad_HGradient(const Vector2 &v0, const Vector2 &v1, const Vector2 &v2, const Vector2 &v3, const RectClass &uv, unsigned long left_color, unsigned long right_color)
void Internal_Add_Quad_VColors(unsigned long color1, unsigned long color2)
void Add_Tri(const Vector2 &v0, const Vector2 &v1, const Vector2 &v2, const Vector2 &uv0, const Vector2 &uv1, const Vector2 &uv2, unsigned long color=0xFFFFFFFF)
Render2DClass(TextureClass *tex=NULL)
DynamicVectorClass< unsigned long > Colors
void Internal_Add_Quad_HColors(unsigned long color1, unsigned long color2)
virtual ~Render2DClass(void)
void Force_Alpha(float alpha)
static RectClass ScreenResolution
void Enable_Texturing(bool b)
static ShaderClass Get_Default_Shader(void)
Vector2 Convert_Vert(const Vector2 &v)
void Set_Font(Font3DInstanceClass *font)
void Draw_Block(const RectClass &screen, unsigned long color=0xFFFFFFFF)
Render2DTextClass(Font3DInstanceClass *font=NULL)
Vector2 Get_Text_Extents(const WCHAR *text)
void Draw_Text(const char *text, unsigned long color=0xFFFFFFFF)
void Set_Texturing(TexturingType x)
static ShaderClass _PresetOpaqueShader
void Set_Src_Blend_Func(SrcBlendFuncType x)
void Set_Depth_Compare(DepthCompareType x)
void Set_Depth_Mask(DepthMaskType x)
void Set_Primary_Gradient(PriGradientType x)
void Set_Fog_Func(FogFuncType x)
void Set_Dst_Blend_Func(DstBlendFuncType x)
@ DSTBLEND_ONE_MINUS_SRC_ALPHA
WWINLINE void Normalize(void)
static VertexMaterialClass * Get_Preset(PresetType type)
virtual TextureClass * Get_Texture(const char *filename, MipCountType mip_level_count=MIP_LEVELS_ALL, WW3DFormat texture_format=WW3D_FORMAT_UNKNOWN, bool allow_compression=true, TextureBaseClass::TexAssetType type=TextureBaseClass::TEX_REGULAR, bool allow_reduction=true)
static WW3DAssetManager * Get_Instance(void)
static void Get_Device_Resolution(int &set_w, int &set_h, int &get_bits, bool &get_windowed)
static bool Is_Screen_UV_Biased(void)
static float Clamp(float val, float min=0.0f, float max=1.0f)
static float Floor(float val)
bool Convert_From(const char *text)
int IndexBufferExceptionFunc(void)
const unsigned dynamic_fvf_type
@ BUFFER_TYPE_DYNAMIC_DX8
#define REF_PTR_RELEASE(x)
#define REF_PTR_SET(dst, src)
#define WWMEMLOG(category)