Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Newbie & Debugging Questions / Re: Disabling the Anti-Aliasing in LWJGL/Slick2d Textures on: 2012-02-19 02:00:33
Thanks for clearing that up, its all working fine now!
2  Game Development / Newbie & Debugging Questions / [SOLVED] Disabling the Anti-Aliasing in LWJGL/Slick2d Textures on: 2012-02-18 18:53:05
I've discovered that LWJGL automatically has anti-aliasing active for 2d textures imported through Slick2d. I've been digging around and found that supposedly GL_TEXTURE_MAG_FILTER controls it, but I'm not sure how to disable it, and GL11.glDisable(GL_TEXTURE_MAG_FILTER); didn't work.

If anyone's tried disabling the anti-aliasing before and knows how, your help is greatly appreciated!
3  Game Development / Newbie & Debugging Questions / Re: sound compiling problem - sound doesn't play in jar on: 2011-11-21 23:37:47
Question 1) Does the game work fine, from your jar, without sound? Are you able to load graphics for example?

Question 2) Do you get an error message?

There are a bunch of ways things can go wrong. Here's a new one I just learned:

Don't use InputStream. Load via the URL, directly to your AudioInputStream. In the following code example, the commented out is the way I used to load sounds, and it doesn't work with Java 7. But the URL form is fine, as InputStream (which throws an exception if the files are not 'markable') is not a factor.

[EDIT: Ack! The class "AudioSystem" is just the name of the class that this code happens to be located in. The file name is a relative address, for example: "audio/beep.wav".]
1  
2  
3  
4  
5  
//      AudioInputStream ais = AudioSystem.getAudioInputStream(
//            AudioMixer.class.getResourceAsStream(fileName));

      URL url = AudioMixer.class.getResource(fileName);
      AudioInputStream ais = AudioSystem.getAudioInputStream(url);


But, it could very well be a problem with addressing resources. (That is why I asked #1.)
Or, you could have an error message that would tell us all. (Run the jar from a cmd prompt, and it will give you error messages.)

I changed my code so that it worked that way and now its working in the compiled jar.
Also that's interesting about toURI(), that seems to be the case that it doesn't compile.

Well, anyway, it works now and thank you all! Everything else about the game is mostly working, so I may post it in the showcase soon (when it's ready).
4  Game Development / Newbie & Debugging Questions / Re: sound compiling problem - sound doesn't play in jar on: 2011-11-20 21:34:24
I get no error messages. The jar works fine up until the point where it tries to run the method for sound, then everything hangs.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
public Sound() throws LineUnavailableException, UnsupportedAudioFileException, IOException, URISyntaxException {
     
      InputStream in;
      try {
     
      in = new FileInputStream(new File(this.getClass().getResource("/music/Castle.au").toURI()));
      AudioStream as = new AudioStream(in);
      AudioPlayer.player.start(as);        
     
      } catch (FileNotFoundException e) {
         e.printStackTrace();
      }

   }


That's about all I know how to do though. I've had years of coding in school, but the teacher only ever collects our src folder for a project, I'm quite the noob with running jars and programs through cmd, and it's pretty much impossible to find anything useful with a search.

I tried exporting it using "JAR File" but I can't figure out how to make it work and when I tried to use cmd to run it (I tried both the runnable jar and the jar file types with cmd) using java -jar<path> command it told me java was not a recognized as an internal or external command, operable program, or batch file.


5  Game Development / Newbie & Debugging Questions / Re: java sun.audio sound compiling problem - no sound on: 2011-11-19 23:19:34
Sorry for replying so late to a pretty much dead thread, I got fed up with fixing the sound and worked on other more important parts of my game, but now I'm back at the sound problem and if anyone can specifically help me with this it would be appreciated greatly.

Thank you for all the ideas, I've decided to use sampled because I'd rather not import a new library right now.

I'm using java.sound.sampled.* and I have all my code right, nothing is wrong with it, and everything is working.
Pardon my oversight on whatever it is I'm missing because, though I'm not new to java at all, I'm relatively new to compiling and whatnot.

Basic problem:
Everything runs just fine in Eclipse. Sound plays and everything.
When I compile all of it into a jar file using the following process and settings, it runs but plays no sound and then freezes.
 http://gyazo.com/203ebffccd5c77d07604e022d2a8a6cb

I do not want to use a different program, eclipse works just fine for me and I'm comfortable with it.
I'm not going to use any external libraries for this project or change my WORKING code.
And all of the files are IN the jar. Where they need to be. I use the same file retrieval method for sprites and loading levels. It works before and after compiling.

I would simply like some help with compiling the jar file so that it works.
Any help with the compiling would be greatly appreciated.

Thanks,
Chibi
6  Game Development / Newbie & Debugging Questions / [SOLVED] sound compiling problem - sound doesn't play in jar on: 2011-10-25 20:04:20
I'm having problems getting sound to work with my java game. (I'm not using the lwjgl b/c I didn't know about it when I started, but I'm definitely going to use it for my next project  Cranky )

When I run the game in Eclipse, everything works how it's supposed to, but when I compile into a runnable jar, sound doesn't play. I also would like help making it loop, but the important part right now is that I get it working  Tongue

here is the current code I'm using, I create a new musicPlayer class at the beginning then call playMusic when I want to play a song and give it the file location in my project (ex: playMusic(music/Title.au); )



import sun.audio.*;
import java.io.*;

@SuppressWarnings("restriction")
    public class musicPlayer{
       AudioStream as;
       InputStream in;
       
       public musicPlayer(){
       }
       
       
       
        public void playMusic(String fna){
           
          try {
          in = new FileInputStream(new File(this.getClass().getResource(fna).toURI()));
          
          as = new AudioStream(in);
          
          AudioPlayer.player.start(as);
          
          
          } catch (FileNotFoundException e) {
             e.printStackTrace();
          } catch (IOException e) {
             e.printStackTrace();
          } catch (URISyntaxException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
         }
        }
        public void stopMusic(){
           AudioPlayer.player.stop(as);
        }
       
       
    }



I also have a screenshot of my project files so you can see where I have them stored in the src folder:

http://gyazo.com/9ad0ee0537666cbac19060c564a0be7c

the classes are in the default package and the tracks I want to play are in the music folder


Any and all help/ recommendations/ redirection/ ideas are appreciated!
Pages: [1]
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (85 views)
2013-05-17 21:29:12

alaslipknot (93 views)
2013-05-16 21:24:48

gouessej (125 views)
2013-05-16 00:53:38

gouessej (118 views)
2013-05-16 00:17:58

theagentd (128 views)
2013-05-15 15:01:13

theagentd (115 views)
2013-05-15 15:00:54

StreetDoggy (159 views)
2013-05-14 15:56:26

kutucuk (181 views)
2013-05-12 17:10:36

kutucuk (181 views)
2013-05-12 15:36:09

UnluckyDevil (188 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.069 seconds with 21 queries.