Skip to content
Domagoj Štrekelj edited this page Dec 10, 2016 · 41 revisions

Kha uses a javascript file called khafile.js where you configure your project. A basic khafile.js looks like this:

var project = new Project('ProjectName');

project.addAssets('Assets/**');
project.addSources('Sources');

resolve(project);

This set the Assets and Source folders, and use the default configuration for other options.

##Available options for the project:

Set the Assets folder:

project.addAssets('Assets/**');

Set the Source folder:

project.addSources('Sources');

You can use multiple source folders, including external folders.

Add a library to the project:

project.addLibrary('Kha2D');

The library needs to be in a folder called 'Libraries' in the root of your project, or can be a haxelib library.

Set a Shader folder:

project.addShaders('Sources/Shaders/**');

Set a Compiler Flag:

project.addParameter('-dce full');

Set a Conditional Compililation Flag:

project.addDefine('debug_collisions');

Set the initial window size in flash and html5:

project.windowOptions.width = 1366;
project.windowOptions.height = 768;

Set specific options for the flash target:

project.targetOptions.flash.swfVersion = 11.6;
project.targetOptions.flash.framerate = 42;
project.targetOptions.flash.stageBackground = 'ff0000';

Set specific options for the android-native target:

project.targetOptions.android_native.package = 'com.example.app';
project.targetOptions.android_native.screenOrientation = 'portrait';

Set specific options for the android (Java) target:

project.targetOptions.android.package = 'com.example.app';
project.targetOptions.android.screenOrientation = 'portrait';

Set specific options for the iOS target:

project.targetOptions.ios.bundle = 'com.example.$(PRODUCT_NAME:rfc1034identifier)';
project.targetOptions.ios.organizationName = 'Your Awesome Organization';

Set specific options for the HTML5 target:

project.targetOptions.html5.canvasId = 'my-custom-canvas-id';
project.targetOptions.html5.scriptName = 'my-custom-script-name';
project.targetOptions.html5.webgl = false;
Clone this wiki locally