進出口設立一個進度條如下:縮放進度條值
void CProgressBar::add(int ammount)
{
mProgress += ammount;
}
float CProgressBar::get()
{
float pr = (float)mProgress * 100.0f/(float)mMax;
return pr;
}
而現在這裏是problem.I'm試圖呈現一個小面雖然它不正確填充它,因爲我可以「T 弄清楚如何正確縮放值:
/*
Progress bar box has size of 128x16
|-----------|
|-----------|
*/
float progress = progressBar->get();
float scale = 4.0f; //Here i have it hardcoded although i have to make this generic
progress *= scale;
graphics->color(prgColor);
graphics->renderQd(CRect(x,y,progress,height));
這樣的IM親切詢問對此事的一些幫助......
這是一個C++問題,而不是C,C#或其他任何問題。請僅選擇相關標籤 – Shai 2012-02-15 13:10:17