Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


[java] images in java games


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 pekkert   Members   -  Reputation: 122

Like
Likes
Like

Posted 23 August 2000 - 07:39 PM

hi i am trying to make a game in java , it is going to be a 2D iso game to be played over the net for FREE. i have been looking at the AWT , java2D , JAI to find the red tread in java image handling, but i cant seem to find it. i really need good advice to the use of images in java. if i use to many features in the 3 API''s , my performance get hanged. thanks Dennis

Sponsor:

#2 loserkid   Members   -  Reputation: 122

Like
Likes
Like

Posted 24 August 2000 - 05:21 AM

Hello;
Here''s how to use images in java (in an applet) :
    
//First delcare an image object (in java.awt.image):
Image img;

//Then in your init method of the applet gif or jpg images...

public void init() {
img = getImage("path/image.gif");
// or .. this gets the image where the code (class file) is.
img = getImage(getCodeBase(),"image.gif");
}

//then if you want to draw it on the screen...

public void paint(Graphics g) {
g.drawImage(img,x,y,null);
}


In the above code I''m assuming your planning to write an applet (you said "played over the net").
I suggest you use AWT because java2d is not supported on the browers (yet - without the plugin).
For full documentation on AWT go here.
Look for the Graphics class and Image class.

I hoped this helped a little ().

=============================
silly programmer vb is for kids.
============================
www.thejpsystem.com




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS