Jump to content
  • Advertisement
Sign in to follow this  
Thomo

Floats and UpDown Controls

This topic is 4521 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to get some kind of windows control that will allow me to increment in fractions (floats). I tried trackbars but had no joy. Second attempt was to use updown boxes. The UD_ACCEL structure: typedef struct { UINT nSec; UINT nInc; } UDACCEL, *LPUDACCEL; expects an integer. I tried creating my own custom structure typedef struct { UINT nSec; float nInc; } UDACCEL2, *LPUDACCEL2; The compiler accepts it, but when I execute the app it increments with a strange value before crashing. Anyone know how I can increment in decimals (0.5) rather than ints or suggest a control that will allow me to do so. Thanks

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Convert the value to a float and divide it by some value before using it. For example if you want to increment by fourths, just imagine that the control is setting the number of fourths, then convert it into the actual units. 11 fourths = 11/4 = 2.75, like that.

Share this post


Link to post
Share on other sites
I am not sure this a control like this, but you could always just convert the integer into a float. If you wanted the values to be between 1.0f and 0.0f, you could just devide your integer by the maximum value.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!