Back to Content

Mac OS X (.app) Target

When creating Mac OS X .app applications with CopperCube, there are some special features available:


Command Line Arguments

The single created .app file offers some command line arguments when starting it:

Examples:

The following command line will start your application in windowed mode:
yourapplication.app/Contents/MacOS/yourapplication -windowed
The following will use a the script file 'myscript.js' instead of the compiled script and show the debugging console if some line of text is printed in your script. This is useful for example for developing the script file without the CopperCube editor.
yourapplication.app/Contents/MacOS/yourapplication -debug -script:myscript.js



Scripting with JavaScript

You can make your CopperCube 3D Mac OS .app scenes more interactive using a built-in scripting language named 'JavaScript'. If you want to use this feature, do the following steps:

Example:

Write this text in your .js file:
print("Hello World!");
When testing your 3D scene from the CopperCube editor, this will print the text 'Hello World' into the debug console.
CopperCube also provides a menu command so you can test if the syntax of your script is ok, use the Menu Command Tools -> Compile Main Script for this.

Development tip:

If you prefer to develop your script without the CopperCube Editor running, you can do this using the -debug and the -script: command line arguments. See Command Line Arguments for details.

Reference and Examples

There is a comprehensive JavaScript API scripting reference available in this documentation.
There is also a full example available: Movement with JavaScript.