Back to Content
MacOS (.app) Target
You can create Mac OS X .app applications with CopperCube. Because of a limit of the 3D engine in Mac OS X , this target has the shortcoming that selected font types for text on 2D Overlays are ignored. If you need a special font in this target, print it onto a texture and use this on the 2D Overlay. Otherwise, this target is fully functional.
But there are also some special features available:
Command Line Arguments
The single created .app file offers some command line arguments when starting it:
- -windowed Forces the application to be started in windowed mode instead of fullscreen mode.
- -debug Runs the application in debug mode. Makes the debug console visible for example, when an error happens or the
scripting environment pritns a line of text.
- -script:<file> Uses the given file as main script instead of the file compiled into the application.
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 Windows .exe scenes more interactive using a built-in scripting language named 'JavaScript'.
See the scripting overview for a detailed description how to use this feature.
Additionally on this target, you can use a separate script file to develop your scripts.
If you want to use this feature, do the following steps:
- Save your 3D scene to a file somewhere on your hard disk. For example to a file named test.ccb.
- Create a file named as your CopperCube file but with the extension '.js', for example test.js
- Edit this file with your favorite text editor (recommended: Notepad++, it
supports JavaScript syntax highlighting). When publishing your file now as Windows .exe, CopperCube will include this
script into the .exe file and use it as main script.
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
Source Code
If you want to extend the app with very specific custom features, you can do this by compiling the App yourself and programming your own additions. You can get the source code if you own the Studio Edition of CopperCube: In the editor, click Help -> About, and then the "Download C++ Source" button.
The code is an Xcode Project. It is based on the open source Irrlicht 3D engine and should be fairly easily to extend. A short documentation on how to build the package can be found in the root named documentation.txt.