I can't get Sys.alert() to display a message after Display.create() fails
try {
Sys.alert("test", "Before create");
Display.create();
Sys.alert("test", "Success");
} catch (LWJGLException e) {
Sys.alert("test", "Failure");
}
On an openGl enabled machine I got two alerts => "Before create" => "Success"
On a non-openGL enabled machine I got one alert => "Before create"
but nothing more.
I need Sys.alert() to work because I won't have any other means to show an user a message in case he doesn't meet the requirements.
BTW - Alien Flux (very old version though) does show an alert after display.create() fails. So it is possible. But I can't see what I do wrong. The code above is all I do. Any ideas?
Exception? Native crash? Hang (check with 'ctrl-\')? OS version?
- elias
No hang, No exception, no crash since everything runs as supposed, i.e it goes into the catch block and finishes there, except that it does not bring up the alert window.
Os: Win 98 on a non-accelerated graphics card.
To make it a little more clear here a modified code:
try {
Sys.alert("test", "Before create");
Display.create();
Sys.alert("test", "Success");
} catch (LWJGLException e) {
System.out.println("Catch block entered");
Sys.alert("test", "Failure");
e.printStackTrace();
}
Has following result: an alert window shows up displaying "Before create" and then following output:
Catch block entered
org.lwjgl.LWJGLException: Could not apply pixel format to window
at org.lwjgl.opengl.Win32Display.createWindow(Native Method)
at org.lwjgl.opengl.Display.createWindow(Display.java:218)
at org.lwjgl.opengl.Display.create(Display.java:533)
at org.lwjgl.opengl.Display.create(Display.java:507)
at com.levelfactory.game.desktop.test.TestSys.main(TestSys.java:21)
but no alert saying "Failure" shows up
I'm using lwjgl .94
Try 0.95. I fixed a bug regarding Sys.alert in that release.
- elias
Nope, sorry, that's not it. I also checked 0.93 with same outcome. BUT:
I downloaded as a test the current AlienFlux demo. Same result here: no warning message whatsoever, the game just doesn't run (bad for business :( ). But the old version of AF I have does indeed bring up the alert. So I checked my code again using the very old version 0.90 of lwjgl (with Window.create() instead of Display.create) and voila: here finally as supposed two alerts are showing up including the "Failure" warning.
So a bug seemed to be introduced somewhere between 0.90 and 0.93.
I found the bug and it's fixed in CVS now.
- elias
Thanks a lot, that was fast.
One question: I checked out the source from CVS. I ran the ant build file but I guess I need some sort of c++ toolkit in order to compile the dlls, right? (I don't have one, in that case I'll better wait for the next release.)
yeah - but this is all included in Mac & linux. For windows the easiest option is to use the free Microsoft compiler kit: http://msdn.microsoft.com/visualc/vctoolkit2003/
You don't happen to have a current build available, do you?
Sure:
http://odense.kollegienet.dk/~naur/lwjgl.dll
- elias
Thanks! Sys.alert works now :)