Archive for February, 2012

Adding Slick 2D and lwjgl to Eclipse Project

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!

  1. Create a new project in Eclipse
  2. Right-click the project and choose New -> Folder (call it "lib")
  3. Right-click the lib folder and choose Import... then General -> File System
  4. Browse to your slick folder and choose the slick.jar and the lwjgl.jar files.
  5. Right-click on the project and choose Properties
  6. Choose "Java Build Path" and click the "Libraries" tab
  7. 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.
  8. Click OK again to go out to the workspace.
  9. Right-click on the lib folder and Import again. This time use "Archive File" instead of "File System". Click Next.
  10. Browse to your slick lib folder and find "natives-win32.jar". Click open.
  11. It will list some dlls on the right column. Make sure they are all checked and click finish.
  12. Repeat steps 9-11 and add the natives for mac and linux the same way if you want them.
  13. Now you need to add those natives to lwjgl. So...
  14. Right-click on the project and choose properties.
  15. In the Java Build Path -> Libraries tab, expand lwjgw.jar and click on Native library location.
  16. Click Edit. Click Workspace. Navigate to the lib folder, choose it, and click OK.
  17. NOW ALMOST THERE!
  18. Back in the Java Build Path -> Libraries, expand slick.jar. Click JavaDoc location.
  19. 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 {
 
	}
}

»crosslinked«

, , , ,

2 Comments

Linux Desktop UI Options

I'm detest the current path of the Linux desktop. There are reasons that the desktop environment programmers and the distribution makers have taken the path they are on, but I disagree with those reasons. Their reasoning involves unifying the user interface for desktops, laptops, tablets, and other mobile devices.

The main problem I see with that reasoning is that they are hurting the desktop environment in the process, and the desktop/laptop is the only place their products have a future. There's no need for a revamping of the desktop interface to make it more like a mobile device's interface. The tablet/phone interfaces are designed for multi-touch interaction from the user. THE ADVANTAGE of a DESKTOP is having a good keyboard and mouse. The desktop UI is designed for superior input methods. Mult-touch is cool and all, but it is designed to give mobile devices an interface to mimic what you can already do on the desktop and laptop with the keyboard and mouse. Multi-touch on a desktop is cool, but it has only been implemented on OS X on Macs, and they didn't change the actual interface itself to accomplish this. They just added multi-touch capability to the UI that was already there.

I could see good reason to make this change to the default Linux user interface if the distributions were going to be used primarily on mobile devices. BUT they aren't. The mobile market has two very strong operating systems. Those are iOS and Android. Android is Linux itself, but its user interface is perfect for a mobile device. It also has the convenience of the Google marketplace. It is the defacto Linux distro for mobile devices. There's no demand for Ubuntu on a mobile device like a tablet or phone. Android does everything you could want to do on those devices, and it does those things well.

So, what is the point to unify the user interface on the Linux distribution, if the only real use you're going to see for these distributions is in the desktop and laptop markets? There's absolutely no reason to do this.

The new unified user interface, namely Unity and Gnome 3, are clunky at best in a desktop environment. They are a downgrade from the previous user interfaces that were popular, especially Gnome 2.

For this reason, I see a shift in the primary desktop environment used by most Linux users. I think most users will switch to XFCE4 or one of the other DEs which were similar to Gnome 2. I would be willing to wager that within a year or two, most distributions will be using XFCE4 as a default desktop environment by popular demand from their userbase. Either that will happen, or the desktop environment creators will see the error of their ways and change back to the old desktop standard.

BRING BACK XORG and just improve it!

, ,

No Comments

Another Music Post

The other day I wrote an alcohol-influenced post about 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.

No Comments

Getting rid of Hiccups

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.

No Comments