[Release] Slider Bar!
Since Nubzgetkillz posted his method of a progress bar, I got inspired to make my own sliding bar. I whipped it up pretty quickly. Like no need for classes. It could be done easier, but you can fix that if you want. So here it is!
Classe:
[PHP]class dSlider
{
public:
int barx;
bool Focused;
void SliderBase(int x, int y, int BaseWidth, int BaseHeight, LPDIRECT3DDEVICE9 pDevice);
};[/PHP]
Function:
[PHP]void dSlider::SliderBase(int x, int y, int BaseWidth, int BaseHeight, LPDIRECT3DDEVICE9 pDevice)
{
barx = x;
if(Focused)
{
if(BarX < x-4-10)
{
if(GetAsyncKeyState(VK_RIGHT)<0)
BarX++;
}
if(BarX > !x)
{
if(GetAsyncKeyState(VK_LEFT)<0)
BarX--;
}
//cDrawText(char *Text, int x, int y, char *FontName, D3DCOLOR FontColor, int FontWidth, int FontHeight, UINT Weight, IDirect3DDevice9* pDevice)
d3d.cDrawText("Test", 0, 0, "Tahoma", D3DCOLOR_XRGB(255,0,0), 6, 16, FW_BOLD, pDevice);
}
if(GetAsyncKeyState(VK_NUMPAD1)&1)
Focused =! Focused; //You could put this under a menu item
//DrawBox(int x, int y, int w, int h, int borderw, D3DCOLOR BoxColor, D3DCOLOR BorderColor, IDirect3DDevice9* pDevice)
d3d.DrawBox(x, y, BaseWidth, BaseHeight, 1, D3DCOLOR_XRGB(0,0,0), D3DCOLOR_XRGB(0,255,0), pDevice);
d3d.DrawBox(BarX+100+2, y+2, 10, BaseHeight-4, 1, D3DCOLOR_XRGB(0,0,0), D3DCOLOR_XRGB(255,255,255), pDevice);
}[/PHP]
Press thanks if you used!
Classe:
[PHP]class dSlider
{
public:
int barx;
bool Focused;
void SliderBase(int x, int y, int BaseWidth, int BaseHeight, LPDIRECT3DDEVICE9 pDevice);
};[/PHP]
Function:
[PHP]void dSlider::SliderBase(int x, int y, int BaseWidth, int BaseHeight, LPDIRECT3DDEVICE9 pDevice)
{
barx = x;
if(Focused)
{
if(BarX < x-4-10)
{
if(GetAsyncKeyState(VK_RIGHT)<0)
BarX++;
}
if(BarX > !x)
{
if(GetAsyncKeyState(VK_LEFT)<0)
BarX--;
}
//cDrawText(char *Text, int x, int y, char *FontName, D3DCOLOR FontColor, int FontWidth, int FontHeight, UINT Weight, IDirect3DDevice9* pDevice)
d3d.cDrawText("Test", 0, 0, "Tahoma", D3DCOLOR_XRGB(255,0,0), 6, 16, FW_BOLD, pDevice);
}
if(GetAsyncKeyState(VK_NUMPAD1)&1)
Focused =! Focused; //You could put this under a menu item
//DrawBox(int x, int y, int w, int h, int borderw, D3DCOLOR BoxColor, D3DCOLOR BorderColor, IDirect3DDevice9* pDevice)
d3d.DrawBox(x, y, BaseWidth, BaseHeight, 1, D3DCOLOR_XRGB(0,0,0), D3DCOLOR_XRGB(0,255,0), pDevice);
d3d.DrawBox(BarX+100+2, y+2, 10, BaseHeight-4, 1, D3DCOLOR_XRGB(0,0,0), D3DCOLOR_XRGB(255,255,255), pDevice);
}[/PHP]
Press thanks if you used!
