Java Help Needed!
Hi, i''m programming an RTS (real-time-strategy) game in
java, and I have a couple of questions:
1. how do i efficiently and repeatedly load images onto the
screen (for vehicle movement, etc.)
2. how do i load sounds into my application? note - it is *NOT*
an applet so I cant use methods inherited from applet to do so.
3. is full screen mode more efficient than windowed mode?
Thanks in advance,
Amir
My friend told me that Java 1.4.1 has greatly improved bitmap stuff (faster and easier to use), so first step is to download that . As for question 3, I think you should make support for both because it''s not much more work.
(sorry for not being able to answer more.. haven''t used Java much for graphical applications)
(sorry for not being able to answer more.. haven''t used Java much for graphical applications)
For audio you could try:
Note that since newAudioClip is a static method of applet, you can use it even in a non-applet application.
It''s not perfect, and you''re probably better off looking for something that gives you a bit control, but it''s a start!
Hope this helps,
Enigma
java.applet.AudioClip audio = Applet.newAudioClip(url);audio.play();
Note that since newAudioClip is a static method of applet, you can use it even in a non-applet application.
It''s not perfect, and you''re probably better off looking for something that gives you a bit control, but it''s a start!
Hope this helps,
Enigma
Java Sound Homepage. Standard part of the platform since 1.3, much more flexible than AudioClip.
[edited by - wayfarerx on September 3, 2002 3:58:16 PM]
[edited by - wayfarerx on September 3, 2002 3:58:16 PM]
And how do I use full-screen mode in java?
another thing:
while trying to load images to the application, I found an
interesting phenomenon : I found out that creating a Swing ImageIcon with my file, then using its getImage method,
was actually faster than directly using Toolkit.getDefaultToolKit.getImage("fileName")!
why is this?
another thing:
while trying to load images to the application, I found an
interesting phenomenon : I found out that creating a Swing ImageIcon with my file, then using its getImage method,
was actually faster than directly using Toolkit.getDefaultToolKit.getImage("fileName")!
why is this?
The Java Tutorial has a section on full-screen exclusive mode. When you have questions like these, take some time to look around Sun''s site, they have a whole bunch of documentation available.
As for ImageIcon, this is from ImageIcon.java in the 1.4.0 sdk:
Look at src.zip in your jdk directory.
As for ImageIcon, this is from ImageIcon.java in the 1.4.0 sdk:
public ImageIcon(String filename, String description) { image = Toolkit.getDefaultToolkit().getImage(filename); if (image == null) { return; } this.filename = filename; this.description = description; loadImage(image);}
Look at src.zip in your jdk directory.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement