Comments on Going mobile with Buzz Grid

2 Comments.

int blah = (int)(1.0 + myIntValue);

should work fine. Java implicitly upcasts between numerics; it’s only downcasting that you have to be explicit about. Even if you have to explicitly cast you should never have to create a temporary.

J2ME is not worth targeting anymore, but porting from J2ME to Android shouldn’t be too difficult. Android uses J2SE which is a superset of J2ME, and there are MIDP stacks for Android to make it even easier to port although I think those cost money (but I think the Android Canvas API is pretty similar to MIDP’s).

-- fluffy 2017-10-12 06:54 UTC


Believe me, fluffy, it was nowhere near that simple. I’ll mail you the code if you want. Briefly, the problem is that if you have a / b * c, where a and b are integers, and only c is a float, Java will look at each individual subexpression, therefore a / b will undergo integer division!

And I’m targeting J2ME because 1) that’s the kind of phone I have, 2) I’m finding it hard to learn yet another platform and 3) the control scheme pretty much requires a keyboard. You know I’m not a fan of touchscreens.

Also, yes, there is a MIDP emulator for Android. Last time I checked, it was very incomplete, never mind the license.

-- Felix 2017-10-12 06:54 UTC