Uzman Üye
Tüm Oyunlarda Kullanılıyor
/////////////////////////////////////////////////////////////////////////////////////////////////////
Umarım İşe Yarar size
Alıntılıdır...
PHP:
void HealthBar2DBox(int x, int y, int w, int h, int Health, LPDIRECT3DDEVICE9 pDevice)
{
Border(x, y, w, h, 1, RED, pDevice);
float HP = Health;
if (Health > 100)
{
HP = 100;
}
int r = (100 - HP) * 2.55, g = HP * 2.55;
DWORD Col = D3DCOLOR_ARGB(100, r, g, 0);
float Height = h - 3;
float HealthBox = Height / 100;
float hBox = HealthBox * HP;
Box(x + 2, y + h - 1, w - 3, -hBox, Col, pDevice);
}
PHP:
void HealthBox(int x, int y, int w, int h, D3DCOLOR ColorOne, D3DCOLOR ColorTwo, IDirect3DDevice9* pDevice)
{
struct CUSTOMVERTEX
{
float x, y, w, h;
DWORD color;
};
D3DVERTEX vertices[] =
{
{ x, y, w, h, ColorOne },
{ x + w, y, w, h, ColorTwo },
{ x - 10, y + h, w, h, ColorOne },
{ x + w-10, y + h, w, h, ColorTwo }
};
pDevice->SetTexture(0, NULL);
pDevice->SetPixelShader(0);
pDevice->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE);
pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, true);
pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
pDevice->SetRenderState(D3DRS_ZENABLE, FALSE);
pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
pDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, vertices, sizeof(D3DVERTEX));
}
Alıntılıdır...
Son düzenleme: