Say I\'ve got
SDL_Rect rect; rect.x = 5; // rect.x is of type \"Uint16\" int y = 11;
and I want to perform the operation rect.x/y
rect.x/y
Cast either rect.x or y to float, and then do the division. This will force the entire division operation to take place in floating point.
rect.x
y
float result = rect.x/(float)y; int rounded = ceil(result);