Cult3D Java API Documentation Java Startup class

How to implement Java into Cult3D

When programming Java for Cult3D you must declare one class to be your startup class, to do this you must implement the interface com.cult3d.Cult3DScript, and you must implement the method public void cult3dDestroy() in your class. The method cult3dDestroy() is called from the Cult3D Viewer when it is being shutdown, and is the perfect place to do cleanup and release resources.

When making your startup class for Cult3D you must do a public constructor which takes no argument, even if it does nothing. You must also make your startup class public.

When having several classes in your project you must use your startup class as a sort of a proxy. Let all your calls to other classes go through your startup class.

When you use Java packages let your startup class reside in the default package, more detail in Java Packages.

EXAMPLE CODE

>     The most basic Java class one can do.

>     import com.cult3d.Cult3DScript;

>     //Your public startup class for your Cult3D Project which implements the interface com.cult3d.Cult3DScript
>     public class BasicSnippet implements Cult3DScript
>     {
>         // Standard constructor
>         public BasicSnippet()
>         {
>         }

>         // This method is called when the
>         // Cult3D viewer is being shutdown.
>         public void cult3dDestroy()
>         {
>         }
>     }

>     A proxy Java class

>     import com.cult3d.Cult3DScript;

>     //Your public startup class for your Cult3D Project which implements the interface com.cult3d.Cult3DScript
>     public class BasicSnippet implements Cult3DScript
>     {
>         // Your other class
>         private OtherClass x;

>         // Standard constructor
>         public BasicSnippet()
>         {
>             x = new OtherClass();
>         }

>         //This method is called from the Cult3D Designer, and it forwards a call
>         // to the other class's method startObject()
>         public void startObject(String s)
>         {
>             x.startObject();
>         }

>         // This method is called when the
>         // Cult3D viewer is being shutdown.
>         public void cult3dDestroy()
>         {
>         }
>     }