-
-
Notifications
You must be signed in to change notification settings - Fork 168
Getting Started
##Getting Started
Kha supports multiple workflows:
Using Kode Studio is the easiest way of getting started with Kha, followed by the haxelib workflow. Using git is more robust and recommended when starting an actual project with Kha.
#Kode Studio
Kode Studio is a fork of Visual Studio Code. It is a portable cross-platform IDE optimized for Kha development that comes bundled with a version of Kha and useful extensions. It features debugging support based on VSCode's Chrome debugger, Haxe's JavaScript target, and a modified Kha HTML5 target.
To get started with Kha and Kode Studio, download the build supported by your operating system:
From within Kode Studio, open an empty directory on your file system. Press F1
to open the VSCode command palette, then search for and execute Init Kha Project
. A project template should now be set up in your project directory.
To build the project, open up the command palette and execute Compile Kha Project
. If everything was set up correctly in the previous steps an empty black window should open up. Congratulations, you have just built your first Kha project! The result should be located in the build
directory at the root of your project folder. Note that Kode Studio builds HTML5 projects by default because its debugger is based on the HTML5 Kha target.
The version of Kha used by Kode Studio is located in [Kode Studio]/resources/app/extensions/kha/Kha
. However, Kode Studio can be configured to use a different one. This is done by opening up Kode Studio user settings (File > Preferences > User Settings
) and setting the kha.khaPath
property to the path of your desired Kha library version.
#git To use Kha's git based workflow you need git and node (v6.0+).
To create a new Kha project run node /path/to/Kha/make --init
inside of an empty directory. Now you can create some project files using for example node /path/to/Kha/make
(which will create a project for the system you're currently running) or node /path/to/Kha/make html5
(html5 projects compile and run very fast). 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.
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 npm 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 %*
Or on linux, a shell script:
#!/bin/bash
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
If you are using Kha from a separate place, use the above command in your Kha directory, and after this use this command to update Kha itself:
git pull origin master
otherwise only the submodules of Kha would be updated.
- Introduction
- Getting Started
- Breaking Changes
- FAQ
- System targets
- Graphics targets
- Documentation
- API package descriptions