Archive for February, 2012
Adding Slick 2D and lwjgl to Eclipse Project
Posted by Randy in Java, Programming on February 23, 2012
I spent some time today trying to get Slick and the light-weight java game library setup correctly in Eclipse. The tutorial I was watching was in Netbeans and I was very unfamiliar with adding libraries to a Java project in Eclipse (very familiar now). I’m going to go over how to do this as an overview, mainly just to remind me how to do it later hehe. It may also be of use to others who don’t need a step by step picture guide of the process. So, here goes!
- Create a new project in Eclipse
- Right-click the project and choose New -> Folder (call it “lib”)
- Right-click the lib folder and choose Import… then General -> File System
- Browse to your slick folder and choose the slick.jar and the lwjgl.jar files.
- Right-click on the project and choose Properties
- Choose “Java Build Path” and click the “Libraries” tab
- Click “Add Jars”. It will show a tree of your project. Expand it till you see your lib folder. Expand it. Select the two jars (utilize shift for multiple selection). Click OK.
- Click OK again to go out to the workspace.
- Right-click on the lib folder and Import again. This time use “Archive File” instead of “File System”. Click Next.
- Browse to your slick lib folder and find “natives-win32.jar”. Click open.
- It will list some dlls on the right column. Make sure they are all checked and click finish.
- Repeat steps 9-11 and add the natives for mac and linux the same way if you want them.
- Now you need to add those natives to lwjgl. So…
- Right-click on the project and choose properties.
- In the Java Build Path -> Libraries tab, expand lwjgw.jar and click on Native library location.
- Click Edit. Click Workspace. Navigate to the lib folder, choose it, and click OK.
- NOW ALMOST THERE!
- Back in the Java Build Path -> Libraries, expand slick.jar. Click JavaDoc location.
- Click Edit. Set the javadoc location path to the location of the slick\javadoc folder.
Step 20… Add a class to your project and see if it will compile correctly. Here’s an example for testing.
GameTest.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | import org.newdawn.slick.AppGameContainer; import org.newdawn.slick.BasicGame; import org.newdawn.slick.GameContainer; import org.newdawn.slick.Graphics; import org.newdawn.slick.SlickException; public class Game extends BasicGame { public Game(String title) { super(title); } public static void main(String[] args) throws SlickException { AppGameContainer app = new AppGameContainer(new Game("Test Game")); app.start(); } @Override public void render(GameContainer container, Graphics g) throws SlickException { g.drawString("Hello, World!", 0, 100); } @Override public void init(GameContainer container) throws SlickException { } @Override public void update(GameContainer container, int delta) throws SlickException { } } |
Another Music Post
Posted by Randy in Boring Stuff, Music, Reviews on February 5, 2012
The other day I wrote an alcohol-influenced post about royalty free corporate music in video games and movies. I have another observation about music in regard to television shows. Today I started watching Star Trek: Enterprise on Netflix. This series was canceled after four seasons. After only a few episodes, I can say that I really like the show, and I wonder why it failed as a series.
Of course, you can probably guess where I’m going with this if you’ve ever seen the show. The opening title music is terrible. It’s terrible enough to kill the show. The song isn’t so bad on it’s own merit, but it’s awful for a Star Trek series. The theme music for the original Star Trek and the Next Generation was great. Why didn’t they work on a form of that same theme. A variant which sounded either older, clumsier, or simpler, perhaps a single instrument rendition of the theme, would have been better. I feel, it would have made a difference in the overall show performance.
Getting rid of Hiccups
Posted by Randy in Boring Stuff, Tips, Uncategorized on February 4, 2012
I found a secret to the universe some years ago as I discovered the secret to getting rid of hiccups. I could tell you how to do it, but I can’t. The reason I can’t tell you right now is because I’m intoxicated by Samuel Adams Boston Lager. When I’m drunk, I can’t control my hiccups. It’s the only time I can’t control my hiccups by the way. It’s a good indicator that I’ve been drinking too much. At any rate, when I’m sober, it’s easy to control my hiccups. It consists primarily with controlling my breathing. You must take deep controlled breaths and make sure that you concentrate on the exhalation of air. It has to be slow and controlled. You have to concentrate on breathing hard and holding the hiccups back. It’s hard for me to describe how it’s done at the moment because I’m drunk and unable to perform the task, but it will be something that I can talk about more in later posts. This is no old-wives-tell cure for hiccups. I can honestly stop hiccups at will.