Sign in to follow this  
idoska

colorkey in j2me?

Recommended Posts

Hi everyone, im new here,i hope somebody can help me with this... im downloading everything for make games in j2me, i have some litle experience in 2d games using SDL and DX with C/C++, so as far as now, i dont have a lot of dificulties follow docs for making games in j2me. im making something... but in some examples that i have, the problem is that the image that i just load dont use any colorkey, so i dont know the code for use any kind of colorkey or something like that in this code : public void addFrame(int frameno, String path) { try { sprites[frameno]=Image.createImage(path); //path is "/imagex.png" for example } catch (IOException e) { System.err.println("Can`t load the image " + path + ": " + e.toString()); } } it some can put some code sample, its very welcome. :) , (a full j2me god game code it would be a very god blessing, i know it is very dificult to ask, never mind) so... how can i put a colorkey? maybe there is another way, like other api like DX or SDL if a dont want to render an specific color of the image. THANKS to ALL. but the way : its dificult to know a publisher that it may be interesting in sell your j2me game? (i mean a good game , not some basic not fun game),

Share this post


Link to post
Share on other sites
You don't code this kind of thing. The PNG format has support for transparency built-in, and that's what you'll want to use. So you need to create a PNG with transparency in the graphic editing software of your choice (Photoshop, Paint Shop Pro, The GIMP, etc.), and just load that image normally. Unless the phone doesn't support transparency at all (in all my experience I've only run into 1 phone that doesn't), you image will have a transparent element.
Another technique, if you limit yourself to MIDP 2.0 (or MIDP 1.0 using proprietary extensions where available), is to use pixel grabbing/drawing methods for this. Then you'll usually be dealing with ARGB color formats.

shmoove

PS: A nice online resource for J2ME can be found in Jason Lam's ebook.

shmoove

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this