RE: Vertical Progressbar
Something like this, you just need to change the way it goes, mine goes from left to right,
void DrawBar(Color color,Rect &rect,Flt frac,Flt frac2)
{
Flt min,max; MinMax(frac,frac2,min,max);
Rect inside=rect; inside.extend(-0.008f);
Images("gfx/bar/backbar.gfx" )->draw (rect);
Images("gfx/bar/progress.gfx")->drawPart(ColorAlpha(color,0.4f),color, inside.min.x,inside.max.y, inside.w()*max,inside.h(), 0,0,max,1);
Images("gfx/bar/progress.gfx")->drawPart( color ,color, inside.min.x,inside.max.y, inside.w()*min,inside.h(), 0,0,min,1);
Images("gfx/bar/border.gfx" )->draw (rect);
}
void DrawBars()
{
if(Players.elms())
{
Player &plr=Players[0];
// health
Flt health_frac=plr.health/plr.current_health_max;
static Flt health_frac_smooth; AdjustValTarget(health_frac_smooth,health_frac,Time.d()*0.4f);
DrawBar(RED,Rect_LD(-D.w()+0.05f,-D.h()+0.12f,0.4f,0.05f),health_frac,health_frac_smooth);
}
}
(This post was last modified: 06-22-2010 07:04 PM by Zervox.)
|