Quote:
Originally Posted by EricVanWyk
I'm having a little trouble following exactly what you are trying to accomplish: could you provide example inputs and what you want as an output?
I've included a few options, all assume that rollover is 100.
Which of the following behaviors is correct?
1) 112 becomes 12
2) 112 becomes 100
|
That's the trouble. I want it to roll in both directions. Say I'm working with degrees, so I have the rollover set to 360. I need it to reset back to zero when it turns past 359, but I also need it to go to 359 when it goes past zero if it's turning the other direction.
Quote:
Originally Posted by EricVanWyk
Perhaps pulling dx into your function would make it easier, as you can use it's sign without having to guess.
Also, would it help to temporarily use a 32bit int to avoid overflow, and then truncate back down?
|
I'll consider that, and see what I can do without too much hinderance to modification.