I might try it on Android in a month or two, probably won't have time sooner.
I also have thought about replacing Float in Scala, a few thoughts:
You currently cannot do that very well (or you'll have to import an object every time to get the type). In Scala 2.8 you can define package level type aliases so there it will be a lot easier:
Code:
package object box2d {
type Float = FixedPoint // or type Float = Double
}
And every package under box2d will automatically see that type.
// NOTE: I'm not sure this will actually hide the type scala.Float, maybe it needs a different name?
What about literal definitions? 0.0f, 1.0f etc.? They can of course be implicitly converted from Float to a Fixed point type, but that might raise other performance issues?
I think (but not sure) the only possibility to have literals be of the right type too is to introduce a compiler plug-in to add a new suffix to number literals. for example 10s would be replaced with 10f, 10d, or FixedPoint(10).
Or actually 10.s might be just as fast for a fixedpoint class, but it will be slower for primitives. if the s method is defined like this:
Code:
class FixedPoint(v: Int) {
def s = this
}
implicit def int2fixedpoint(v: Int) = FixedPoint(v)
Maybe we could even do units with this? meters, seconds etc.? Probably not worth it.
What do you think? A compiler plug-in requirement would probably be too much of a hindrance for using the library, but I'm starting to like the second option. it may make primitives slower, or compile time inlining might eliminate most of the problems... would have to test this.