Back to Content
Windows (.exe) Target
When creating Windows .exe applications with CopperCube, there are some special features available:
Command Line Arguments
The single created .exe file offers some command line arguments when starting it:
- -windowed Forces the application to be started in windowed mode instead of fullscreen mode.
- -resolution:WIDTHxHEIGHT Forces the application to use the given resolution or window size. Use for example -resolution:800x600 for a resolution of 800x600
- -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.exe -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.exe -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
Using an icon
In the publishing settings, you can select an icon for your Windows app. Note that embedding the icon in your
app might slow down the publishing process by a few seconds, depending on your operating system. Also, some versions of Windows occasionally cause an error during this process, and you will get an "internal error" reported when you start testing your app from time to time. So during development, it is better not to select an icon.
Also note that this feature is not supported in the Mac OS X version of CopperCube.
Steam Support
Windows .exe apps created by CopperCube support Valve's Steam and have a built-in Steam integration.
In order to test it and develop your game with it, do the following:
- Have the Steam client running and be logged into the steam account which owns the game you are developing.
- Extract the two .dll files in this archive into the directory where your app is generated. Once you release your app on steam, you also need to include these files, of course.
- Create a text file named 'steam_appid.txt' in that directory with your steam store appid as text content.
You can then use the JavaScript functions ccbSteamSetAchievement and ccbSteamResetAchievements in order to set and reset steam achievements.
Windows Modes
Two window modes are supported: The "Exclusive / Fixed Size" window mode with a fixed size window and exclusive resolution in fullscreen mode, and a newer window mode which is known as "borderless windowed" or "dynamic / resizeable" mode. You can set which window mode you want in the publishing settings.
The default one, the "dynamic / resizeable" mode has a few advantages:
- In windowed (= non fullscreen) mode, the window is resizeable
- It is possible to switch between fullscreen and windowed mode during runtime easily at any time
- Fullscreen mode is now automatically sized to the resolution of the users screen
- Task switching between game and other apps is possible and very fast
- Switching to fullscreen at any time is now possible by clicking the 'maximize' window button
This mode is usually used by most modern games.
Making sure it runs on your users systems
Usually, .exe files generated by CopperCube run on all systems, but sometimes, they don't have DirectX installed. This will cause some shaders not to work and your game not to look that nice on the users PC. To ensure DirectX is installed on your users system, CopperCube has a very simple mechanism included in the .exe, which installs DirectX on your users system when it is not there. To enable this, follow these steps:
- Check the checkbox for "Include and run DirectX Installer when needed" in the publishing settings
- When publishing your app, CopperCube now will create a folder named 'dxredist' where your app is. When you distribute your app, be sure to include this folder together with your app (for example everything together in a .zip file).
- That's it. If DirectX is not installed on your users PC, your game will now install it at first startup.
Your game folder now should look like this:
If your CopperCube game now detects that DirectX is not installed, it will show the user a message box like this:
"This app needs DirectX to be installed. Install now?".
You can also change the text of this message box easily: In the 'dxredist' folder, create a text file named 'message.txt'. In there, type the message you would like to print instead.
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 a VisualStudio 2017 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. The code also includes the parts for the Oculus Rift support, but it is not supported (beta) and you likely need to adjust it to newer Oculus Rift SDKS.
If you want to let CopperCube generate the app from your own build of the source code, use the Custom Win32 binary .exe feature in the editor.
Custom Win32 binary .exe
You can select a custom Windows binary which the editor will use to create your app. It can have extended or modified functionality. You can likely download modified binaries from the internet, or create them yourself using C++ and the Source Code which is available in the Studio edition of CopperCube.
For this, select Tools -> Publishing Settings -> Windows .exe -> Custom Windows Binary. Note: This setting is not per project but global.
Be sure that you only select trustworthy binaries here. They can do harm to your computer.