I certainly hope so. :
Here’s the code:
public static void main(String[] arguments) {
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
//NameDialog dialog = new NameDialog(env);
//while (name == null || name.length()==0) name = dialog.name;
//dialog = null;
client = new HSClient();
contactServer = false;
int err = 0;
GameWindow game = new GameWindow();
try {
game.start(640, 480, 16, true);
} catch (Exception e) {
err = 1;
e.printStackTrace();
}
System.out.println("Game Ended.");
System.exit(err);
}
which calls the following, which is code from the BaseWindow class from the examples:
protected void createGLWindow(int width, int height, int bits, boolean fullscreenflag) throws Exception {
fullscreen = fullscreenflag;
try {
int mode = -1;
DisplayMode[] modes = Display.getAvailableDisplayModes();
for (int i = 0; i < modes.length; i ++) {
if( modes[i].width == width &&
modes[i].height == height &&
modes[i].bpp >= bits) {
mode = i;
break;
}
}
Display.create(modes[mode], fullscreenflag);
gl = new GL();
gl.create();
glu = new GLU(gl);
Keyboard.create();
Keyboard.enableBuffer();
Mouse.create();
//Mouse.enableBuffer();
resizeGLScene(Display.getWidth(), Display.getHeight());
initGL();
}
catch (Exception e) {
throw new Exception("Problem initialising ", e);
}
}
protected void start(int width, int height, int bpp, boolean fullscreen) throws Exception {
long frameTime = 0;
timerRes = Sys.getTimerResolution();
if (timerRes == 0) {
throw new Exception("There are no timers availible!");
}
try {
createGLWindow(width, height, bpp, fullscreen);
do {
/* The frameTime is how much time it takes to draw a single frame.
* We use this so we can animate things in real time.
*
* Say you want to move an object 100 pixels every second and it
* takes 0.10 seconds to draw a frame. Pixels per second
* multiplied by the frame time equals the amount of pixels to move
* per frame. or 100 * 0.10 = 10; */
frameTime = Sys.getTime();
/* Reset the counter, so we can find out how long it takes to draw a
* frame */
Sys.setTime(0);
}
while (!loop((float)frameTime / (float)timerRes));
System.out.println("Loop ended.");
killGLWindow();
}
catch (Exception e) {
throw new Exception("Problem starting loop", e);
}
}
Why would this all of the sudden stop working on my desktop at work and at my co-worker’s pc? It still worked yesterday on both…
Like I said, it just quits. I return to desktop. The program doesn’t even exit normally (no ‘Game Ended.’ in the log, no error, no nothing). The complete VM seems to just stop after having loaded all textures without an apparent reason.
The only big thing I changed the hack that the AudioClips are not static anymore which prevents the hic-ups when shooting, but also causes the sample to be loaded for every instance of a PlayerFire object.
(This was meant as a temporary hack until I successfully avoided using AudioClip).
Greetings,
Erik