74 lines
2.1 KiB
C
74 lines
2.1 KiB
C
#pragma once
|
|
|
|
struct SVertexBar
|
|
{
|
|
FLOAT x, y, z;
|
|
DWORD dwColor;
|
|
};
|
|
|
|
const DWORD c_dwFVFBar= D3DFVF_XYZ|D3DFVF_DIFFUSE;
|
|
|
|
SVertexBar g_VertBar[]=
|
|
{
|
|
{ -1.0f, -1.0f, 5.0f, 0xff000000 },
|
|
{ -1.0f, 1.0f, 5.0f, 0xff000000 },
|
|
{ 1.0f, -1.0f, 5.0f, 0xff000000 },
|
|
{ 1.0f, 1.0f,5.0f, 0xff000000 },
|
|
};
|
|
|
|
void RenderBars()
|
|
{
|
|
g_d3d_device->SetRenderState( D3DRS_LIGHTING, FALSE );
|
|
g_d3d_device->SetRenderState( D3DRS_ZENABLE, FALSE );
|
|
|
|
g_d3d_device->SetRenderState( D3DRS_ALPHATESTENABLE, FALSE );
|
|
g_d3d_device->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );
|
|
|
|
g_d3d_device->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
|
|
|
|
g_d3d_device->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_DIFFUSE );
|
|
g_d3d_device->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
|
|
g_d3d_device->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
|
|
|
|
g_d3d_device->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 );
|
|
g_d3d_device->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE );
|
|
|
|
D3DXMATRIX mat;
|
|
D3DXMatrixOrthoLH(
|
|
&mat,
|
|
(float)c_iScreenSizeX,
|
|
-(float)c_iScreenSizeY,
|
|
1.0f,
|
|
8.0f );
|
|
|
|
g_d3d_device->SetTransform( D3DTS_PROJECTION, &mat );
|
|
|
|
D3DXMatrixIdentity( &mat );
|
|
g_d3d_device->SetTransform( D3DTS_VIEW, &mat );
|
|
g_d3d_device->SetTransform( D3DTS_WORLD, &mat );
|
|
|
|
|
|
float fBarHeight= (float)( c_iScreenSizeY - c_iRealScreenY ) * 0.5f;
|
|
for( int i= -1; i <= 1; i+= 2 )
|
|
{
|
|
g_VertBar[ 0 ].x= -(float)c_iScreenSizeX * 0.5f - 10.0f;
|
|
g_VertBar[ 0 ].y= (float)i * ( (float)c_iScreenSizeY * 0.5f + 10.0f );
|
|
g_VertBar[ 1 ].x= -(float)c_iScreenSizeX * 0.5f - 10.0f;
|
|
g_VertBar[ 1 ].y= (float)i * ( (float)c_iScreenSizeY * 0.5f - fBarHeight );
|
|
g_VertBar[ 2 ].x= (float)c_iScreenSizeX * 0.5f + 10.0f;
|
|
g_VertBar[ 2 ].y= (float)i * ( (float)c_iScreenSizeY * 0.5f + 10.0f );
|
|
g_VertBar[ 3 ].x= (float)c_iScreenSizeX * 0.5f + 10.0f;
|
|
g_VertBar[ 3 ].y= (float)i * ( (float)c_iScreenSizeY * 0.5f - fBarHeight );
|
|
|
|
g_d3d_device->SetFVF( c_dwFVFBar );
|
|
g_d3d_device->DrawPrimitiveUP(
|
|
D3DPT_TRIANGLESTRIP,
|
|
2,
|
|
g_VertBar,
|
|
sizeof( SVertexBar )
|
|
);
|
|
}
|
|
|
|
}
|
|
|