• Advertisement
Sign in to follow this  

J2ME: Sprite, Layer VS hand-made classes...

This topic is 4023 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

Hi all, i want to know if there is a speed advantage in using J2ME classes like Sprite. Does it have some kind of "low level" access to images and buffers that i cannot achieve by making my own sprite class? In others words, are those clases (Sprite, Layer, etc) written in plain J2ME? For example, i can load an image 'mainCharacter.png' and use a combination of setClip and drawImage to draw a portion of that image on screen, does Sprite do the same thing when he draws a frame? or it has access to other functions that i dont?... I think the same applies to colition detection... if i want an efficient function, should i use those or write my own... (assuming i have the time and knowledge to implement and test my own code). Thanks bye!

Share this post


Link to post
Share on other sites
Advertisement
I suspect there is not anything particularly low-level about the Sprite class. Its just convenience -- it supplies a fairly common way to implement the sprite class and manage frames, etc. Its pretty close to the way I would do it myself. I doubt you could make it much faster. I also think you'd be hardpressed to improve on the collision detection. I think just about all of the game features of MIDP 2.0 are just convenience, ease for new developers. Probably all of it can be done by hand it MIDP 1.0. Whether some phone manufacturers find ways to accelerate those features is another matter.

Share this post


Link to post
Share on other sites
The pixel level collision detection probably has a "low-level boost". Other than that I agree with koder_b.

In fact, when the first MIDP 2.0 phones came out the LayerManager was notoriously slow. Sun's reference implementation drew all the tiles every time (even ones not on screen), and many of the older MIDP 2.0 phones didn't change this.

shmoove

Share this post


Link to post
Share on other sites
I´ve implemented a MIDP1.0 based GameAPI, and although it lacks some functionality from a real MIDP2.0 GameApi -mostly because the inherent limitations of MIDP1.0- (GameCanvas cannot get a graphics object, no sprite per pixel colision, and no sprite transformations outside devices with NokiaUI support) it runs at the same speed as 'true' GameAPI on a MIDP2.0 device. Said that, it´s good to know that it doesn´t necessarily prove anything, because I could only try the benchmark in a very limited range of phones, but supports koder_b and shmoove points.

Share this post


Link to post
Share on other sites
I'm fairly sure Sun provide the source code when you download WTK. Have a look in there, that should give you an idea on how it's implemented.

Share this post


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

  • Advertisement