Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7529799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:44:43+00:00 2026-05-30T04:44:43+00:00

Im setting up a progress bar as follows : void CProgressBar::add(int ammount) { mProgress

  • 0

Im setting up a progress bar as follows :

void CProgressBar::add(int ammount)
{
    mProgress += ammount;
}

float CProgressBar::get()
{
    float pr = (float)mProgress * 100.0f / (float)mMax;
    return pr;
}

And now here is the problem.I’m trying to render a small surface although it doesn’t properly fill it because i can’t
figure out how to scale properly the value :

/*
    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));

So im kindly asking for some help on the matter…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T04:44:44+00:00Added an answer on May 30, 2026 at 4:44 am

    You have to linearly interpolate between the width of the rectangle with 0% progress and the width of the rectangle with 100% progress. E.G:

    float width_0 = 0.f; // or any other number of pixels
    float width_100 = 250.f; // or any other number of pixels
    

    The interpolation works as follows:

    float interpolated_width = (width_100 - width_0) * progress + width_0;
    

    Important: progress has to be in the range of 0 to 1! So you might want to change the CProgressBar::get() function or divide by 100 first.

    Now you can just render the rectangle with the new width:

    graphics->renderQd(CRect(x,y,interpolated_width,height));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Setting onchange event for CheckBoxList using the following code doesn't work. chkListUserGroup.Attributes.Add(onchange, document.forms[0].isRecordModified.value='true';); How
I have a dead simple progress bar using something like the following: import sys
I have a progress bar bound to 2 integer values - One is the
I have a form with a progress bar and a cancel button which is
I am using C# and Windows Forms. I have a normal progress bar working
I have a JQuery progress bar I want to theme (documentation here ) dynamically:
Problem I have the following mark-up: <div id=progress-bar> <div id=step-1 class=active><p>1. Select Room</p></div> <div
I am attempting to alter the value of a progress bar in ExtJS, I
I have a progress bar and a text view inside of a frame layout.
I am trying to display an animated graphic identical to the indeterminate progress bar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.