Skip to content
Rafael Oliveira edited this page Jan 15, 2016 · 50 revisions

##Getting Started Kha supports a haxelib based workflow and a git based workflow. Using haxelib is easier and recommended when getting started with Kha. Using git is more robust and recommended when starting an actual project with Kha.

#haxelib haxelib comes with every regular install of Haxe. Install Kha using haxelib install kha.

To create a new Kha project run haxelib run kha --init inside of an empty directory. Now you can create some project files using for example haxelib run kha (will create a project for the system you're currently running) or haxelib run kha html5 (html5 project compile and run very fast) or haxelib run kha flash (flash currently has the best debugging support). Project files are by default created inside of a build subdirectory.

When using Windows you will eventually have to install Microsoft's dxwebsetup.exe. This is included in Kha's Kore/Tools/krafix subdirectory.

#git To use Kha's git based workflow you need git and node (v4.0+). Calls to the build system looks slightly different, instead of haxelib run kha you will have to call node Kha/make.

Installing NodeJS

You can get a copy of NodeJS on its site here and install it.

Update NodeJS

If you have NodeJS already installed make sure it's updated! You can do so with the following commands.

sudo npm cache clean -f
node --version
sudo npm install -g n
sudo n stable
node --version

Starting with Kha

Kha projects are usually handled using git submodules so that every dependency is properly versioned. Even the Haxe compiler itself is just a submodule.

If you want to add Kha as a submodule for your git project just use

git submodule add https://github.com/KTXSoftware/Kha
git submodule update --init --recursive

You can also clone the Empty project and start from it!

git clone --recursive https://github.com/KTXSoftware/Empty.git

Using Kha from one place

If you want to use only one clone of the Kha repository for all of your projects, you can clone Kha in a place in your system, and use this path when use Kha, like node <kha-path>/make. To get things easier, create a batch file or script with the complete command.
In Windows, this can be a .bat file on the windows folder with this:

@echo off
node <kha-path>\make %*

Updating Kha

If you want to update the Kha submodules in your repository you can do it with just this command!

git submodule foreach --recursive git pull origin master
Clone this wiki locally