I’m currently playing around with JME-in-a-jar. Everything works fine, I am trying out how small I can get the jars.
Windows only:
http://gonzo.uni-weimar.de/~scheffl2/applet/test.html
This example takes 2.8 mb without textures, including jme, LWJGL and windows natives. I extracted windows-natives.jar from the natives.jar. This saves over 2 mb download for the linux and mac native binaries.
Has anybody created a method for automatically loading the correct native jar for the client OS?
I know this can be done by CGI by looking at the user-agent string, but can it be done by JavaScript, too?
Cheers,
Martin
If you're planning to use webstart than I beleive that can be defined in the jnlp file that way.
OK, I wrote some JavaScript:
script>
function getNativesJar() {
if(navigator.userAgent.indexOf('Win') != -1) {
return "windows_natives.jar";
}
else if(navigator.userAgent.indexOf('Mac') != -1) {
return "macosx_natives.jar";
}
else {
return "linux_natives.jar";
}
}
var appletstr='<applet code="de.flowdev.applettest.AppletMyTest" archive="';
appletstr += getNativesJar();
appletstr += ',lwjgl_util_applet.jar,lwjgl.jar,sjme.jar,sapp.jar" width="800" height="600">'
document.write(appletstr);
</script>
BTW: IE7 complains about all java applets now? I get a blocker bar complaining about activeX and scripts being blocked. wtf? Only because ActiveX is shitty, doesn't mean Java is, too!
I can only test this with windows, could someone on a mac and linux box test this?
http://gonzo.uni-weimar.de/~scheffl2/applet/test.html
Didn't notice you were talking about an applet.
I just ran in Linux, took a bit to load but ran fine. got about 124fps w/ radeon x1400 laptop card
Tried in windows and got a class version error. Might be targetted only to java 1.6?
right, it was 1.6. Didn't think of that… fixed.