[SDL] sdl and java

Ryan C. Gordon icculus at clutteredmind.org
Thu Aug 22 02:18:01 PDT 2002


> Can you use sdl with java? does anyone know of any examples?

This was my meager attempt at it:
  http://cvs.icculus.org/horde/chora/cvs.php/last/toby/turtlespace/sdl?rt=toby_rewrite_3

It crashed a lot; not sure if my native code was buggy or JNI was
buggy...but I did get a surface and rendered some lines to the screen
before the crashes, so it CAN be done.

The basic gist:

  public class MyJavaClass
  {
     static { System.loadLibrary("MyNativeCodeLibrary"); }

     private static native void myNativeFunction();


     public static void main(String args[])
     {
          MyJavaClass x = new MyJavaClass();
          x.myNativeFunction();
     }
  }


Look at the C file and the sh script for the voodoo you need to do to
build a shared library under Linux.

--ryan.







More information about the SDL mailing list