Haxe JS
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/TODO.md:
--------------------------------------------------------------------------------
1 | https://github.com/proletariatgames/HUGS
2 |
3 |
4 | https://github.com/proletariatgames/HUGS/blob/01906ea21ccd65ed61467a6628da37aab30152df/haxe/Log.hx#L46
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/docs/00setup/code/Source/Main.hx:
--------------------------------------------------------------------------------
1 | import unityengine.*;
2 |
3 | @:nativeGen
4 | class Main extends MonoBehaviour {
5 | var who:String;
6 |
7 | function Awake() {
8 | Debug.Log('Hello, $who!');
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/docs/img/npm-logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/01helloworld/code/Source/Main.hx:
--------------------------------------------------------------------------------
1 | package;
2 |
3 | import unityengine.*;
4 |
5 | @:nativeGen
6 | class Main extends MonoBehaviour {
7 |
8 | function Awake() {
9 | // logging via unity
10 | Debug.Log('[Unity] Hello world');
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/docs/06keep/code/Source/view/HideWhenPlaying.hx:
--------------------------------------------------------------------------------
1 | package view;
2 |
3 | import unityengine.MonoBehaviour;
4 |
5 | @:nativeGen
6 | @:keep
7 | class HideWhenPlaying extends MonoBehaviour {
8 | function Awake() {
9 | gameObject.SetActive(false);
10 | }
11 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
3 | # reminders and other personal stuff
4 | build.md
5 | 05externs/code/bin/out
6 | _test
7 |
8 | # ignore exe files and out folder
9 | 00helloworld/code/out
10 | docs/*/code/out
11 | docs/*/*/code/out
12 | # unity specifics
13 | docs/*/code/Assets/Code
14 |
--------------------------------------------------------------------------------
/docs/06keep/code/Source/Main.hx:
--------------------------------------------------------------------------------
1 | package;
2 |
3 | import unityengine.*;
4 |
5 | // make sure this class is transpiled into C#/cs
6 | import view.HideWhenPlaying;
7 |
8 | @:nativeGen
9 | class Main extends MonoBehaviour {
10 |
11 | function Awake() {
12 | Debug.Log('[Haxe] Main Awake()');
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/docs/06keep/code/build.hxml:
--------------------------------------------------------------------------------
1 | -cp Source
2 | -D net-ver=40
3 | # -net-lib C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll
4 | # -net-lib /Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll
5 | -net-lib /Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/Managed/UnityEngine.dll
6 | -cs Assets/Code
7 | -D no-compilation
8 | -D real-position
9 | Main
10 |
--------------------------------------------------------------------------------
/docs/08json/code/build.hxml:
--------------------------------------------------------------------------------
1 | -cp Source
2 | -D net-ver=40
3 | # -net-lib C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll
4 | # -net-lib /Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll
5 | -net-lib /Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/Managed/UnityEngine.dll
6 | -cs Assets/Code
7 | -D no-compilation
8 | -D real-position
9 | Main
10 |
--------------------------------------------------------------------------------
/docs/10json/code/build.hxml:
--------------------------------------------------------------------------------
1 | -cp Source
2 | -D net-ver=40
3 | # -net-lib C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll
4 | # -net-lib /Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll
5 | -net-lib /Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/Managed/UnityEngine.dll
6 | -cs Assets/Code
7 | -D no-compilation
8 | -D real-position
9 | Main
10 |
--------------------------------------------------------------------------------
/docs/00setup/code/build.hxml:
--------------------------------------------------------------------------------
1 | -cp Source
2 | -D net-ver=40
3 | # -net-lib C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll
4 | # -net-lib /Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll
5 | -net-lib /Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/Managed/UnityEngine.dll
6 | -cs Assets/Code
7 | -D no-compilation
8 | -D real-position
9 | Main
10 |
--------------------------------------------------------------------------------
/docs/02trace/code/build.hxml:
--------------------------------------------------------------------------------
1 | -cp Source
2 | -D net-ver=40
3 | # -net-lib C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll
4 | # -net-lib /Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll
5 | -net-lib /Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/Managed/UnityEngine.dll
6 | -cs Assets/Code
7 | -D no-compilation
8 | -D real-position
9 | Main
10 |
--------------------------------------------------------------------------------
/docs/02trace2/code/build.hxml:
--------------------------------------------------------------------------------
1 | -cp Source
2 | -D net-ver=40
3 | # -net-lib C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll
4 | # -net-lib /Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll
5 | -net-lib /Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/Managed/UnityEngine.dll
6 | -cs Assets/Code
7 | -D no-compilation
8 | -D real-position
9 | Main
10 |
--------------------------------------------------------------------------------
/docs/03writing/code/build.hxml:
--------------------------------------------------------------------------------
1 | -cp Source
2 | -D net-ver=40
3 | # -net-lib C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll
4 | # -net-lib /Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll
5 | -net-lib /Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/Managed/UnityEngine.dll
6 | -cs Assets/Code
7 | -D no-compilation
8 | -D real-position
9 | Main
10 |
--------------------------------------------------------------------------------
/docs/04reading/code/build.hxml:
--------------------------------------------------------------------------------
1 | -cp Source
2 | -D net-ver=40
3 | # -net-lib C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll
4 | # -net-lib /Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll
5 | -net-lib /Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/Managed/UnityEngine.dll
6 | -cs Assets/Code
7 | -D no-compilation
8 | -D real-position
9 | Main
10 |
--------------------------------------------------------------------------------
/docs/01helloworld/code/build.hxml:
--------------------------------------------------------------------------------
1 | -cp Source
2 | -D net-ver=40
3 | # -net-lib C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll
4 | # -net-lib /Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll
5 | -net-lib /Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/Managed/UnityEngine.dll
6 | -cs Assets/Code
7 | -D no-compilation
8 | -D real-position
9 | Main
10 |
--------------------------------------------------------------------------------
/docs/05haxelow/code/build.hxml:
--------------------------------------------------------------------------------
1 | -lib haxelow
2 | -cp Source
3 | -D net-ver=40
4 | # -net-lib C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll
5 | # -net-lib /Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll
6 | -net-lib /Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/Managed/UnityEngine.dll
7 | -cs Assets/Code
8 | -D no-compilation
9 | -D real-position
10 | Main
11 |
--------------------------------------------------------------------------------
/__book.json:
--------------------------------------------------------------------------------
1 | {
2 | "gitbook": ">=2.0.0",
3 | "structure": {
4 | "readme": "intro.md"
5 | },
6 | "plugins": ["edit-link","disqus","ga", "anchors"],
7 | "pluginsConfig": {
8 | "edit-link": {
9 | "base": "https://github.com/MatthijsKamstra/haxeandunity/blob/master/",
10 | "label": ""
11 | },
12 | "disqus": {
13 | "shortName": "haxe-and-unity"
14 | },
15 | "ga": {
16 | "token": "UA-67866831-8"
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/docs/haxe/code/test.js:
--------------------------------------------------------------------------------
1 | (function ($global) { "use strict";
2 | var Test = function() { };
3 | Test.main = function() {
4 | console.log("Test.hx:3:","Hello World !");
5 | };
6 | var haxe_iterators_ArrayIterator = function(array) {
7 | this.current = 0;
8 | this.array = array;
9 | };
10 | haxe_iterators_ArrayIterator.prototype = {
11 | hasNext: function() {
12 | return this.current < this.array.length;
13 | }
14 | ,next: function() {
15 | return this.array[this.current++];
16 | }
17 | };
18 | Test.main();
19 | })({});
20 |
--------------------------------------------------------------------------------
/docs/README.md:
--------------------------------------------------------------------------------
1 | # Haxe and Unity (C#)
2 |
3 | With most of the documentation I wrote, it was something that I needed. Because this type of documentation is valuable only when you have no idea how to start. It's the basic stuff that I run into when I start with a new Haxe target.
4 |
5 | I would suggest you would visit [Haxe and System Targets](https://matthijskamstra.github.io/haxesys/) as well because it covers the system targets and C# is that as well.
6 |
7 | This documentation is focussed on Unity and Haxe and specifics to get it working in with Unity.
8 |
--------------------------------------------------------------------------------
/docs/resources/more.md:
--------------------------------------------------------------------------------
1 | # More more more!!!!
2 |
3 | So you want more...
4 |
5 |
6 | ## Haxe and Node.js
7 |
8 | 
9 |
10 | [haxenode](http://matthijskamstra.github.io/haxenode/)
11 |
12 | ## Haxe and JavaScript
13 |
14 | 
15 |
16 | [haxejs](http://matthijskamstra.github.io/haxejs/)
17 |
18 | ## Haxe and PHP
19 |
20 | 
21 |
22 | [haxephp](http://matthijskamstra.github.io/haxephp/)
23 |
24 | ## Haxe and Python
25 |
26 | 
27 |
28 | [haxepython](http://matthijskamstra.github.io/haxepython/)
29 |
30 |
--------------------------------------------------------------------------------
/docs/02trace/code/Source/Main.hx:
--------------------------------------------------------------------------------
1 | package;
2 |
3 | import unityengine.*;
4 |
5 | import cs.system.Console;
6 |
7 | @:nativeGen
8 | class Main extends MonoBehaviour {
9 |
10 | function new (){
11 | super();
12 | }
13 |
14 | function Awake() {
15 | // write your own trace function suitable for Unity
16 | haxe.Log.trace = function(v:Dynamic, ?infos:haxe.PosInfos) {
17 | var str = infos.fileName + ":" + infos.lineNumber + ": " + v;
18 | Debug.Log(str);
19 | }
20 | }
21 |
22 | function Start() {
23 | // logging via unity
24 | Debug.Log('[Unity] Hello world');
25 | // logging via C#
26 | Console.WriteLine("[C#] Hello world");
27 | // logging via Haxe
28 | trace("[Haxe] Hello world");
29 | }
30 |
31 | static public function main() {
32 | var main = new Main();
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/docs/05haxelow/about.md:
--------------------------------------------------------------------------------
1 | # About
2 |
3 | There is always a need to store data, one way or another. In the example we store our data in a `.json` file.
4 |
5 | There is a better way to do something similar in Haxe.
6 |
7 | In this example we will use [haxelow](https://github.com/ciscoheat/haxelow)
8 |
9 | ```
10 | haxelib install haxelow
11 | ```
12 |
13 | Don't forget to add haxelow to your build.hxml.
14 |
15 | ```bash
16 | -lib haxelow
17 | ```
18 |
19 |
20 |
21 |
22 | ## When to use HaxeLow
23 |
24 | Straight from the lowdb docs:
25 |
26 | HaxeLow/lowdb is a convenient method for storing data without setting up a database server. It's fast enough and safe to be used as an embedded database.
27 |
28 | However, if you need high performance and scalability more than simplicity, you should stick to databases like MongoDB.
--------------------------------------------------------------------------------
/docs/01helloworld/about.md:
--------------------------------------------------------------------------------
1 | # About
2 |
3 | Hello world is the first thing you will write in a new language.
4 |
5 | > A "Hello, World!" program is a computer program that outputs "Hello, World!" (or some variant thereof) on a display device. Because it is typically one of the simplest programs possible in most programming languages, it is by tradition often used to illustrate to beginners the most basic syntax of a programming language. It is also used to verify that a language or system is operating correctly.
6 |
7 | Source [wikipedia](https://en.wikipedia.org/wiki/%22Hello,_World!%22_program)
8 |
9 |
10 | If you did the [Haxe basics](../haxe/hello-world.md) you already did a "Hello World".
11 | This one is a little more structured and more commented!
12 |
13 | Check the [code folder](https://github.com/MatthijsKamstra/haxejs/tree/master/00helloworld/code) for more comments.
14 |
15 | ----
16 |
17 | *Don't feel stupid, it's a thing ()*
18 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "haxeunity",
3 | "version": "1.0.0",
4 | "description": "Documenting Haxe and Unity/C#",
5 | "scripts": {
6 | "deploy": "npm run git:commit && npm run git:push",
7 | "git:commit": "git add -A . && git commit -a -m 'update docs haxejs documentation'",
8 | "git:push": "git push",
9 | "docsify:init": "npm install && npm docsify",
10 | "docsify": "cd docs && docsify serve"
11 | },
12 | "devDependencies": {},
13 | "repository": {
14 | "type": "git",
15 | "url": "git+https://github.com/MatthijsKamstra/haxeunity.git"
16 | },
17 | "keywords": [
18 | "js",
19 | "haxe",
20 | "Haxe",
21 | "cs",
22 | "csharp",
23 | "wip"
24 | ],
25 | "author": "Matthijs Kamstra aka [mck]",
26 | "license": "MIT",
27 | "bugs": {
28 | "url": "https://github.com/MatthijsKamstra/haxeunity/issues"
29 | },
30 | "homepage": "https://github.com/MatthijsKamstra/haxeunity#readme",
31 | "dependencies": {
32 | "docsify-cli": "^4.4.3"
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Haxe and Unity (C#)
2 |
3 | With most of the documentation I wrote, it was something that I needed. Because this type of documentation is valuable only when you have no idea how to start. It's the basic stuff that I run into when I start with a new Haxe target.
4 |
5 | I would suggest you would visit [Haxe and System Targets](https://matthijskamstra.github.io/haxesys/) as well because it covers the system targets and C# is that as well.
6 |
7 | This documentation is focussed on Unity and Haxe and specifics to get it working in with Unity.
8 |
9 | #### Visit [http://matthijskamstra.github.io/haxeunity/](http://matthijskamstra.github.io/haxeunity/)
10 |
11 |
12 | ## How to contribute?
13 |
14 | Read more about that [here](contribute.md).
15 | But it boils down to: **JUST DO IT!**
16 |
17 | #### Visit [https://github.com/MatthijsKamstra/haxeunity](https://github.com/MatthijsKamstra/haxeunity) to modify the "source" aka markdown files.
18 |
19 | Found any "bug" or have a great idea? Please create a [new issue](https://github.com/MatthijsKamstra/haxeunity/issues/new).
20 |
21 |
--------------------------------------------------------------------------------
/docs/02trace2/code/Source/Main.hx:
--------------------------------------------------------------------------------
1 | package;
2 |
3 | import unityengine.*;
4 |
5 | import cs.system.Console;
6 |
7 | @:nativeGen
8 | class Main extends MonoBehaviour {
9 |
10 | function new (){
11 | super();
12 | }
13 |
14 | function Awake() {
15 | // write your own trace function suitable for Unity
16 | haxe.Log.trace = function(v:Dynamic, ?infos:haxe.PosInfos) {
17 | var color = '#ff3333';
18 | if (infos.customParams != null && infos.customParams.length > 0) {
19 | // Debug.Log(infos.customParams[0]);
20 | color = infos.customParams[0];
21 | }
22 | var str = '${infos.fileName}:${infos.lineNumber}:${v}';
23 | Debug.Log(str);
24 | }
25 | // trace("hello green", 'green');
26 | // trace("hello red", 'red');
27 | }
28 |
29 | function Start() {
30 | // logging via unity
31 | Debug.Log('[Unity] Hello world');
32 | // logging via C#
33 | Console.WriteLine("[C#] Hello world");
34 | // logging via Haxe
35 | trace("[Haxe] Hello world");
36 | }
37 |
38 | static public function main() {
39 | var main = new Main();
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/docs/06keep/about.md:
--------------------------------------------------------------------------------
1 | # About
2 |
3 | This is a little bit weird subject that I am not sure how to name it.
4 |
5 | The idea is that it's possible to create classes that are not used by the Main class.
6 |
7 | Normally Haxe will not generate classes that you are not using. The same will happen with function you are not using.
8 |
9 | It's called [Dead Code Elimination or DCE](https://haxe.org/manual/cr-dce.html).
10 |
11 | > DCE has three modes which are set when invoking the command line:
12 | >
13 | > `-dce std`: Only classes in the Haxe Standard Library are affected by DCE. This is the default setting on all targets.
14 | > `-dce no`: No DCE is performed.
15 | > `-dce full`: All classes are affected by DCE.
16 |
17 | But because this is a really powerfull Haxe feature it's better to just make sure you have more controle over it.
18 |
19 | This chapter is about how you can "keep" the files you have written that can be used in Unity, but are not used in the "Main" class.
20 |
21 | In this case a class that you can attach to a gameobject that needs to be hidden when the application starts (placeholders for example)
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Matthijs Kamstra
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/docs/03writing/code/Source/Main.hx:
--------------------------------------------------------------------------------
1 | package;
2 |
3 | import haxe.io.*;
4 | import haxe.io.Path;
5 | import sys.io.File;
6 | import sys.FileSystem;
7 |
8 | import unityengine.*;
9 | import unityengine.Application;
10 |
11 | @:nativeGen
12 | class Main extends MonoBehaviour {
13 |
14 | function new (){
15 | super();
16 | }
17 |
18 | function Awake() {
19 | // write your own trace function suitable for Unity
20 | haxe.Log.trace = function(v:Dynamic, ?infos:haxe.PosInfos) {
21 | var str = infos.fileName + ":" + infos.lineNumber + ": " + v;
22 | Debug.Log(str);
23 | }
24 | }
25 |
26 | function Start() {
27 | trace('Writing example');
28 |
29 | var dataFileName:String = "hello.txt";
30 | var filePath = Path.join([Application.streamingAssetsPath, dataFileName]);
31 |
32 | // check if this folder exists, if not create!
33 | if(!FileSystem.exists(Application.streamingAssetsPath)){
34 | FileSystem.createDirectory(Application.streamingAssetsPath);
35 | trace('"StreamAssets"-folder created!');
36 | }
37 |
38 | var str:String = 'Hello World!\nWritten on: ' + Date.now().toString();
39 | File.saveContent(filePath, str);
40 |
41 | trace('${filePath} is generated');
42 | }
43 |
44 | static public function main() {
45 | var main = new Main();
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/docs/04reading/code/Source/Main.hx:
--------------------------------------------------------------------------------
1 | package;
2 |
3 | import haxe.io.*;
4 | import haxe.io.Path;
5 | import sys.io.File;
6 | import sys.FileSystem;
7 |
8 | import unityengine.*;
9 | import unityengine.Application;
10 |
11 | @:nativeGen
12 | class Main extends MonoBehaviour {
13 |
14 | function new (){
15 | super();
16 | }
17 |
18 | function Awake() {
19 | // write your own trace function suitable for Unity
20 | haxe.Log.trace = function(v:Dynamic, ?infos:haxe.PosInfos) {
21 | var str = infos.fileName + ":" + infos.lineNumber + ": " + v;
22 | Debug.Log(str);
23 | }
24 | }
25 |
26 | function Start() {
27 | trace("Reading and writing example");
28 |
29 | var dataFileName:String = "hello.txt";
30 | var filePath = Path.join([Application.streamingAssetsPath, dataFileName]);
31 |
32 | // check if this folder exists, if not create!
33 | if(!FileSystem.exists(Application.streamingAssetsPath)){
34 | FileSystem.createDirectory(Application.streamingAssetsPath);
35 | trace('"StreamAssets"-folder created!');
36 | }
37 |
38 | var str:String = 'Writing and reading a simple text file.!\nWritten on: ' + Date.now().toString();
39 | File.saveContent(filePath, str);
40 | trace('${filePath} is generated');
41 |
42 | // read the file
43 | var content = File.getContent(filePath);
44 | trace (content);
45 | }
46 |
47 | static public function main() {
48 | var main = new Main();
49 | }
50 | }
--------------------------------------------------------------------------------
/docs/haxecs/about.md:
--------------------------------------------------------------------------------
1 | # About haxeunity (Haxe, Unity and C#)
2 |
3 | 
4 |
5 | I was working on a Unity 3D project, and I was curious if I could get it to work with Haxe-C# target.
6 | To be clear, I know this could be called C# documentation as well, but I needed more info about the combination Haxe/Unity/C#.
7 | That is what I will be focusing on.
8 |
9 |
10 | ## What is Unity?
11 |
12 | > Start bringing your vision to life today. Unity’s real-time 3D development platform empowers you with all you need to create, operate, and monetize.
13 |
14 | Source:
15 |
16 | > Unity is a cross-platform game engine developed by Unity Technologies, first announced and released in June 2005 at Apple Inc.'s Worldwide Developers Conference as a Mac OS X-exclusive game engine. As of 2018, the engine had been extended to support more than 25 platforms.
17 |
18 | Source:
19 |
20 | ## What is C#?
21 |
22 | Might be helpful to know there are different ways of spelling C#:
23 |
24 | - cs
25 | - C#
26 | - C Sharp
27 |
28 | > C# is a general-purpose, multi-paradigm programming language encompassing strong typing, lexically scoped, imperative, declarative, functional, generic, object-oriented, and component-oriented programming disciplines.
29 |
30 | Source:
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/docs/_sidebar.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | - [Home](/)
4 | - [Introduction](intro.md)
5 | - [Haxe basics](haxe/about.md)
6 | - [Quick install](haxe/quick-install.md)
7 | - [Installation](haxe/installation.md)
8 | - [Code editor](haxe/choosing-a-code-editor.md)
9 | - [Hello world](haxe/hello-world.md)
10 | - [Learn Haxe](haxe/learn-haxe.md)
11 | - [Haxe and Unity/C#](haxecs/about.md)
12 | - [Download](haxecs/download.md)
13 | - [Resources](haxecs/resource.md)
14 | - [Setup Unity and Haxe](00setup/example.md)
15 | - [Example Hello World](01helloworld/about.md)
16 | - [How to](01helloworld/example.md)
17 | - [Setup trace](02trace/example.md)
18 | - [Setup trace color](02trace2/example.md)
19 | - [Example Writing](03writing/example.md)
20 | - [Example Reading](04reading/example.md)
21 | - [Example HaxeLow](05haxelow/about.md)
22 | - [How to](05haxelow/example.md)
23 | - [Example keep](06keep/about.md)
24 | - [How to](06keep/example.md)
25 | - [Example Json](08json/about.md)
26 | - [How to](08json/example.md)
27 | - [Example hxml](20build/example.md)
28 | - Resources
29 | - [Who to follow](resources/follow.md)
30 | - [More like this](resources/more.md)
31 | - [Try Haxe!](https://try.haxe.org/)
32 | - [Community](http://community.haxe.org/)
33 | - [Contribute](contribute.md)
34 | - [Source](https://github.com/MatthijsKamstra/haxeunity/)
35 | - [Suggestion Box](https://github.com/MatthijsKamstra/haxeunity/issues/2)
36 |
--------------------------------------------------------------------------------
/docs/img/haxe-logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/08json/about.md:
--------------------------------------------------------------------------------
1 | # About loading a json
2 |
3 | A very common way of loading data in your web-app is the use of `json` files.
4 |
5 | Haxe can handle [json](http://api.haxe.org/haxe/Json.html) cross-platform
6 |
7 | > Crossplatform JSON API : it will automatically use the optimized native API if available.
8 | > Use `-D haxeJSON` to force usage of the Haxe implementation even if a native API is found. This will provide extra encoding features such as enums (replaced by their index) and StringMaps.
9 |
10 | Some more information about json can be found on the classic
11 |
12 | > JSON: JavaScript Object Notation.
13 |
14 | > JSON is a syntax for storing and exchanging data.
15 |
16 | > JSON is an easier-to-use alternative to XML.
17 |
18 | ## What is JSON?
19 |
20 | - JSON stands for JavaScript Object Notation
21 | - JSON is a lightweight data-interchange format
22 | - JSON is language independent *
23 | - JSON is "self-describing" and easy to understand
24 |
25 | ## JSON Values
26 |
27 | JSON values can be:
28 |
29 | * A number (integer or floating point)
30 | * A string (in double quotes)
31 | * A Boolean (true or false)
32 | * An array (in square brackets)
33 | * An object (in curly braces)
34 | * A null
35 |
36 |
37 | ```
38 | {
39 | "number" : 0,
40 | "string" : "foobar",
41 | "bool" : true,
42 | "array" : ["one","two"],
43 | "object" : {
44 | "firstName":"John",
45 | "lastName":"Doe"
46 | },
47 | "null" : null
48 | }
49 |
50 |
51 | ```
52 |
--------------------------------------------------------------------------------
/docs/10json/about.md:
--------------------------------------------------------------------------------
1 | # About loading a json
2 |
3 | A very common way of loading data in your web-app is the use of `json` files.
4 |
5 | Haxe can handle [json](http://api.haxe.org/haxe/Json.html) cross-platform
6 |
7 | > Crossplatform JSON API : it will automatically use the optimized native API if available.
8 | > Use `-D haxeJSON` to force usage of the Haxe implementation even if a native API is found. This will provide extra encoding features such as enums (replaced by their index) and StringMaps.
9 |
10 | Some more information about json can be found on the classic
11 |
12 | > JSON: JavaScript Object Notation.
13 |
14 | > JSON is a syntax for storing and exchanging data.
15 |
16 | > JSON is an easier-to-use alternative to XML.
17 |
18 | ## What is JSON?
19 |
20 | - JSON stands for JavaScript Object Notation
21 | - JSON is a lightweight data-interchange format
22 | - JSON is language independent *
23 | - JSON is "self-describing" and easy to understand
24 |
25 | ## JSON Values
26 |
27 | JSON values can be:
28 |
29 | * A number (integer or floating point)
30 | * A string (in double quotes)
31 | * A Boolean (true or false)
32 | * An array (in square brackets)
33 | * An object (in curly braces)
34 | * A null
35 |
36 |
37 | ```
38 | {
39 | "number" : 0,
40 | "string" : "foobar",
41 | "bool" : true,
42 | "array" : ["one","two"],
43 | "object" : {
44 | "firstName":"John",
45 | "lastName":"Doe"
46 | },
47 | "null" : null
48 | }
49 |
50 |
51 | ```
52 |
--------------------------------------------------------------------------------
/docs/Docsify.md:
--------------------------------------------------------------------------------
1 | # Convert from Gitbook to Docsify
2 |
3 | I used Gitbook for generation of this documentation. However, recently I started looking for alternatives in case GitBook stops being free.
4 |
5 | The tools I had didn't work anymore, didn't want to make an login on the new platform.
6 |
7 | I have worked with docsify before and the migration is really easy.
8 |
9 | ## How to migrate to docsify.js?
10 |
11 | First Install docsify:
12 |
13 | ```bash
14 | npm i docsify-cli -g
15 | ```
16 |
17 | 1. Initialize docsify on your repo folder: `docsify init docs` (default gitlab will use `docs` folder for documentation)
18 | 2. Rename `summary.md` to `_sidebar.md` (yes, it’s that simple!)
19 | 3. Copy all the folders/files into `docs` folder
20 | 4. Add `loadSidebar: true` to `window.$docsify` in `index.html`
21 | 5. That’s all there is to it! Now run: `docsify serve`
22 | 6. And push it to Github.
23 | 7. update absolute links to new docs (`tree/master/` to `tree/master/docs/`)
24 |
25 | Specific for my documentation:
26 |
27 | - copy `readme.md` to docs
28 | - copy `.nojekyll` to docs (if not generated)
29 | - copy `index.html` to docs (if not generated)
30 | - copy `favicon.ico` to docs
31 | - update `index.html` the js: `window.$docsify`
32 | - copy data from `book.json` to `window.$docsify`
33 | - change `_sidebar.md` "example" to example
34 | - change `_sidebar.md` "How to" to "More info"
35 |
36 |
37 |
38 | ## Resource
39 |
40 | - https://docsify.js.org
41 | - https://timdams.com/2019/05/02/migrating-from-gitbook-to-docsify-js/
42 |
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Haxe and Unity
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/docs/haxe/hello-world.md:
--------------------------------------------------------------------------------
1 | # Hello world
2 |
3 | 
4 |
5 | Developing JavaScript code is easy with Haxe. Let's see our first HelloWorld example :
6 |
7 | ```haxe
8 | class Test {
9 | static function main() {
10 | trace("Hello World !");
11 | }
12 | }
13 | ```
14 |
15 | Put this class into a file named `Test.hx` and create the file `compile.hxml` in the same directory with the following content:
16 |
17 | ```
18 | -js test.js
19 | -main Test
20 | ```
21 |
22 | To compile open you terminal and type:
23 |
24 | cd
25 |
26 | And drag the folder where you saved the files, into the terminal.
27 | It will look something like this:
28 |
29 | cd /path/to/folder/
30 |
31 | Press enter and type:
32 |
33 | haxe compile.hxml
34 |
35 | If an error occurs, the terminal will display that.
36 | If everything went smoothly like it should, this will produce a `test.js` file that can be embedded into an HTML page such as this one :
37 |
38 | ```html
39 |
40 | Haxe JS
41 |
42 |
43 |
44 |
45 |
46 |
47 | ```
48 |
49 | 1. Put this code into a `test.html` file.
50 | 2. Open it with your browser (like Google Chrome)
51 | 3. It will display **Hello World** in your Console.
52 | 4. (Google Chrome > Hamburger menu > More Tools > Developers tools)
53 |
54 |
55 | ## try.haxe
56 |
57 | If you want to experiment with this code, you can do that without installing Haxe.
58 |
59 | Below you can see and try the same example code at [try.haxe.org](https://try.haxe.org/) without installing Haxe.
60 |
61 |
64 |
65 |
66 | *Based upon [old.haxe.org - manual](http://old.haxe.org/doc/start/js)*
67 |
--------------------------------------------------------------------------------
/docs/haxe/installation.md:
--------------------------------------------------------------------------------
1 | # Installing Haxe
2 |
3 |
4 | 
5 |
6 |
7 | First, you will need to install Haxe (Neko and Haxelib).
8 | There are a couple ways to install Haxe:
9 |
10 | * Get the [installer](#haxe) from [haxe.org](http://haxe.org/download/) (original)
11 | * Use [NPM](#npm)
12 | * Use [Homebrew](#brew)
13 | * Use [Chocolatey](#chocolatey)
14 |
15 |
16 | Although all the installation methods _should_ work. I have use the original installer from haxe.org, and didn't try the other methods.
17 |
18 | My suggestion would be to use that one!
19 |
20 |
21 |
22 | ## Installer (original) from haxe.org
23 |
24 | You can find installers and binaries for Windows, OS X and Linux on [http://haxe.org/download/](http://haxe.org/download/).
25 |
26 |
27 |
28 | ## Install with NPM (node)
29 |
30 | Before you can install Haxe, you have to install Node.js (and thus NPM).
31 | Installing Haxe with NPM makes sense if you have NPM installed already.
32 |
33 | But here is the link to install Node.js: [https://nodejs.org/](https://nodejs.org/)
34 |
35 | After installation use:
36 |
37 | npm install -g haxe
38 |
39 | *[read more about Haxe at NPM](https://www.npmjs.com/package/haxe)*
40 | AND check out all the [Haxe related projects](https://www.npmjs.com/browse/keyword/haxe) on NPM.
41 |
42 |
43 | ## Install with Homebrew
44 |
45 | Same as with Node.js, you probably want to use Homebrew if you have this already installed.
46 | Worth mentioning: this works on OS X.
47 |
48 | Visit [http://brew.sh/](http://brew.sh/) to get instruction how to install Homebrew.
49 |
50 | After installation use: (install latest from git with --HEAD)
51 |
52 | brew install haxe --HEAD
53 |
54 |
55 |
56 | ## Install with chocolatey
57 |
58 | This is a Windows install method. You can get your Chocolatey install instructions from [chocolatey.org](https://chocolatey.org/)
59 |
60 | After installation use:
61 |
62 | choco install haxe
63 |
64 | ---
--------------------------------------------------------------------------------
/contribute.md:
--------------------------------------------------------------------------------
1 | # Contribute!
2 |
3 | This documentation hosted on Github, and pages are presented with Markdown using Gitbook. The process should be very easy/familiar for developers.
4 |
5 | Even if you are not a developer and don't want to clone everything, you still can edit the files directly from Github (you need account to login in and edit the `.md` files).
6 |
7 | As a final resort, you can leave your comments/suggestions/etc. at the bottom of the page via Disqus.
8 |
9 | ##### Visit [https://github.com/MatthijsKamstra/haxejs](https://github.com/MatthijsKamstra/haxejs) to fork the documentation, or just report issues.
10 |
11 | Found any "bug" or have a great idea? Please create a [new issue](https://github.com/MatthijsKamstra/haxejs/issues/new).
12 |
13 | ## About open-sourcing documentation
14 |
15 | Open-source documentation is quite fitting for an open-source programming language; writing documentation is an easy and simple way to contribute, even if you're intimidated by some project's complexity.
16 |
17 | * [babylon js open sourcing the documentation](http://blogs.msdn.com/b/eternalcoding/archive/2015/08/11/babylon-js-open-sourcing-the-documentation.aspx)
18 | * [building markdown based developer docs](https://medium.com/code-stories/building-markdown-based-developer-docs-87c0317c56f7)
19 |
20 |
21 | ### Resources about writing documentation (Markdown)
22 |
23 | * [13-things-people-hate-about-your-open-source-docs/](http://blog.smartbear.com/careers/13-things-people-hate-about-your-open-source-docs/)
24 | *
25 | *
26 | *
27 |
28 |
29 | ## Installation, HTML generation
30 |
31 | ```
32 | npm install
33 | npm run build
34 | open docs/index.html
35 | ```
36 |
37 |
38 | ## Tutorial structure
39 |
40 | Every new tutorial should have:
41 |
42 | ```
43 | + foldername (use common sense)
44 | + code (folder with code examples)
45 | | + bin
46 | | + src
47 | | | - Main.hx
48 | | - build.hxml
49 | - about.md (short description what it will do)
50 | - install.md (is there something you need to install)
51 | - example.md (javscript.hxml, Main.hx, how to build, etc)
52 | ```
53 |
54 | ---
--------------------------------------------------------------------------------
/docs/haxe/quick-install.md:
--------------------------------------------------------------------------------
1 | # Quick install
2 |
3 | This tutorial is for the TL;DR crowd...
4 | You just want to get started ... right!
5 |
6 | 
7 |
8 | ## Step 0: You have joined an elite Haxe force!
9 |
10 | You are cooler then a polar bear!
11 |
12 | ## Step 1: Install Haxe
13 |
14 | You can find installers and binaries for Windows, OS X and Linux on [http://haxe.org/download/](http://haxe.org/download/).
15 |
16 | - Download
17 | - And install
18 |
19 | ## Step 2: Install Editor
20 |
21 | You need an editor, lets install **Visual Studio Code**
22 |
23 | 
24 |
25 | On the homepage of [Visual Studio Code](https://code.visualstudio.com/) find the button for your OS.
26 |
27 | - Download
28 | - And install
29 |
30 | ## Step 3: Install VSCode - Haxe Extension Pack
31 |
32 | To get VSCode working with Haxe you should install the "Haxe Extension Pack"
33 |
34 | ([Haxe Extension Pack ](https://marketplace.visualstudio.com/items?itemName=vshaxe.haxe-extension-pack))
35 |
36 | - Launch VS Code
37 | - Quick Open (Ctrl+P / ⌘+P)
38 | - Paste the following command: `ext install haxe-extension-pack`
39 | - And type enter
40 |
41 | It currently contains 3 extensions
42 |
43 | - Haxe ([Haxe Support for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=nadako.vshaxe))
44 | - Haxe Debug ([Haxe Debug for flash target](https://marketplace.visualstudio.com/items?itemName=vshaxe.haxe-debug))
45 | - codedox ([JSDoc style comments](https://marketplace.visualstudio.com/items?itemName=wiggin77.codedox))
46 |
47 | But that might become more in the future!
48 |
49 | ## Step 4 (extra): Install haxelib libraries
50 |
51 | This is not necessary but something you eventually need to do.
52 |
53 | - Open `terminal`
54 | - Copy and past the following
55 |
56 | ```
57 | haxelib install hxnodejs
58 | haxelib git js-kit https://github.com/clemos/haxe-js-kit.git haxelib
59 | haxelib install markdown
60 | haxelib install msignal
61 | ```
62 |
63 | ## Step 5 (Extra): Install NPM/Node.js
64 |
65 | Download Node.js: get your version here: [https://nodejs.org/](https://nodejs.org/)
66 |
67 | - Download
68 | - And install
69 |
70 | Now you have access to NPM.
71 |
72 | - Open `terminal`
73 | - Copy and paste the following (and see current NPM version)
74 |
75 | ```
76 | npm -v
77 | ```
78 |
79 | ---
80 |
--------------------------------------------------------------------------------
/docs/08json/code/Source/Main.hx:
--------------------------------------------------------------------------------
1 | package;
2 |
3 | import haxe.io.*;
4 | import haxe.io.Path;
5 | import sys.io.File;
6 | import sys.FileSystem;
7 |
8 | import unityengine.*;
9 | import unityengine.Application;
10 |
11 | @:nativeGen
12 | class Main extends MonoBehaviour {
13 |
14 | function new (){
15 | super();
16 | }
17 |
18 | function Awake() {
19 | // write your own trace function suitable for Unity
20 | haxe.Log.trace = function(v:Dynamic, ?infos:haxe.PosInfos) {
21 | var str = infos.fileName + ":" + infos.lineNumber + ": " + v;
22 | Debug.Log(str);
23 | }
24 | }
25 |
26 | function Start() {
27 | trace('Json example');
28 |
29 | var fileName:String = "users.json";
30 | var filePath = Path.join([Application.streamingAssetsPath, fileName]);
31 |
32 | // folder should exists because it has contains our user.json data file
33 | if (FileSystem.exists(filePath)) {
34 | var str:String = File.getContent(filePath);
35 | var json:Array = haxe.Json.parse(str);
36 | // trace ("number of users: " + json.length);
37 | createList(json);
38 | } else {
39 | trace('ERROR: there is not file: $filePath');
40 | }
41 | }
42 |
43 | private function createList(json:Array):Void {
44 | var csv = '\n';
45 | csv += 'id\tname\tusername\temail\tphone\twebsite\n';
46 | for (i in 0...json.length) {
47 | var _user:User = json[i];
48 | csv += '${_user.id}\t';
49 | csv += '${_user.name}\t';
50 | csv += '${_user.username}\t';
51 | csv += '${_user.email}\t';
52 | csv += '${_user.phone}\t';
53 | csv += '${_user.website}\t';
54 | csv += '\n';
55 | }
56 | csv += '\n';
57 | trace(csv);
58 | }
59 |
60 | static public function main() {
61 | var main = new Main();
62 | }
63 | }
64 |
65 | typedef User = {
66 | var id:Int; // 1,
67 | var name:String; // Leanne Graham",
68 | var username:String; // Bret",
69 | var email:String; // Sincere@april.biz",
70 | var address:{
71 | var street:String; // Kulas Light",
72 | var suite:String; // Apt. 556",
73 | var city:String; // Gwenborough",
74 | var zipcode:String; // 92998-3874",
75 | var geo:{
76 | var lat:String; //-37.3159",
77 | var lng:String; // 81.1496"
78 | };
79 | };
80 | var phone:String; // 1-770-736-8031 x56442",
81 | var website:String; // hildegard.org",
82 | var company:{
83 | var name:String; // Romaguera-Crona",
84 | var catchPhrase:String; // Multi-layered client-server neural-net",
85 | var bs:String; // harness real-time e-markets"
86 | };
87 | }
88 |
--------------------------------------------------------------------------------
/docs/10json/code/Source/Main.hx:
--------------------------------------------------------------------------------
1 | package;
2 |
3 | import haxe.io.*;
4 | import haxe.io.Path;
5 | import sys.io.File;
6 | import sys.FileSystem;
7 |
8 | import unityengine.*;
9 | import unityengine.Application;
10 |
11 | @:nativeGen
12 | class Main extends MonoBehaviour {
13 |
14 | function new (){
15 | super();
16 | }
17 |
18 | function Awake() {
19 | // write your own trace function suitable for Unity
20 | haxe.Log.trace = function(v:Dynamic, ?infos:haxe.PosInfos) {
21 | var str = infos.fileName + ":" + infos.lineNumber + ": " + v;
22 | Debug.Log(str);
23 | }
24 | }
25 |
26 | function Start() {
27 | trace('Json example');
28 |
29 | var fileName:String = "users.json";
30 | var filePath = Path.join([Application.streamingAssetsPath, fileName]);
31 |
32 | // folder should exists because it has contains our user.json data file
33 | if (FileSystem.exists(filePath)) {
34 | var str:String = File.getContent(filePath);
35 | var json:Array = haxe.Json.parse(str);
36 | // trace ("number of users: " + json.length);
37 | createList(json);
38 | } else {
39 | trace('ERROR: there is not file: $filePath');
40 | }
41 | }
42 |
43 | private function createList(json:Array):Void {
44 | var csv = '\n';
45 | csv += 'id\tname\tusername\temail\tphone\twebsite\n';
46 | for (i in 0...json.length) {
47 | var _user:User = json[i];
48 | csv += '${_user.id}\t';
49 | csv += '${_user.name}\t';
50 | csv += '${_user.username}\t';
51 | csv += '${_user.email}\t';
52 | csv += '${_user.phone}\t';
53 | csv += '${_user.website}\t';
54 | csv += '\n';
55 | }
56 | csv += '\n';
57 | trace(csv);
58 | }
59 |
60 | static public function main() {
61 | var main = new Main();
62 | }
63 | }
64 |
65 | typedef User = {
66 | var id:Int; // 1,
67 | var name:String; // Leanne Graham",
68 | var username:String; // Bret",
69 | var email:String; // Sincere@april.biz",
70 | var address:{
71 | var street:String; // Kulas Light",
72 | var suite:String; // Apt. 556",
73 | var city:String; // Gwenborough",
74 | var zipcode:String; // 92998-3874",
75 | var geo:{
76 | var lat:String; //-37.3159",
77 | var lng:String; // 81.1496"
78 | };
79 | };
80 | var phone:String; // 1-770-736-8031 x56442",
81 | var website:String; // hildegard.org",
82 | var company:{
83 | var name:String; // Romaguera-Crona",
84 | var catchPhrase:String; // Multi-layered client-server neural-net",
85 | var bs:String; // harness real-time e-markets"
86 | };
87 | }
88 |
--------------------------------------------------------------------------------
/docs/haxe/choosing-a-code-editor.md:
--------------------------------------------------------------------------------
1 | # Choosing a Code Editor
2 |
3 | Once Haxe has been [installed](installation.md) (yes you should do that first!). It is helpful to choose an integrated development environment (IDE), with good support for Haxe development.
4 |
5 | Although you can write code using even a simple text editor.
6 | A quality IDE can provide:
7 |
8 | - code completion (code hints)
9 | - shortcuts to build and test your projects
10 | - and other tools to give you a great coding experience.
11 |
12 |
13 | ## Visual Studio Code
14 |
15 | Code is the recommended editor to get started with Haxe, and is the current main effort from the Haxe Foundation.
16 |
17 | 
18 |
19 | [Visual Studio Code](https://code.visualstudio.com/) Build and debug modern web and cloud applications.
20 |
21 | Code is free and open-source, and cross platform - Linux, Mac OSX, and Windows.
22 |
23 |
24 | ## HaxeDevelop
25 |
26 | 
27 |
28 | [HaxeDevelop](http://www.haxedevelop.org) is one of the strongest IDEs for large scale Haxe development.
29 | If you are a Windows user (and perhaps if you are not), we recommend that you try HaxeDevelop first.
30 |
31 | HaxeDevelop is free and open-source.
32 |
33 |
34 | ## IntelliJ IDEA
35 |
36 | 
37 |
38 | [IntelliJ IDEA](https://www.jetbrains.com/idea/) is primarily marketed as a Java IDE. But it has a growing support within the Haxe community, and is prefered by large teams. The full edition and the free community edition, support the open-source [Haxe plugin](https://plugins.jetbrains.com/plugin/6873?pr=idea).
39 |
40 |
41 | ## Other Choices
42 |
43 | There are other code editors to choose from, include vim and up-and-coming Haxe-based editors. You can read more at [http://haxe.org/documentation/introduction/editors-and-ides.html](http://haxe.org/documentation/introduction/editors-and-ides.html)
44 |
45 |
46 | ## Summary
47 |
48 | | Name | Platform | Price | License | Plugin |
49 | | ---- | ---- | ---- | ---- | ---- | ---- |
50 | | VSCode | Windows, Mac, Linux | Free | ? | [Haxe Extension Pack ](https://marketplace.visualstudio.com/items?itemName=vshaxe.haxe-extension-pack) |
51 | | HaxeDevelop | Windows | Free | Open Source | |
52 | | IntelliJ IDEA | Windows, Mac, Linux | Free | Apache License 2.0 | [Haxe Support](http://plugins.jetbrains.com/plugin/6873?pr=idea) |
53 |
54 |
55 | *Some of this information is directly from [Openfl documentation](http://www.openfl.org/learn/resources/choosing-a-code-editor/)*
56 |
--------------------------------------------------------------------------------
/docs/04reading/example.md:
--------------------------------------------------------------------------------
1 | # Example Reading
2 |
3 | Simply write and read a file. Can't make it more glamorous.
4 | In this example we will use Haxe specific code that can be used for other `sys` targets (lua, python, neko, cpp, hl, php, java, cs) as well.
5 |
6 | The short version of the folder structure will not work without the files Unity needs.
7 | If you want to know more about that, read the [setup](../00setup/example.md)
8 |
9 | ```
10 | + unity-haxe-helloworld
11 | + Source
12 | - Main.hx
13 | - build.hxml
14 | ```
15 |
16 | ## The Main.hx
17 |
18 | Check out the whole [`Main.hx`](/code/Source/Main.hx) for more details.
19 |
20 | That is a lot of code so I will focus on the specific part that writes the file.
21 |
22 |
23 |
24 | ```haxe
25 | function Start() {
26 | trace("Reading and writing example");
27 |
28 | var dataFileName:String = "hello.txt";
29 | var filePath = Path.join([Application.streamingAssetsPath, dataFileName]);
30 |
31 | // check if this folder exists, if not create!
32 | if(!FileSystem.exists(Application.streamingAssetsPath)){
33 | FileSystem.createDirectory(Application.streamingAssetsPath);
34 | trace('"StreamAssets"-folder created!');
35 | }
36 |
37 | var str:String = 'Writing and reading a simple text file.!\nWritten on: ' + Date.now().toString();
38 | File.saveContent(filePath, str);
39 | trace('${filePath} is generated');
40 |
41 | // read the file
42 | var content = File.getContent(filePath);
43 | trace (content);
44 | }
45 | ```
46 |
47 |
48 | Most code is from the previous (writing) example, so what is new here?
49 |
50 | ```haxe
51 | // read the file
52 | var content = File.getContent(filePath);
53 | trace (content);
54 | ```
55 |
56 | Just that simple to read a file.
57 |
58 |
59 | ## The Haxe build file, build.hxml
60 |
61 | You will need a build file (read more about that in the [build example](../09build/example.md)).
62 | I work on osx, so you might need to tweak this script for your os
63 |
64 |
65 | ```bash
66 | -cp Source
67 | -D net-ver=40
68 | # -net-lib C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll
69 | # -net-lib /Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll
70 | -net-lib /Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/Managed/UnityEngine.dll
71 | -cs Assets/Code
72 | -D no-compilation
73 | -D real-position
74 | Main
75 | ```
76 |
77 |
78 |
79 | ## Build the code
80 |
81 | To finish and see what we have, build the file and see the result
82 |
83 | 1. Open your terminal
84 | 2. `cd ` to the correct folder where you have saved the `build.hxml`
85 | 3. type `haxe build.hxml`
86 | 4. press enter
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/docs/intro.md:
--------------------------------------------------------------------------------
1 | # Haxe and Unity (C#)
2 |
3 | 
4 |
5 | I was working on a Unity 3D project, and I was curious if I could get it to work with Haxe-C# target.
6 | To be clear, I know this could be called C# documentation as well, but I needed more info about the combination Haxe/Unity/C#.
7 | That is what I will be focusing on.
8 |
9 | Practical information how to start are none existing, so I started to document my research.
10 | I hope this will help. If you think so, why not help with [contribution](contribute.md) to this tutorial site.
11 |
12 |
13 | ### How will this help me?
14 |
15 | It will get you started with C# (Unity) **and** Haxe.
16 | How to setup your project, install externs and how to work with them. This probably will never be a complete documentation but it will help you get started!
17 |
18 | ### Who is this for?
19 |
20 | For clever, cool and handsome developers. Duh! :D
21 |
22 | ## Documentation goals
23 |
24 | I wanted to make contributing to this documentation as easy as possible.
25 | That's why I use Markdown. Developers use it, but is just writing in plain English so **everybody** can write documentation!
26 | And this documentation hosted on Github, developers favorite place to store code.
27 | Even if you are not a developer. Don't want to clone everything, you still can change the files on the website (you need account to login in and change the `.md` files).
28 | And as a final resort, you can leave your comments/suggestions/etc at the bottom of the page via Disqus.
29 |
30 |
31 | ## Open-sourcing the documentation
32 |
33 | I thought I was the first to try to write documentation and open-sourcing it this way, but other beat me.
34 | Although I was already writing everything with markdown, it looked like a good idea to use Gitbook to "publish" it. Writing documentation is like writing a book.
35 |
36 | **Other clever developers who had this idea before me:**
37 |
38 | * [babylon js open sourcing the documentation](http://blogs.msdn.com/b/eternalcoding/archive/2015/08/11/babylon-js-open-sourcing-the-documentation.aspx)
39 | * [building markdown based developer docs](https://medium.com/code-stories/building-markdown-based-developer-docs-87c0317c56f7)
40 |
41 |
42 | **Other resources about writing documentation (Markdown)**
43 |
44 | * [13-things-people-hate-about-your-open-source-docs/](http://blog.smartbear.com/careers/13-things-people-hate-about-your-open-source-docs/)
45 | *
46 | *
47 | *
48 |
--------------------------------------------------------------------------------
/docs/haxecs/download.md:
--------------------------------------------------------------------------------
1 | # Install Haxe
2 |
3 | Before you can use there are a couple of thing you need to do.
4 |
5 | Obviously you need to install Haxe. There are a [couple of ways to do it](../haxe/installation.md), but in this document I will send you to the [official Haxe place](#haxe). After that you need to install `hxcs`-lib via [haxelib](#haxelib) and last but not least [.NET development framework (either Microsoft.NET or Mono)](#cs).
6 |
7 | And a [code editor](#ide) will be useful!
8 |
9 | ----
10 |
11 | Current Haxe version is (at the time of writing):
12 |
13 | * **Haxe** v3.4.7
14 |
15 | But if the version numbers changed, it means I haven't updated this part of the document in some time :D
16 |
17 |
18 | ## Download Haxe
19 |
20 | 
21 |
22 | * Get your version here: [http://haxe.org/download/](http://haxe.org/download/)
23 |
24 |
25 |
26 |
27 | ### Haxelib
28 |
29 | After you have installed Haxe, you automatically have access to `haxelib`. Use that you install `hxcs`:
30 |
31 |
32 | ```bash
33 | haxelib install hxcs
34 | ```
35 |
36 | Source:
37 |
38 |
39 | ## Download .NET development framework
40 |
41 | * Get your version here:
42 |
43 | Press that big "Get started"-button and you will get instructions how to proceed on your platform.
44 |
45 |
46 | ## Mono
47 |
48 | Perhaps needs to be installed as well? Could be installed with Unity?
49 |
50 | Install the latest Mono Compiler
51 |
52 |
53 |
54 | ## Code Editors
55 |
56 | You can find an extensive list on [http://haxe.org/](http://haxe.org/documentation/introduction/editors-and-ides.html).
57 | And even a bigger list on the [old website](http://old.haxe.org/com/ide)...
58 |
59 | (And I see no mentioning of Atom and Brackets.... even more choices)
60 |
61 | **But to keep everything simple**
62 |
63 | ### On Windows
64 |
65 | Install [FlashDevelop](http://www.flashdevelop.org/)
66 |
67 | ### On everything else
68 |
69 | Install [Visual Studio Code](https://code.visualstudio.com/) with the [Haxe Extension Pack ](https://marketplace.visualstudio.com/items?itemName=vshaxe.haxe-extension-pack).
70 |
71 | ### Okay these two are also good for all platforms
72 |
73 | Install [Sublimetext 2](http://sublimetext.com/) with the [haxe sublime2 bundle](https://github.com/clemos/haxe-sublime2-bundle).
74 |
75 | It's freakish difficult to setup a project, but after that AWESOME!
76 | [IntelliJ IDEA](http://www.jetbrains.com/idea/) with [Haxe support plugin](https://plugins.jetbrains.com/plugin/6873)
77 |
78 |
79 | *Read more about code editors [here](../haxe/choosing-a-code-editor.md)*
--------------------------------------------------------------------------------
/docs/01helloworld/example.md:
--------------------------------------------------------------------------------
1 | # Hello World Example
2 |
3 | Check the [code folder](https://github.com/MatthijsKamstra/haxeunity/tree/master/00helloworld/code) for more comments.
4 | If you want to know why we are making this? Check out the [about](about.md).
5 |
6 | This example will be a bit different from the "normal" examples I wrote.
7 |
8 | First the file/folder structure will be different, this because C# in combination with Unity dictates it.
9 | Normally I would advise to use this folder structure:
10 |
11 | ```
12 | + foobar
13 | + bin
14 | + src
15 | - Main.hx
16 | - build.hxml
17 | ```
18 |
19 | For this example I used the "unity-haxe-helloworld" Nadako made: .
20 | But I don't want all these files in my documentation, so for this example I use the same folder structure but won't use the unity files (you should use the files Nadako provided)
21 |
22 | ```
23 | + unity-haxe-helloworld
24 | + Source
25 | - Main.hx
26 | - build.hxml
27 | ```
28 |
29 | ## The Haxe build file, build.hxml update
30 |
31 | I will be using the "unity-haxe-helloworld" from Nadako in all examples. But this also means that you need to change something first before you can build.
32 |
33 | ```bash
34 | -cp Source
35 | -D net-ver=40
36 | # -net-lib C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll
37 | # -net-lib /Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll
38 | -net-lib /Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/Managed/UnityEngine.dll
39 | -cs Assets/Code
40 | -D no-compilation
41 | -D real-position
42 | Main
43 | ```
44 |
45 | If you work on Windows you should have a path the unity engine:
46 |
47 | `-net-lib C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll`
48 |
49 | If you work on Osx you should have a path the unity engine:
50 |
51 | `-net-lib /Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll`
52 |
53 | I work on osx and I used "Unity Hub" to install Unity my path was:
54 |
55 | `-net-lib /Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/Managed/UnityEngine.dll`
56 |
57 | The only thing I added to the build.hxml is
58 |
59 | ```
60 | -D real-position
61 | ```
62 |
63 | This stops the generate `#line` directives that map C# expression positions to original .hx files. Useful for tracking down issues related to code generation. But I hope I will never need this. So lets not generate this lines.
64 |
65 |
66 |
67 | ## The Main.hx
68 |
69 | Open your favorite editor, copy/paste the code and save it in the `Source` folder.
70 |
71 | ```haxe
72 | package;
73 |
74 | import unityengine.*;
75 |
76 | @:nativeGen
77 | class Main extends MonoBehaviour {
78 |
79 | function Awake() {
80 | // logging via unity
81 | Debug.Log('[Unity] Hello world');
82 | }
83 | }
84 |
85 | ```
86 |
87 |
88 |
--------------------------------------------------------------------------------
/docs/05haxelow/code/Source/Main.hx:
--------------------------------------------------------------------------------
1 | package;
2 |
3 | import haxe.io.*;
4 | import haxe.io.Path;
5 | import sys.io.File;
6 | import sys.FileSystem;
7 |
8 | import unityengine.*;
9 | import unityengine.Application;
10 |
11 | @:nativeGen
12 | class Main extends MonoBehaviour {
13 |
14 | function new (){
15 | super();
16 | }
17 |
18 | function Awake() {
19 | // write your own trace function suitable for Unity
20 | haxe.Log.trace = function(v:Dynamic, ?infos:haxe.PosInfos) {
21 | var str = '${infos.fileName}:${infos.lineNumber}:${v}';
22 | Debug.Log(str);
23 | }
24 | }
25 |
26 | function Start() {
27 | trace("Haxelow Example");
28 |
29 | var fileName:String = "db.json";
30 | var filePath = Path.join([Application.streamingAssetsPath, fileName]);
31 |
32 | // Create the database
33 | var db = new HaxeLow(filePath);
34 |
35 | // Get a collection of a class
36 | var persons = db.col(Person);
37 |
38 | trace('Total persons in db: ${persons.length}');
39 |
40 | // persons is now an Array
41 | // that can be manipulated as you like
42 | persons.push(new Person(randomName(), randomInteger(1900,2019)));
43 |
44 | // Save all collections to disk.
45 | // This is the only way to save, no automatic saving
46 | // takes place.
47 | db.save();
48 |
49 | trace('Open ${filePath}');
50 |
51 | createList(persons);
52 | }
53 |
54 | private function createList(arr:Array):Void {
55 | var csv = '\n';
56 | csv += 'id\tname\tbirth\n';
57 | for (i in 0...arr.length) {
58 | var _p:Person = arr[i];
59 | csv += '${_p.id}\t';
60 | csv += '${_p.name}\t';
61 | csv += '${_p.birth}\t';
62 | csv += '\n';
63 | }
64 | csv += '\n';
65 | trace(csv);
66 | }
67 |
68 | function randomName ():String{
69 | var medeklinker = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'z', 'ch', 'sj', 'th' ];
70 | var klinker = ['a', 'e', 'i', 'o', 'u' , 'aa', 'oe', 'au', 'ui' ];
71 | var name = medeklinker[randomInteger(medeklinker.length-1)].toUpperCase() + klinker[randomInteger(klinker.length-1)] +medeklinker[randomInteger(medeklinker.length-1)] + klinker[randomInteger(klinker.length-1)];
72 | return name;
73 | }
74 |
75 | function randomInteger(min:Int, ?max:Int):Int {
76 | if (max == null) {
77 | max = min;
78 | min = 0;
79 | }
80 | return Math.floor(Math.random() * (max + 1 - min)) + min;
81 | }
82 |
83 |
84 | static public function main() {
85 | var main = new Main();
86 | }
87 | }
88 |
89 | class Person {
90 | public function new(name, birth) {
91 | this.name = name; this.birth = birth;
92 | }
93 |
94 | // Easy way to generate a v4 UUID:
95 | public var id : String = HaxeLow.uuid();
96 | public var name : String;
97 | public var birth : Int;
98 | }
99 |
100 |
--------------------------------------------------------------------------------
/docs/img/web-trifecta.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/00setup/example.md:
--------------------------------------------------------------------------------
1 | # Setup Unity and Haxe
2 |
3 | You can use the example repo made by [Dan Korostelev aka Nadako](https://github.com/nadako): [unity-haxe-helloworld](https://github.com/nadako/unity-haxe-helloworld). It's a basic hello world for Unity and Haxe.
4 |
5 | But you can also start from scratch and follow this setup.
6 |
7 |
8 |
9 | ## Unity
10 |
11 | Open Unity and follow "instructions":
12 |
13 | - Give it a project name: (I used) "SetupUnityHaxe"
14 | - Use the Template: 3D
15 |
16 | 
17 |
18 | You will end up with:
19 |
20 | 
21 |
22 | ## Folder structure
23 |
24 | Default Unity creates the following folders:
25 |
26 | 
27 |
28 | Add a `Source` folder which will hold the Haxe files.
29 |
30 | ```
31 | + SetupUnityHaxe
32 | + Source
33 | - Main.hx
34 | ```
35 |
36 |
37 | ## The Main.hx
38 |
39 | Open your favourite editor, copy/paste the code and save it in the `Source` folder.
40 |
41 | ```haxe
42 | import unityengine.*;
43 |
44 | @:nativeGen
45 | class Main extends MonoBehaviour {
46 | var who:String;
47 |
48 | function Awake() {
49 | Debug.Log('Hello, $who!');
50 | }
51 | }
52 |
53 | ```
54 |
55 | ## Build file
56 |
57 |
58 | Add the `build.hxml` in the root
59 |
60 | ```bash
61 | -cp Source
62 | -D net-ver=40
63 | # windows
64 | # -net-lib C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll
65 | # osx
66 | # -net-lib /Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll
67 | # osx with Unity Hub
68 | -net-lib /Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/Managed/UnityEngine.dll
69 | -cs Assets/Code
70 | -D no-compilation
71 | -D real-position
72 | Main
73 | ```
74 |
75 | Do you want to know more about the build file, check out [build example](../09build/example.md).
76 |
77 | ## Updated folder structure
78 |
79 | After adding a source folder and a build file:
80 |
81 |
82 | 
83 |
84 |
85 | ## Run Haxe
86 |
87 | ```bash
88 | haxe build.hxml
89 | ```
90 |
91 | And this will generate C# files in `/Assets/Code/src`.
92 |
93 | ## Update Unity
94 |
95 | Just open Unity and it will update everything (I can't explain it better)
96 |
97 | After the update you can find your newly generate C# files in `Assets/Code/src/Main` in the **Project** Panel
98 |
99 |
100 | 
101 |
102 | Click on "Main Camera" in you **Hierarchy** panel
103 |
104 | 
105 |
106 | And click on "Add Component"-button at the bottom of the **Inspector** panel
107 |
108 | 
109 |
110 | Search for `Main` script
111 |
112 | 
113 |
114 | Now the script is added to the camera
115 |
116 | 
117 |
118 | Fill in your name (for example "Foobar")
119 |
120 |
121 | 
122 |
123 | Press "Play" (short cut on osx: `cmd`+`p`)
124 |
125 | 
126 |
127 | And you will seen in the **Console** panel the log "Hello, Foobar!"
128 |
129 |
130 |
131 |
132 |
133 |
--------------------------------------------------------------------------------
/docs/02trace/example.md:
--------------------------------------------------------------------------------
1 | # trace example
2 |
3 | Loggin is somewhat different in Unity.
4 | Normally you would use `trace` for logging in Haxe.
5 | But the unity target uses a different Logging system, so the normal trace doesn't show up in Unity.
6 |
7 | The example is going to fix that.
8 |
9 |
10 | The short version of the folder structure will not work without the files Unity needs.
11 | If you want to know more about that, read the [setup](../00setup/example.md)
12 |
13 | ```
14 | + unity-haxe-helloworld
15 | + Source
16 | - Main.hx
17 | - build.hxml
18 | ```
19 |
20 | ## The Main.hx
21 |
22 | Check out the whole [`Main.hx`](/code/Source/Main.hx) for more details.
23 |
24 |
25 | ```
26 | package;
27 |
28 | import unityengine.*;
29 |
30 | import cs.system.Console;
31 |
32 | @:nativeGen
33 | class Main extends MonoBehaviour {
34 |
35 | function new (){
36 | super();
37 | }
38 |
39 | function Awake() {
40 | // write your own trace function suitable for Unity
41 | haxe.Log.trace = function(v:Dynamic, ?infos:haxe.PosInfos) {
42 | var str = infos.fileName + ":" + infos.lineNumber + ": " + v;
43 | Debug.Log(str);
44 | }
45 | }
46 |
47 | function Start() {
48 | // logging via unity
49 | Debug.Log('[Unity] Hello world');
50 | // logging via C#
51 | Console.WriteLine("[C#] Hello world");
52 | // logging via Haxe
53 | trace("[Haxe] Hello world");
54 | }
55 |
56 | static public function main() {
57 | var main = new Main();
58 | }
59 | }
60 |
61 | ```
62 |
63 |
64 | You can see (in the Start function) that we use 3 ways of logging in this file
65 |
66 | ```haxe
67 | Debug.Log('[Unity] Hello world');
68 | Console.WriteLine("[C#] Hello world");
69 | trace("[Haxe] Hello world");
70 | ```
71 |
72 | Only the first one will show up in Unity (`Debug.Log("")`), the others will not.
73 |
74 | But if you want to use the default trace (and the ability to link it back to your original Haxe code & easy removal) in Unity you will need to rewrite the logging a bit:
75 |
76 | ```haxe
77 | haxe.Log.trace = function(v:Dynamic, ?infos:haxe.PosInfos) {
78 | var str = infos.fileName + ":" + infos.lineNumber + ": " + v;
79 | Debug.Log(str);
80 | }
81 | ```
82 |
83 | This way trace will work via the default Log methode.
84 |
85 | Read more about this subject:
86 |
87 |
88 |
89 |
90 |
91 | ## The Haxe build file, build.hxml
92 |
93 | You will need a build file (read more about that in the [build example](../09build/example.md)).
94 | I work on osx, so you might need to tweak this script for your os
95 |
96 |
97 | ```bash
98 | -cp Source
99 | -D net-ver=40
100 | # -net-lib C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll
101 | # -net-lib /Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll
102 | -net-lib /Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/Managed/UnityEngine.dll
103 | -cs Assets/Code
104 | -D no-compilation
105 | -D real-position
106 | Main
107 | ```
108 |
109 |
110 |
111 | ## Build the code
112 |
113 | To finish and see what we have, build the file and see the result
114 |
115 | 1. Open your terminal
116 | 2. `cd ` to the correct folder where you have saved the `build.hxml`
117 | 3. type `haxe build.hxml`
118 | 4. press enter
119 |
120 |
121 |
--------------------------------------------------------------------------------
/docs/03writing/example.md:
--------------------------------------------------------------------------------
1 | # Writing example
2 |
3 | Simple write to a file. Can't make it more glamorous.
4 | In this example we will use Haxe specific code that can be used for other `sys` targets (lua, python, neko, cpp, hl, php, java, cs) as well.
5 |
6 | The short version of the folder structure will not work without the files Unity needs.
7 | If you want to know more about that, read the [setup](../00setup/example.md)
8 |
9 | ```
10 | + unity-haxe-helloworld
11 | + Source
12 | - Main.hx
13 | - build.hxml
14 | ```
15 |
16 | ## The Main.hx
17 |
18 | Check out the whole [`Main.hx`](/code/Source/Main.hx) for more details.
19 |
20 | That is a lot of code so I will focus on the specific part that writes the file.
21 |
22 |
23 |
24 | ```haxe
25 | function Start() {
26 | trace('Writing example');
27 |
28 | var dataFileName:String = "hello.txt";
29 | var filePath = Path.join([Application.streamingAssetsPath, dataFileName]);
30 |
31 | // check if this folder exists, if not create!
32 | if(!FileSystem.exists(Application.streamingAssetsPath)){
33 | FileSystem.createDirectory(Application.streamingAssetsPath);
34 | trace('"StreamAssets"-folder created!');
35 | }
36 |
37 | var str:String = 'Hello World!\nWritten on: ' + Date.now().toString();
38 | File.saveContent(filePath, str);
39 |
40 | trace('${filePath} is generated');
41 | }
42 |
43 | ```
44 |
45 | In the code we see some Haxe specific code and some Unity specific code:
46 |
47 | ```haxe
48 | var dataFileName:String = "hello.txt";
49 | var filePath = Path.join([Application.streamingAssetsPath, dataFileName]);
50 | ```
51 |
52 | - `Path.join` is Haxe System code (works on all Haxe system target like c++, python, etc )
53 | - `Application.streamingAssetsPath` is specific Unity code, its a folder in `Assets/StreamingAssets`
54 |
55 | ```haxe
56 | // check if this folder exists, if not create!
57 | if(!FileSystem.exists(Application.streamingAssetsPath)){
58 | FileSystem.createDirectory(Application.streamingAssetsPath);
59 | trace('"StreamAssets"-folder created!');
60 | }
61 | ```
62 |
63 | Default the streaming Assets folder is not generated by Unity. So first we check if it exists and if that is not the case, we generate that folder.
64 |
65 | ```haxe
66 | var str:String = 'Hello World!\nWritten on: ' + Date.now().toString();
67 | File.saveContent(filePath, str);
68 | ```
69 |
70 | Now we know the folder exists, we can save any data in there.
71 |
72 | ## The Haxe build file, build.hxml
73 |
74 | You will need a build file (read more about that in the [build example](../09build/example.md)).
75 | I work on osx, so you might need to tweak this script for your os
76 |
77 |
78 | ```bash
79 | -cp Source
80 | -D net-ver=40
81 | # -net-lib C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll
82 | # -net-lib /Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll
83 | -net-lib /Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/Managed/UnityEngine.dll
84 | -cs Assets/Code
85 | -D no-compilation
86 | -D real-position
87 | Main
88 | ```
89 |
90 |
91 |
92 | ## Build the code
93 |
94 | To finish and see what we have, build the file and see the result
95 |
96 | 1. Open your terminal
97 | 2. `cd ` to the correct folder where you have saved the `build.hxml`
98 | 3. type `haxe build.hxml`
99 | 4. press enter
100 |
101 |
102 |
--------------------------------------------------------------------------------
/docs/09build/example.md:
--------------------------------------------------------------------------------
1 | # Build file
2 |
3 |
4 | I used the hello world from Nadako as a starting point for the combination Haxe (C#) and Unity:
5 |
6 |
7 |
8 | And the build file will show you what you need to do to wire it into Unity:
9 |
10 | ```bash
11 | -cp Source
12 | -D net-ver=40
13 | -net-lib C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll
14 | # -net-lib /Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll
15 | -cs Assets/Code
16 | -D no-compilation
17 | Main
18 | ```
19 |
20 | Let's see what this build script is doing:
21 |
22 | ```bash
23 | -cp Source
24 | ```
25 |
26 | To tell the compiler which folder holds all our code: `-cp Source`.
27 | Normally I would use `src` for a folder-name, but C# coding convention seems to favor capitalize names so `Source` sounds about right.
28 | This is used for all Haxe targets, so if you are familiar with Haxe, this one should not be a surprise.
29 |
30 |
31 | ```bash
32 | -D net-ver=40
33 | ```
34 |
35 | Tells the compiler up to which .NET version to use.
36 |
37 |
38 |
39 | As you might notice you see you need to point the `-net-lib` to the correct location on your computer:
40 |
41 | ```bash
42 | # Windows (you might find it here)
43 | -net-lib C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll
44 | ```
45 |
46 | ```bash
47 | # Osx (you might find it here)
48 | -net-lib /Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll
49 | ```
50 |
51 | I work on mac so I can only comment on how the mac works.
52 | And I used "Unity Hub" to install Unity.
53 | In my case the location was different:
54 |
55 | ```bash
56 | # Osx (Unity installed via 'Unity Hub")
57 | -net-lib /Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/Managed/UnityEngine.dll
58 | ```
59 |
60 |
61 | ```bash
62 | -cs Assets/Code
63 | ```
64 |
65 | To tell the compiler which target to use: `-cs` is the C# target
66 | And which folder will be used for the transpiled code: `Assets/Code` in this case.
67 | Normally I would use `src` for a folder-name, but C# coding convention (or this might also be Unity's way) seems to favor capitalize names so `Assets/Code` sounds about right.
68 |
69 |
70 |
71 |
72 | ```bash
73 | -D no-compilation
74 | ```
75 |
76 | Tell the compiler to only generate C# sources and don't invoke C# compiler on them.
77 |
78 |
79 | ```bash
80 | Main
81 | ```
82 |
83 | What source file is the starting point of your code
84 |
85 |
86 | ## Haxe/C# Defines
87 |
88 | Source:
89 |
90 |
91 | One I want to mention is:
92 |
93 | ```bash
94 | -D real-position
95 | ```
96 |
97 | This don't generate `#line` directives that map C# expression positions to original `.hx` files. Useful for tracking down issues related to code generation.
98 |
99 |
100 |
101 | ## Find Unity install
102 |
103 | I have Unity hub installed on Osx, so that is my main source for this knowledge.
104 |
105 |
106 | Open Unity Hub on Installs
107 | 
108 |
109 |
110 | Click on the 3 dots, and use "Reveal in Finder"
111 |
112 | 
113 |
114 | Use this knowledge to change the `-net-lib`
115 |
116 | ```bash
117 |
118 | # previous install
119 | #-net-lib /Applications/Unity/Hub/Editor/2018.2.2f1/Unity.app/Contents/Managed/UnityEngine.dll
120 | # after upgrading Unity:
121 | -net-lib /Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/Managed/UnityEngine.dll
122 | ```
123 |
124 | happy coding!
125 |
126 |
127 |
--------------------------------------------------------------------------------
/docs/02trace2/example.md:
--------------------------------------------------------------------------------
1 | # trace example
2 |
3 | Loggin is somewhat different in Unity.
4 | Normally you would use `trace` for logging in Haxe.
5 | But the unity target uses a different Logging system, so the normal trace doesn't show up in Unity.
6 |
7 | The example is going to fix that.
8 |
9 |
10 | The short version of the folder structure will not work without the files Unity needs.
11 | If you want to know more about that, read the [setup](../00setup/example.md)
12 |
13 | ```
14 | + unity-haxe-helloworld
15 | + Source
16 | - Main.hx
17 | - build.hxml
18 | ```
19 |
20 | ## The Main.hx
21 |
22 | Check out the whole [`Main.hx`](/code/Source/Main.hx) for more details.
23 |
24 |
25 | ```
26 | package;
27 |
28 | import unityengine.*;
29 |
30 | import cs.system.Console;
31 |
32 | @:nativeGen
33 | class Main extends MonoBehaviour {
34 |
35 | function new (){
36 | super();
37 | }
38 |
39 | function Awake() {
40 | // write your own trace function suitable for Unity
41 | haxe.Log.trace = function(v:Dynamic, ?infos:haxe.PosInfos) {
42 | var color = '#ff3333';
43 | if (infos.customParams != null && infos.customParams.length > 0) {
44 | // Debug.Log(infos.customParams[0]);
45 | color = infos.customParams[0];
46 | }
47 | var str = '${infos.fileName}:${infos.lineNumber}:${v}';
48 | Debug.Log(str);
49 | }
50 | // trace("hello green", 'green');
51 | // trace("hello red", 'red');
52 | }
53 |
54 | function Start() {
55 | // logging via unity
56 | Debug.Log('[Unity] Hello world');
57 | // logging via C#
58 | Console.WriteLine("[C#] Hello world");
59 | // logging via Haxe
60 | trace("[Haxe] Hello world");
61 | }
62 |
63 | static public function main() {
64 | var main = new Main();
65 | }
66 | }
67 | ```
68 |
69 |
70 | You can see that we use 3 ways of logging in this file
71 |
72 | ```haxe
73 | Debug.Log('[Unity] Hello world');
74 | Console.WriteLine("[C#] Hello world");
75 | trace("[Haxe] Hello world");
76 | ```
77 |
78 | Only the first one will show up in Unity (`Debug.Log("")`), the others will not.
79 |
80 | But if you want to use the default trace (and the ability to link it back to your original Haxe code & easy removal) in Unity you will need to rewrite the logging a bit:
81 |
82 | ```haxe
83 | haxe.Log.trace = function(v:Dynamic, ?infos:haxe.PosInfos) {
84 | var str = infos.fileName + ":" + infos.lineNumber + ": " + v;
85 | Debug.Log(str);
86 | }
87 | ```
88 |
89 | This way trace will work via the default Log methode.
90 |
91 | Read more about this subject:
92 |
93 |
94 |
95 |
96 |
97 | ## The Haxe build file, build.hxml
98 |
99 | You will need a build file (read more about that in the [build example](../09build/example.md)).
100 | I work on osx, so you might need to tweak this script for your os
101 |
102 |
103 | ```bash
104 | -cp Source
105 | -D net-ver=40
106 | # -net-lib C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll
107 | # -net-lib /Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll
108 | -net-lib /Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/Managed/UnityEngine.dll
109 | -cs Assets/Code
110 | -D no-compilation
111 | -D real-position
112 | Main
113 | ```
114 |
115 |
116 |
117 | ## Build the code
118 |
119 | To finish and see what we have, build the file and see the result
120 |
121 | 1. Open your terminal
122 | 2. `cd ` to the correct folder where you have saved the `build.hxml`
123 | 3. type `haxe build.hxml`
124 | 4. press enter
125 |
126 |
127 |
--------------------------------------------------------------------------------
/docs/05haxelow/example.md:
--------------------------------------------------------------------------------
1 | # Example Haxelow
2 |
3 | Write to a simple json database...
4 | Done in Haxe
5 |
6 | Check the [code folder](https://github.com/MatthijsKamstra/haxeunity/tree/master/04haxelow/code) for more comments.
7 |
8 | In this example we are going to use a database `.json` file.
9 |
10 | The short version of the folder structure will not work without the files Unity needs.
11 | If you want to know more about that, read the [setup](../00setup/example.md)
12 |
13 | ```
14 | + unity-haxe-helloworld
15 | + Assets
16 | + StreamingAssets
17 | + Source
18 | - Main.hx
19 | - build.hxml
20 | ```
21 |
22 | This script assumes that the `Assets/StreamingAssets` exists.
23 |
24 | You can always add a little check for that if you want.
25 |
26 | ```haxe
27 | // check if this folder exists, if not create!
28 | if(!FileSystem.exists(Application.streamingAssetsPath)){
29 | FileSystem.createDirectory(Application.streamingAssetsPath);
30 | trace('"StreamAssets"-folder created!');
31 | }
32 | ```
33 |
34 |
35 |
36 | ## Install
37 |
38 | Don't forget to install haxelow
39 |
40 | ```
41 | haxelib install haxelow
42 | ```
43 |
44 |
45 | ## The Main.hx
46 |
47 | Check out the whole [`Main.hx`](/code/Source/Main.hx) for more details.
48 |
49 | That is a lot of code so I will focus on the specific part that writes the file.
50 |
51 |
52 | ```haxe
53 | function Start() {
54 | trace("Haxelow Example");
55 |
56 | var fileName:String = "db.json";
57 | var filePath = Path.join([Application.streamingAssetsPath, fileName]);
58 |
59 | // Create the database
60 | var db = new HaxeLow(filePath);
61 |
62 | // Get a collection of a class
63 | var persons = db.col(Person);
64 |
65 | trace('Total persons in db: ${persons.length}');
66 |
67 | // persons is now an Array
68 | // that can be manipulated as you like
69 | persons.push(new Person(randomName(), randomInteger(1900,2019)));
70 |
71 | // Save all collections to disk.
72 | // This is the only way to save, no automatic saving
73 | // takes place.
74 | db.save();
75 |
76 | trace('Open ${filePath}');
77 |
78 | createList(persons);
79 | }
80 | ```
81 |
82 |
83 | We have created a class for the "user" in the database.
84 | And added an uuid as the id create with ` HaxeLow.uuid()`
85 |
86 | ```haxe
87 | class Person {
88 | public function new(name, birth) {
89 | this.name = name; this.birth = birth;
90 | }
91 |
92 | // Easy way to generate a v4 UUID:
93 | public var id : String = HaxeLow.uuid();
94 | public var name : String;
95 | public var birth : Int;
96 | }
97 | ```
98 |
99 |
100 | And then it's possible to convert the `json` to usable input:
101 |
102 | ```haxe
103 | for (i in 0...json.length) {
104 | var _user:User = json[i];
105 | trace ( "Name: " + _user.name );
106 | }
107 | ```
108 |
109 |
110 |
111 |
112 |
113 | ## The Haxe build file, build.hxml
114 |
115 | You will need a build file (read more about that in the [build example](../09build/example.md)).
116 | I work on osx, so you might need to tweak this script for your os
117 |
118 | Don't forget to add haxelow lib to this file:
119 |
120 |
121 | ```bash
122 | -lib haxelow
123 | -cp Source
124 | -D net-ver=40
125 | # -net-lib C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll
126 | # -net-lib /Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll
127 | -net-lib /Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/Managed/UnityEngine.dll
128 | -cs Assets/Code
129 | -D no-compilation
130 | -D real-position
131 | Main
132 | ```
133 |
134 |
135 |
136 | ## Build the code
137 |
138 | To finish and see what we have, build the file and see the result
139 |
140 | 1. Open your terminal
141 | 2. `cd ` to the correct folder where you have saved the `build.hxml`
142 | 3. type `haxe build.hxml`
143 | 4. press enter
--------------------------------------------------------------------------------
/docs/08json/example.md:
--------------------------------------------------------------------------------
1 | # Example json
2 |
3 | I have created the [user.json](https://github.com/MatthijsKamstra/haxeunity/tree/master/08json/code/Assets/StreamingAssets/users.json) with .
4 |
5 |
6 | Check the [code folder](https://github.com/MatthijsKamstra/haxeunity/tree/master/08json/code) for more comments.
7 |
8 | In this example we are going to read and use a `.json` file.
9 |
10 | The short version of the folder structure will not work without the files Unity needs.
11 | If you want to know more about that, read the [setup](../00setup/example.md)
12 |
13 | ```
14 | + unity-haxe-helloworld
15 | + Assets
16 | + StreamingAssets
17 | - users.json
18 | + Source
19 | - Main.hx
20 | - build.hxml
21 | ```
22 |
23 | ## The Main.hx
24 |
25 | Check out the whole [`Main.hx`](/code/Source/Main.hx) for more details.
26 |
27 | That is a lot of code so I will focus on the specific part that writes the file.
28 |
29 |
30 | ```haxe
31 | function Start() {
32 | trace('Json example');
33 |
34 | var fileName:String = "users.json";
35 | var filePath = Path.join([Application.streamingAssetsPath, fileName]);
36 |
37 | // folder should exists because it has contains our user.json data file
38 | if (FileSystem.exists(filePath)) {
39 | var str:String = File.getContent(filePath);
40 | var json:Array = haxe.Json.parse(str);
41 | // trace ("number of users: " + json.length);
42 | createList(json);
43 | } else {
44 | trace('ERROR: there is not file: $filePath');
45 | }
46 | }
47 | ```
48 |
49 | convert data (String) to a `json` file:
50 |
51 |
52 | ```haxe
53 | var str:String = File.getContent(filePath);
54 | var json:Array = haxe.Json.parse(str);
55 | ```
56 |
57 | To make that easier I use [`typedef`](http://haxe.org/manual/type-system-typedef.html)
58 |
59 | We convert the json data to `User` so when we use a IDE it will use autocompletion
60 |
61 | ```haxe
62 | typedef User = {
63 | var id : Int; // 1
64 | var name : String; // Leanne Graham
65 | var username : String; // Bret
66 | var email : String; // Sincere@april.biz
67 | var address : {
68 | var street : String; // Kulas Light
69 | var suite : String; // Apt. 556
70 | var city : String; // Gwenborough
71 | var zipcode : String; // 92998-3874
72 | var geo : {
73 | var lat : String; // -37.3159
74 | var lng : String; // 81.1496
75 | };
76 | };
77 | var phone : String; // 1-770-736-8031 x56442
78 | var website : String; // hildegard.org
79 | var company : {
80 | var name : String; // Romaguera-Crona
81 | var catchPhrase : String; // Multi-layered client-server neural-net
82 | var bs : String; // harness real-time e-markets
83 | };
84 | }
85 |
86 | ```
87 |
88 |
89 | And then it's possible to convert the `json` to usable input:
90 |
91 | ```haxe
92 | for (i in 0...json.length) {
93 | var _user:User = json[i];
94 | trace ( "Name: " + _user.name );
95 | }
96 | ```
97 |
98 |
99 |
100 | ## The Haxe build file, build.hxml
101 |
102 | You will need a build file (read more about that in the [build example](../09build/example.md)).
103 | I work on osx, so you might need to tweak this script for your os
104 |
105 |
106 | ```bash
107 | -cp Source
108 | -D net-ver=40
109 | # -net-lib C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll
110 | # -net-lib /Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll
111 | -net-lib /Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/Managed/UnityEngine.dll
112 | -cs Assets/Code
113 | -D no-compilation
114 | -D real-position
115 | Main
116 | ```
117 |
118 |
119 |
120 | ## Build the code
121 |
122 | To finish and see what we have, build the file and see the result
123 |
124 | 1. Open your terminal
125 | 2. `cd ` to the correct folder where you have saved the `build.hxml`
126 | 3. type `haxe build.hxml`
127 | 4. press enter
128 |
129 |
130 |
131 |
--------------------------------------------------------------------------------
/docs/10json/example.md:
--------------------------------------------------------------------------------
1 | # Example json
2 |
3 | I have created the [user.json](https://github.com/MatthijsKamstra/haxeunity/tree/master/08json/code/Assets/StreamingAssets/users.json) with .
4 |
5 |
6 | Check the [code folder](https://github.com/MatthijsKamstra/haxeunity/tree/master/08json/code) for more comments.
7 |
8 | In this example we are going to read and use a `.json` file.
9 |
10 | The short version of the folder structure will not work without the files Unity needs.
11 | If you want to know more about that, read the [setup](../00setup/example.md)
12 |
13 | ```
14 | + unity-haxe-helloworld
15 | + Assets
16 | + StreamingAssets
17 | - users.json
18 | + Source
19 | - Main.hx
20 | - build.hxml
21 | ```
22 |
23 | ## The Main.hx
24 |
25 | Check out the whole [`Main.hx`](/code/Source/Main.hx) for more details.
26 |
27 | That is a lot of code so I will focus on the specific part that writes the file.
28 |
29 |
30 | ```haxe
31 | function Start() {
32 | trace('Json example');
33 |
34 | var fileName:String = "users.json";
35 | var filePath = Path.join([Application.streamingAssetsPath, fileName]);
36 |
37 | // folder should exists because it has contains our user.json data file
38 | if (FileSystem.exists(filePath)) {
39 | var str:String = File.getContent(filePath);
40 | var json:Array = haxe.Json.parse(str);
41 | // trace ("number of users: " + json.length);
42 | createList(json);
43 | } else {
44 | trace('ERROR: there is not file: $filePath');
45 | }
46 | }
47 | ```
48 |
49 | convert data (String) to a `json` file:
50 |
51 |
52 | ```haxe
53 | var str:String = File.getContent(filePath);
54 | var json:Array = haxe.Json.parse(str);
55 | ```
56 |
57 | To make that easier I use [`typedef`](http://haxe.org/manual/type-system-typedef.html)
58 |
59 | We convert the json data to `User` so when we use a IDE it will use autocompletion
60 |
61 | ```haxe
62 | typedef User = {
63 | var id : Int; // 1
64 | var name : String; // Leanne Graham
65 | var username : String; // Bret
66 | var email : String; // Sincere@april.biz
67 | var address : {
68 | var street : String; // Kulas Light
69 | var suite : String; // Apt. 556
70 | var city : String; // Gwenborough
71 | var zipcode : String; // 92998-3874
72 | var geo : {
73 | var lat : String; // -37.3159
74 | var lng : String; // 81.1496
75 | };
76 | };
77 | var phone : String; // 1-770-736-8031 x56442
78 | var website : String; // hildegard.org
79 | var company : {
80 | var name : String; // Romaguera-Crona
81 | var catchPhrase : String; // Multi-layered client-server neural-net
82 | var bs : String; // harness real-time e-markets
83 | };
84 | }
85 |
86 | ```
87 |
88 |
89 | And then it's possible to convert the `json` to usable input:
90 |
91 | ```haxe
92 | for (i in 0...json.length) {
93 | var _user:User = json[i];
94 | trace ( "Name: " + _user.name );
95 | }
96 | ```
97 |
98 |
99 |
100 | ## The Haxe build file, build.hxml
101 |
102 | You will need a build file (read more about that in the [build example](../09build/example.md)).
103 | I work on osx, so you might need to tweak this script for your os
104 |
105 |
106 | ```bash
107 | -cp Source
108 | -D net-ver=40
109 | # -net-lib C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll
110 | # -net-lib /Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll
111 | -net-lib /Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/Managed/UnityEngine.dll
112 | -cs Assets/Code
113 | -D no-compilation
114 | -D real-position
115 | Main
116 | ```
117 |
118 |
119 |
120 | ## Build the code
121 |
122 | To finish and see what we have, build the file and see the result
123 |
124 | 1. Open your terminal
125 | 2. `cd ` to the correct folder where you have saved the `build.hxml`
126 | 3. type `haxe build.hxml`
127 | 4. press enter
128 |
129 |
130 |
131 |
--------------------------------------------------------------------------------
/docs/haxe/about.md:
--------------------------------------------------------------------------------
1 | # What is Haxe?
2 |
3 | 
4 |
5 |
6 | Lets get the Wikipedia description first:
7 |
8 | > Haxe is an open source high-level multi-platform programming language and compiler that can produce applications and source code for many different platforms from a single code-base.
9 | >
10 | > Haxe includes a set of common functionality that is supported across all platforms, such as numeric data types, text, arrays, binary and some common file formats. Haxe also includes platform-specific API for Adobe Flash, C++, PHP and other languages.
11 | >
12 | > Code written in the Haxe language can be source-to-source compiled into ActionScript 3 code, JavaScript programs, Java, C# , C++ standalone applications, Python, PHP, Apache CGI, and Node.js server-side applications.
13 |
14 |
15 | *From [wikipedia](https://en.wikipedia.org/wiki/Haxe)*
16 |
17 | ----
18 |
19 | And the official description:
20 |
21 | > Haxe consists of a high-level, open source programming language and a compiler. It allows compilation of programs, written using an ECMAScript-oriented syntax, to multiple target languages. Employing proper abstraction, it is possible to maintain a single code-base which compiles to multiple targets.
22 | >
23 | > Haxe is strongly typed but the typing system can be subverted where required. Utilizing type information, the Haxe type system can detect errors at compile-time which would only be noticeable at run-time in the target language. Furthermore, type information can be used by the target generators to generate optimized and robust code.
24 |
25 |
26 | *From [haxe.org - manual](http://haxe.org/manual/introduction-what-is-haxe.html)*
27 |
28 | -----
29 |
30 | ## History
31 |
32 | A long time ago, there was MTASC, the ActionScript 2 compiler which brought Flash to the entreprise,
33 | and its author, [Nicolas Cannasse](https://twitter.com/ncannasse), decided to create a new open-source
34 | language inspired by ActionScript and ML languages like Ocaml: Haxe.
35 |
36 | Around 2006, Haxe was born, designed to be adapted to a wide variety of targets, including Flash and JavaScript.
37 |
38 | ## Early users
39 |
40 | It was already the most modern compile-to-JS language, but of course a big focus from the author's company
41 | was games, and likewise the initial community using Haxe was certainly oriented into gaming more than web apps.
42 |
43 | Quickly small companies and indie developers wanted to just code everything with Haxe: PHP on the server,
44 | JS for the web interactions, Flash for games, then C++ to look for more performance and freedom in games.
45 |
46 | NME and OpenFl appeared as the first big efforts to reproduce the Flash API for desktop and mobile - people
47 | have started, abusively, assimilating OpenFl with Haxe, while it was just one library among many.
48 |
49 | ## The raise of JavaScript
50 |
51 | JavaScript has taken the world by storm now; people use it for increasingly complex browser apps, but also
52 | for command line and server applications, and even more recently for native apps using react-native.
53 |
54 | Following this trend, users of Haxe-JavaScript have also grown and keep up with the state of the art,
55 | and Haxe developers believe it's a better language for small to huge JavaScript projects.
56 |
57 | A popular language like TypeScript, which appeared much later than Haxe and recently gained a large
58 | following thanks to being closer to ES6 and backed by big corporations, shows that typed languages
59 | are a concern which appeals to JavaScript developers. And while TypeScript is a decent language, it
60 | essentially has the same pros and cons as regular JavaScript and compilation is several orders of
61 | magnitude slower than Haxe for large projects.
62 |
63 | This documentation will hopefully demonstrate how easy it is to use Haxe for JavaScript development. It
64 | may not look as easy as other compile-to-JS to get started but it really doesn't require a big investment
65 | to become familiar with it - and it will make you a better programmer.
66 |
67 | ---
68 |
--------------------------------------------------------------------------------
/docs/06keep/example.md:
--------------------------------------------------------------------------------
1 | # Keep
2 |
3 | Keep files, stop DCE (if you need a little bit more in-depth info, read the [about](about.md))
4 |
5 | Check the [code folder](https://github.com/MatthijsKamstra/haxeunity/tree/master/06keep/code) for more comments.
6 |
7 | The "normal" file-structure I use for examples will not work.
8 | We will follow the Unity/C# folder structure you see here:
9 |
10 | ```
11 | + unity-haxe-helloworld
12 | + Assets
13 | + Source
14 | + view
15 | - HideWhenPlaying.hx
16 | - Main.hx
17 | - build.hxml
18 | ```
19 |
20 | This folder structure will not work with Unity because it has no Unity files!
21 | Primarily because this is not a Unity tutorial.
22 | But I understand that is difficult to test so if you want to know more how you can setup Unity and Haxe from scratch, read the [setup](../00setup/example.md) example.
23 |
24 |
25 |
26 | ## The Main.hx
27 |
28 | So we need a class/Script that you can use to hide a gameobject when its playing in Unity. Maybe its a placeholder or design layout asset.
29 |
30 | We start with a simple `Main.hx` class. But we will not directly call the class/function
31 |
32 | ```haxe
33 | package;
34 |
35 | import unityengine.*;
36 | // make sure this class is transpiled into C#/cs
37 | import view.HideWhenPlaying;
38 |
39 | @:nativeGen
40 | class Main extends MonoBehaviour {
41 |
42 | function Awake() {
43 | Debug.Log('[Haxe] Main Awake()');
44 | }
45 | }
46 | ```
47 |
48 |
49 | As you might have noticed we import `view.HideWhenPlaying`.
50 | This is because we need the Haxe compiler to notice this specific class!
51 |
52 | In the Main use a direct import (a wildcard will not work: `import view.*` ).
53 |
54 |
55 |
56 | ## the Class / Script
57 |
58 | So lets make that Class!
59 |
60 | First I will show the original file I created in C#
61 |
62 | ```cs
63 | using UnityEngine;
64 |
65 | public class HideWhenPlaying : MonoBehaviour
66 | {
67 | void Awake(){
68 | gameObject.SetActive(false);
69 | }
70 | }
71 | ```
72 |
73 | Let's recreate that one in Haxe:
74 |
75 |
76 | ```haxe
77 | package view;
78 |
79 | import unityengine.MonoBehaviour;
80 |
81 | @:nativeGen
82 | @:keep
83 | class HideWhenPlaying extends MonoBehaviour {
84 | function Awake() {
85 | gameObject.SetActive(false);
86 | }
87 | }
88 | ```
89 |
90 |
91 | Very similar. In my original C# file I didn't use a package (or namespace for C# users) but .. he I wanted to improve on my previous project.
92 |
93 |
94 | We will not be using this class in the Main.hx. But because we imported the class and in combination with `@:keep` the Haxe compiler knows that it need to transpile the Haxe code to C#.
95 |
96 | ## Generated file
97 |
98 |
99 | The generated C# file is not as clean as the original file:
100 |
101 | ```cs
102 | // Generated by Haxe 3.4.7
103 |
104 | #pragma warning disable 109, 114, 219, 429, 168, 162
105 | namespace view {
106 | public class HideWhenPlaying : global::UnityEngine.MonoBehaviour {
107 |
108 | public HideWhenPlaying() : base() { }
109 |
110 | public virtual void Awake() {
111 | ( this as global::UnityEngine.Component ).gameObject.SetActive(((bool) (false) ));
112 | }
113 | }
114 | }
115 | ```
116 |
117 | But still very readable for C# developers
118 |
119 | ## Unity
120 |
121 | So when you build the code via the build file.
122 |
123 | You will end up with:
124 |
125 | 
126 |
127 | And you can attach that to an gameobject to make it disappear when you press "Play"
128 |
129 |
130 |
131 |
132 | ## The Haxe build file, build.hxml update
133 |
134 | I will be using the "unity-haxe-helloworld" from Nadako in all examples. But this also means that you need to change something first before you can build.
135 |
136 | ```bash
137 | -cp Source
138 | -D net-ver=40
139 | # -net-lib C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll
140 | # -net-lib /Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll
141 | -net-lib /Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/Managed/UnityEngine.dll
142 | -cs Assets/Code
143 | -D no-compilation
144 | -D real-position
145 | Main
146 | ```
147 |
148 | If you work on Windows you should have a path the unity engine:
149 |
150 | `-net-lib C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEngine.dll`
151 |
152 | If you work on Osx you should have a path the unity engine:
153 |
154 | `-net-lib /Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll`
155 |
156 | I work on osx and I used "Unity Hub" to install Unity my path was:
157 |
158 | `-net-lib /Applications/Unity/Hub/Editor/2019.2.2f1/Unity.app/Contents/Managed/UnityEngine.dll`
159 |
160 | The only thing I added to the build.hxml is
161 |
162 | ```
163 | -D real-position
164 | ```
165 |
166 | This stops the generate `#line` directives that map C# expression positions to original .hx files. Useful for tracking down issues related to code generation. But I hope I will never need this. So lets not generate this lines.
167 |
168 |
169 |
170 |
171 |
--------------------------------------------------------------------------------
/docs/haxe/learn-haxe.md:
--------------------------------------------------------------------------------
1 | # Learn Haxe
2 |
3 | 
4 |
5 |
6 | Here are some places you can go:
7 |
8 |
9 | ## Learn X in Y minutes
10 |
11 | **I love this one!**
12 |
13 | > Take a whirlwind tour of your next favorite language. Community-driven!
14 |
15 | Learn in code: Learn Haxe 3 in 15 minutes.
16 |
17 | [learn x in y minutes : Haxe](http://learnxinyminutes.com/docs/haxe/)
18 |
19 |
20 | ## haxe.org
21 |
22 | Can't miss this one, it's the mother ship
23 |
24 | [haxe.org - documentation](http://haxe.org/documentation/introduction/)
25 |
26 |
27 | ## Haxe API documentation
28 |
29 | Find the documentation here: [http://api.haxe.org/](http://api.haxe.org/)
30 |
31 |
32 | ## Haxe Manual
33 |
34 | A more in-depth into coding with Haxe: the [HaxeManual](https://github.com/HaxeFoundation/HaxeManual).
35 | Download the [pdf here](https://github.com/HaxeFoundation/HaxeManual/raw/master/HaxeManual/HaxeManual.pdf)
36 |
37 |
38 | ## Try Haxe
39 |
40 | Not a place to learn, but to **try out** without installing Haxe.
41 | [Try Haxe!](https://try.haxe.org/)
42 |
43 |
44 | ## Haxe Code Cookbook
45 |
46 | A lot of nice example in different categories:
47 |
48 | - Beginner
49 | - Abstract types
50 | - Compilation
51 | - Data structures
52 | - Design patterns
53 | - Functional Programming
54 | - Macros
55 | - Principles
56 | - Other
57 |
58 | > Easy to read Haxe coding examples.
59 |
60 | [Haxe Code Cookbook](http://code.haxe.org/)
61 |
62 |
63 | ## Video
64 |
65 | Videos that could help you on your way
66 |
67 | ### Collection of Haxe videos
68 |
69 |
70 |
71 | [](https://haxe.org/videos/)
72 |
73 |
74 | #### Haxe for Absolute Beginners: Getting Started
75 |
76 | [](http://www.youtube.com/watch?v=d0Kc4j6qFAA)
77 |
78 | > This is a tutorial series starting from the very beginning on explaining exactly what Haxe is, how you can get started and understanding everything it has to offer us.
79 |
80 | #### Haxe Tutorial 1 Getting Set Up
81 |
82 | [](http://www.youtube.com/watch?v=EAn29Xeiz4w)
83 |
84 |
85 |
86 | #### "10 years of Haxe / 10 things I like" by Nicolas Cannasse
87 |
88 | [](http://www.youtube.com/watch?v=sM8VhotrIJs)
89 |
90 | > Nicolas Cannasse shares with us his 10 things for the 10 years Haxe's anniversary in his talk “10 Years of Haxe / 10 Things I like”. He presents the latest changes that were introduced in Haxe as well as Haxe Foundation plans for the future.
91 |
92 |
93 | #### "A walk-through of Haxe JS Kit" by Clément Charmet
94 |
95 |
96 | [](http://www.youtube.com/watch?v=YJ3IvE6qCEA)
97 |
98 | > Talk description: in this talk “A walk-through of Haxe JS Kit”, Clément Charmet demonstrates the main features of Haxe JS Kit, and through them, the huge benefits of using Haxe over alternatives such as Typescript to "just" target JavaScript.
99 |
100 |
101 | #### "NPM, Haxe at the heart of JavaScript ecosystem" by David Mouton
102 |
103 |
104 | [](http://www.youtube.com/watch?v=YgbxqFx9qak)
105 |
106 | > Talk description: David Mouton presents “NPM, Haxe at the heart of JavaScript ecosystem”. JavaScript ecosystem for web app development is well implanted and NPM is at the centre of it. Coffeescript and Typescript are perfectly integrated and have offered a real alternative to full JavaScript development. For almost a year now, Haxe has constituted a third alternative in this ecosystem.
107 |
108 |
109 | #### Haxe, a language that compiles to JS
110 |
111 | [](https://www.youtube.com/watch?v=7YNR9HAm6D0)
112 |
113 | > Nowadays there are a lot of languages that are able to compile to JS (e.g. Dart, TypeScript, Java/GWT etc.). One that is less well-known, but will surely blow your mind, is Haxe. It is one of the earliest languages that target JS (since 2006). It is a statically-typed language with ECMAScript like syntax.
114 |
115 |
116 | #### Peter Štefček (Pixel Federation): Open-source Lang. Haxe for Dev. of Platform-independent Apps
117 |
118 | [](https://www.youtube.com/watch?v=CupIdO-GpVg)
119 |
120 | > Introduction to open-source programming language Haxe, what it can offer and how you can use it to target multiple platforms.
121 | >
122 | > Will talk about what is Haxe and how it can help you to start develop multiplatform applications with ease. How you can leverage existing programming skills and even libraries from other languages like Javascript and can run across Flash, Javascript, C++, Android, iOS and many more.
123 | >
124 | >Showcase of Haxe's compiler to target native platforms as well as languages or VM's, and why it's a safe bet for a future-proof codebase. Examples using the language that can get you started.
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 | ## Other links, perhaps worth looking into
133 |
134 | Could be old and outdated, haven't investigated it thourough.
135 |
136 | * [http://haxelearning.wikispaces.com/](http://haxelearning.wikispaces.com/)
137 | * [http://haxe.us/haxe_tutorial.html](http://haxe.us/haxe_tutorial.html)
138 |
--------------------------------------------------------------------------------
/docs/08json/code/Assets/StreamingAssets/users.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "id": 1,
4 | "name": "Leanne Graham",
5 | "username": "Bret",
6 | "email": "Sincere@april.biz",
7 | "address": {
8 | "street": "Kulas Light",
9 | "suite": "Apt. 556",
10 | "city": "Gwenborough",
11 | "zipcode": "92998-3874",
12 | "geo": {
13 | "lat": "-37.3159",
14 | "lng": "81.1496"
15 | }
16 | },
17 | "phone": "1-770-736-8031 x56442",
18 | "website": "hildegard.org",
19 | "company": {
20 | "name": "Romaguera-Crona",
21 | "catchPhrase": "Multi-layered client-server neural-net",
22 | "bs": "harness real-time e-markets"
23 | }
24 | },
25 | {
26 | "id": 2,
27 | "name": "Ervin Howell",
28 | "username": "Antonette",
29 | "email": "Shanna@melissa.tv",
30 | "address": {
31 | "street": "Victor Plains",
32 | "suite": "Suite 879",
33 | "city": "Wisokyburgh",
34 | "zipcode": "90566-7771",
35 | "geo": {
36 | "lat": "-43.9509",
37 | "lng": "-34.4618"
38 | }
39 | },
40 | "phone": "010-692-6593 x09125",
41 | "website": "anastasia.net",
42 | "company": {
43 | "name": "Deckow-Crist",
44 | "catchPhrase": "Proactive didactic contingency",
45 | "bs": "synergize scalable supply-chains"
46 | }
47 | },
48 | {
49 | "id": 3,
50 | "name": "Clementine Bauch",
51 | "username": "Samantha",
52 | "email": "Nathan@yesenia.net",
53 | "address": {
54 | "street": "Douglas Extension",
55 | "suite": "Suite 847",
56 | "city": "McKenziehaven",
57 | "zipcode": "59590-4157",
58 | "geo": {
59 | "lat": "-68.6102",
60 | "lng": "-47.0653"
61 | }
62 | },
63 | "phone": "1-463-123-4447",
64 | "website": "ramiro.info",
65 | "company": {
66 | "name": "Romaguera-Jacobson",
67 | "catchPhrase": "Face to face bifurcated interface",
68 | "bs": "e-enable strategic applications"
69 | }
70 | },
71 | {
72 | "id": 4,
73 | "name": "Patricia Lebsack",
74 | "username": "Karianne",
75 | "email": "Julianne.OConner@kory.org",
76 | "address": {
77 | "street": "Hoeger Mall",
78 | "suite": "Apt. 692",
79 | "city": "South Elvis",
80 | "zipcode": "53919-4257",
81 | "geo": {
82 | "lat": "29.4572",
83 | "lng": "-164.2990"
84 | }
85 | },
86 | "phone": "493-170-9623 x156",
87 | "website": "kale.biz",
88 | "company": {
89 | "name": "Robel-Corkery",
90 | "catchPhrase": "Multi-tiered zero tolerance productivity",
91 | "bs": "transition cutting-edge web services"
92 | }
93 | },
94 | {
95 | "id": 5,
96 | "name": "Chelsey Dietrich",
97 | "username": "Kamren",
98 | "email": "Lucio_Hettinger@annie.ca",
99 | "address": {
100 | "street": "Skiles Walks",
101 | "suite": "Suite 351",
102 | "city": "Roscoeview",
103 | "zipcode": "33263",
104 | "geo": {
105 | "lat": "-31.8129",
106 | "lng": "62.5342"
107 | }
108 | },
109 | "phone": "(254)954-1289",
110 | "website": "demarco.info",
111 | "company": {
112 | "name": "Keebler LLC",
113 | "catchPhrase": "User-centric fault-tolerant solution",
114 | "bs": "revolutionize end-to-end systems"
115 | }
116 | },
117 | {
118 | "id": 6,
119 | "name": "Mrs. Dennis Schulist",
120 | "username": "Leopoldo_Corkery",
121 | "email": "Karley_Dach@jasper.info",
122 | "address": {
123 | "street": "Norberto Crossing",
124 | "suite": "Apt. 950",
125 | "city": "South Christy",
126 | "zipcode": "23505-1337",
127 | "geo": {
128 | "lat": "-71.4197",
129 | "lng": "71.7478"
130 | }
131 | },
132 | "phone": "1-477-935-8478 x6430",
133 | "website": "ola.org",
134 | "company": {
135 | "name": "Considine-Lockman",
136 | "catchPhrase": "Synchronised bottom-line interface",
137 | "bs": "e-enable innovative applications"
138 | }
139 | },
140 | {
141 | "id": 7,
142 | "name": "Kurtis Weissnat",
143 | "username": "Elwyn.Skiles",
144 | "email": "Telly.Hoeger@billy.biz",
145 | "address": {
146 | "street": "Rex Trail",
147 | "suite": "Suite 280",
148 | "city": "Howemouth",
149 | "zipcode": "58804-1099",
150 | "geo": {
151 | "lat": "24.8918",
152 | "lng": "21.8984"
153 | }
154 | },
155 | "phone": "210.067.6132",
156 | "website": "elvis.io",
157 | "company": {
158 | "name": "Johns Group",
159 | "catchPhrase": "Configurable multimedia task-force",
160 | "bs": "generate enterprise e-tailers"
161 | }
162 | },
163 | {
164 | "id": 8,
165 | "name": "Nicholas Runolfsdottir V",
166 | "username": "Maxime_Nienow",
167 | "email": "Sherwood@rosamond.me",
168 | "address": {
169 | "street": "Ellsworth Summit",
170 | "suite": "Suite 729",
171 | "city": "Aliyaview",
172 | "zipcode": "45169",
173 | "geo": {
174 | "lat": "-14.3990",
175 | "lng": "-120.7677"
176 | }
177 | },
178 | "phone": "586.493.6943 x140",
179 | "website": "jacynthe.com",
180 | "company": {
181 | "name": "Abernathy Group",
182 | "catchPhrase": "Implemented secondary concept",
183 | "bs": "e-enable extensible e-tailers"
184 | }
185 | },
186 | {
187 | "id": 9,
188 | "name": "Glenna Reichert",
189 | "username": "Delphine",
190 | "email": "Chaim_McDermott@dana.io",
191 | "address": {
192 | "street": "Dayna Park",
193 | "suite": "Suite 449",
194 | "city": "Bartholomebury",
195 | "zipcode": "76495-3109",
196 | "geo": {
197 | "lat": "24.6463",
198 | "lng": "-168.8889"
199 | }
200 | },
201 | "phone": "(775)976-6794 x41206",
202 | "website": "conrad.com",
203 | "company": {
204 | "name": "Yost and Sons",
205 | "catchPhrase": "Switchable contextually-based project",
206 | "bs": "aggregate real-time technologies"
207 | }
208 | },
209 | {
210 | "id": 10,
211 | "name": "Clementina DuBuque",
212 | "username": "Moriah.Stanton",
213 | "email": "Rey.Padberg@karina.biz",
214 | "address": {
215 | "street": "Kattie Turnpike",
216 | "suite": "Suite 198",
217 | "city": "Lebsackbury",
218 | "zipcode": "31428-2261",
219 | "geo": {
220 | "lat": "-38.2386",
221 | "lng": "57.2232"
222 | }
223 | },
224 | "phone": "024-648-3804",
225 | "website": "ambrose.net",
226 | "company": {
227 | "name": "Hoeger LLC",
228 | "catchPhrase": "Centralized empowering task-force",
229 | "bs": "target end-to-end models"
230 | }
231 | }
232 | ]
--------------------------------------------------------------------------------
/docs/10json/code/Assets/StreamingAssets/users.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "id": 1,
4 | "name": "Leanne Graham",
5 | "username": "Bret",
6 | "email": "Sincere@april.biz",
7 | "address": {
8 | "street": "Kulas Light",
9 | "suite": "Apt. 556",
10 | "city": "Gwenborough",
11 | "zipcode": "92998-3874",
12 | "geo": {
13 | "lat": "-37.3159",
14 | "lng": "81.1496"
15 | }
16 | },
17 | "phone": "1-770-736-8031 x56442",
18 | "website": "hildegard.org",
19 | "company": {
20 | "name": "Romaguera-Crona",
21 | "catchPhrase": "Multi-layered client-server neural-net",
22 | "bs": "harness real-time e-markets"
23 | }
24 | },
25 | {
26 | "id": 2,
27 | "name": "Ervin Howell",
28 | "username": "Antonette",
29 | "email": "Shanna@melissa.tv",
30 | "address": {
31 | "street": "Victor Plains",
32 | "suite": "Suite 879",
33 | "city": "Wisokyburgh",
34 | "zipcode": "90566-7771",
35 | "geo": {
36 | "lat": "-43.9509",
37 | "lng": "-34.4618"
38 | }
39 | },
40 | "phone": "010-692-6593 x09125",
41 | "website": "anastasia.net",
42 | "company": {
43 | "name": "Deckow-Crist",
44 | "catchPhrase": "Proactive didactic contingency",
45 | "bs": "synergize scalable supply-chains"
46 | }
47 | },
48 | {
49 | "id": 3,
50 | "name": "Clementine Bauch",
51 | "username": "Samantha",
52 | "email": "Nathan@yesenia.net",
53 | "address": {
54 | "street": "Douglas Extension",
55 | "suite": "Suite 847",
56 | "city": "McKenziehaven",
57 | "zipcode": "59590-4157",
58 | "geo": {
59 | "lat": "-68.6102",
60 | "lng": "-47.0653"
61 | }
62 | },
63 | "phone": "1-463-123-4447",
64 | "website": "ramiro.info",
65 | "company": {
66 | "name": "Romaguera-Jacobson",
67 | "catchPhrase": "Face to face bifurcated interface",
68 | "bs": "e-enable strategic applications"
69 | }
70 | },
71 | {
72 | "id": 4,
73 | "name": "Patricia Lebsack",
74 | "username": "Karianne",
75 | "email": "Julianne.OConner@kory.org",
76 | "address": {
77 | "street": "Hoeger Mall",
78 | "suite": "Apt. 692",
79 | "city": "South Elvis",
80 | "zipcode": "53919-4257",
81 | "geo": {
82 | "lat": "29.4572",
83 | "lng": "-164.2990"
84 | }
85 | },
86 | "phone": "493-170-9623 x156",
87 | "website": "kale.biz",
88 | "company": {
89 | "name": "Robel-Corkery",
90 | "catchPhrase": "Multi-tiered zero tolerance productivity",
91 | "bs": "transition cutting-edge web services"
92 | }
93 | },
94 | {
95 | "id": 5,
96 | "name": "Chelsey Dietrich",
97 | "username": "Kamren",
98 | "email": "Lucio_Hettinger@annie.ca",
99 | "address": {
100 | "street": "Skiles Walks",
101 | "suite": "Suite 351",
102 | "city": "Roscoeview",
103 | "zipcode": "33263",
104 | "geo": {
105 | "lat": "-31.8129",
106 | "lng": "62.5342"
107 | }
108 | },
109 | "phone": "(254)954-1289",
110 | "website": "demarco.info",
111 | "company": {
112 | "name": "Keebler LLC",
113 | "catchPhrase": "User-centric fault-tolerant solution",
114 | "bs": "revolutionize end-to-end systems"
115 | }
116 | },
117 | {
118 | "id": 6,
119 | "name": "Mrs. Dennis Schulist",
120 | "username": "Leopoldo_Corkery",
121 | "email": "Karley_Dach@jasper.info",
122 | "address": {
123 | "street": "Norberto Crossing",
124 | "suite": "Apt. 950",
125 | "city": "South Christy",
126 | "zipcode": "23505-1337",
127 | "geo": {
128 | "lat": "-71.4197",
129 | "lng": "71.7478"
130 | }
131 | },
132 | "phone": "1-477-935-8478 x6430",
133 | "website": "ola.org",
134 | "company": {
135 | "name": "Considine-Lockman",
136 | "catchPhrase": "Synchronised bottom-line interface",
137 | "bs": "e-enable innovative applications"
138 | }
139 | },
140 | {
141 | "id": 7,
142 | "name": "Kurtis Weissnat",
143 | "username": "Elwyn.Skiles",
144 | "email": "Telly.Hoeger@billy.biz",
145 | "address": {
146 | "street": "Rex Trail",
147 | "suite": "Suite 280",
148 | "city": "Howemouth",
149 | "zipcode": "58804-1099",
150 | "geo": {
151 | "lat": "24.8918",
152 | "lng": "21.8984"
153 | }
154 | },
155 | "phone": "210.067.6132",
156 | "website": "elvis.io",
157 | "company": {
158 | "name": "Johns Group",
159 | "catchPhrase": "Configurable multimedia task-force",
160 | "bs": "generate enterprise e-tailers"
161 | }
162 | },
163 | {
164 | "id": 8,
165 | "name": "Nicholas Runolfsdottir V",
166 | "username": "Maxime_Nienow",
167 | "email": "Sherwood@rosamond.me",
168 | "address": {
169 | "street": "Ellsworth Summit",
170 | "suite": "Suite 729",
171 | "city": "Aliyaview",
172 | "zipcode": "45169",
173 | "geo": {
174 | "lat": "-14.3990",
175 | "lng": "-120.7677"
176 | }
177 | },
178 | "phone": "586.493.6943 x140",
179 | "website": "jacynthe.com",
180 | "company": {
181 | "name": "Abernathy Group",
182 | "catchPhrase": "Implemented secondary concept",
183 | "bs": "e-enable extensible e-tailers"
184 | }
185 | },
186 | {
187 | "id": 9,
188 | "name": "Glenna Reichert",
189 | "username": "Delphine",
190 | "email": "Chaim_McDermott@dana.io",
191 | "address": {
192 | "street": "Dayna Park",
193 | "suite": "Suite 449",
194 | "city": "Bartholomebury",
195 | "zipcode": "76495-3109",
196 | "geo": {
197 | "lat": "24.6463",
198 | "lng": "-168.8889"
199 | }
200 | },
201 | "phone": "(775)976-6794 x41206",
202 | "website": "conrad.com",
203 | "company": {
204 | "name": "Yost and Sons",
205 | "catchPhrase": "Switchable contextually-based project",
206 | "bs": "aggregate real-time technologies"
207 | }
208 | },
209 | {
210 | "id": 10,
211 | "name": "Clementina DuBuque",
212 | "username": "Moriah.Stanton",
213 | "email": "Rey.Padberg@karina.biz",
214 | "address": {
215 | "street": "Kattie Turnpike",
216 | "suite": "Suite 198",
217 | "city": "Lebsackbury",
218 | "zipcode": "31428-2261",
219 | "geo": {
220 | "lat": "-38.2386",
221 | "lng": "57.2232"
222 | }
223 | },
224 | "phone": "024-648-3804",
225 | "website": "ambrose.net",
226 | "company": {
227 | "name": "Hoeger LLC",
228 | "catchPhrase": "Centralized empowering task-force",
229 | "bs": "target end-to-end models"
230 | }
231 | }
232 | ]
--------------------------------------------------------------------------------
/docs/resources/follow.md:
--------------------------------------------------------------------------------
1 | # Who to follow
2 |
3 | The Haxe community is a pleasant one.
4 | So if you have questions, just go to the [community.haxe](http://community.haxe.org/) and ask it.
5 |
6 | You can also be non verbal and just follow Haxe people on Twitter for example.
7 | I have compiled a list of Haxe peeps with their speciality.
8 |
9 |
10 | [General](#haxe-in-general) / [Java](#java) / [Python](#python) / [C++](#c) / [C#](#c) / [JavaScript](#javascript--nodejs) / [PHP](#php) / [Flash](#flashas3games) / [Lua](#lua)
11 |
12 |
13 | ## Haxe in general
14 |
15 | People how work on the Haxe compiler and thus are super smart!
16 | Specially I want to point out __Nicolas Cannasse__, who is the creator of Haxe but not the **only** one who works on Haxe.
17 | You see that this is a big international group of talented developers.
18 |
19 | | Name | Github | Twitter | Blog |
20 | |------|--------|---------|------|
21 | | Nicolas Cannasse | [ncannasse](https://github.com/ncannasse) | [ncannasse](https://twitter.com/ncannasse) | [http://ncannasse.fr/](http://ncannasse.fr/) |
22 | | Simon Krajewski `1` | [Simn](https://github.com/Simn) | | |
23 | | Cauê Waneck | [waneck](https://github.com/waneck) | [cwaneck](https://twitter.com/cwaneck) | |
24 | | Hugh Sanderson | [hughsando](https://github.com/hughsando) | [gamehaxe](https://twitter.com/gamehaxe) | [http://gamehaxe.com/](http://gamehaxe.com/) |
25 | | Andy Li | [andyli](https://github.com/andyli) | [andy_li](https://twitter.com/andy_li) | [http://blog.onthewings.net/](http://blog.onthewings.net/) |
26 | | Dan Korostelev | [nadako](https://github.com/nadako) | [nadako](https://twitter.com/nadako) | |
27 | | Bruno Garcia | [aduros](https://github.com/aduros) | [b_garcia](https://twitter.com/b_garcia) | |
28 | | Jason O'Neil | [jasononeil](https://github.com/jasononeil/) | | [http://jasono.co/](http://jasono.co/) |
29 | | frabbit `?` | [frabbit](https://github.com/frabbit) | | |
30 | | Joshua Granick `5` | [jgranick](https://github.com/jgranick) | [singmajesty](https://twitter.com/singmajesty) | [http://www.joshuagranick.com/](http://www.joshuagranick.com/) |
31 | | Mark Knol `6` | [mknol](https://twitter.com/mknol) | [markknol](https://github.com/markknol) |
32 |
33 |
34 |
35 | ## JavaScript / Node.js
36 |
37 | Haxe developers are by nature inquisitive and mostly don't specialise in one language/target. The following names are people that I associate with Javascript and Node.js.
38 |
39 | | Name | Github | Twitter | Blog |
40 | |------|--------|---------|------|
41 | | Franco Ponticelli | [fponticelli](https://github.com/fponticelli) | [fponticelli](https://twitter.com/fponticelli) | [http://www.weblob.net/](http://www.weblob.net/)|
42 | | Philippe Elsass | [elsassph](https://github.com/elsassph) | [elsassph](https://twitter.com/elsassph) | [http://philippe.elsass.me/](http://philippe.elsass.me/)|
43 | | Andy Li | [andyli](https://github.com/andyli) | [andy_li](https://twitter.com/andy_li) | [http://blog.onthewings.net/](http://blog.onthewings.net/) |
44 | | Clément Charmet | [clemos](https://github.com/clemos) | [clemenchar](https://twitter.com/clemenchar) | |
45 | | Dan Korostelev | [nadako](https://github.com/nadako) | [nadako](https://twitter.com/nadako) | |
46 |
47 |
48 |
49 | ## Python
50 |
51 | This is a small group, but follow these for more info/question about the Python target.
52 |
53 | | Name | Github | Twitter | Blog |
54 | |------|--------|---------|------|
55 | | Andy Li | [andyli](https://github.com/andyli) | [andy_li](https://twitter.com/andy_li) | [http://blog.onthewings.net/](http://blog.onthewings.net/) |
56 | | Dan Korostelev | [nadako](https://github.com/nadako) | [nadako](https://twitter.com/nadako) | |
57 | | frabbit `?` | [frabbit](https://github.com/frabbit) | | |
58 |
59 |
60 |
61 | ## PHP
62 |
63 | This used to be Franco Ponticelli, but I am not sure that is still the case.
64 | So I added some dev who are associated with PHP. But some reason PHP target is not popular in the Haxe community.
65 | I think its AWESOME!!!!
66 |
67 | | Name | Github | Twitter | Blog |
68 | |------|--------|---------|------|
69 | | Jason O'Neil | [jasononeil](https://github.com/jasononeil/) | | [http://jasono.co/](http://jasono.co/) |
70 | | Franco Ponticelli | [fponticelli](https://github.com/fponticelli) | [fponticelli](https://twitter.com/fponticelli) | [http://www.weblob.net/](http://www.weblob.net/)|
71 | | Alexander Kuzmenko `2` | [RealyUniqueName](https://github.com/RealyUniqueName) | [RealyUniqueName](https://twitter.com/RealyUniqueName) | |
72 | | Andreas Mokros `3` | [mockey](https://github.com/mockey) | | |
73 |
74 |
75 |
76 | ## Lua
77 |
78 | I know nothing about Lua, so this is the default info that I know.
79 |
80 | | Name | Github | Twitter | Blog |
81 | |------|--------|---------|------|
82 | | Justin Donaldson | [jdonaldson](https://github.com/jdonaldson) | | |
83 |
84 |
85 |
86 | ## Java
87 |
88 | Don't know a lot about this target, so here it is.
89 |
90 | | Name | Github | Twitter | Blog |
91 | |------|--------|---------|------|
92 | | Cauê Waneck | [waneck](https://github.com/waneck) | [cwaneck](https://twitter.com/cwaneck) | |
93 | | Simon Krajewski `1` | [Simn](https://github.com/Simn) | | |
94 |
95 |
96 | ## Cs
97 |
98 | I know nothing about C#, so this is what I know.
99 |
100 | | Name | Github | Twitter | Blog |
101 | |------|--------|---------|------|
102 | | Simon Krajewski `1` | [Simn](https://github.com/Simn) | | |
103 | | Cauê Waneck | [waneck](https://github.com/waneck) | [cwaneck](https://twitter.com/cwaneck) | |
104 |
105 |
106 |
107 | ## C++
108 |
109 | Don't know a lot about this target, so here it is.
110 |
111 | | Name | Github | Twitter | Blog |
112 | |------|--------|---------|------|
113 | | Hugh Sanderson | [hughsando](https://github.com/hughsando) | [gamehaxe](https://twitter.com/gamehaxe) | [http://gamehaxe.com/](http://gamehaxe.com/) |
114 | | Joshua Granick `5`| [jgranick](https://github.com/jgranick) | [singmajesty](https://twitter.com/singmajesty) | [http://www.joshuagranick.com/](http://www.joshuagranick.com/) |
115 |
116 |
117 | ## Flash/AS3/Games
118 |
119 | ActionScript is a dying art, but its still used as a quick Haxe target to test and build games in.
120 | You still see it a lot with [Lodum Dare](http://ludumdare.com/compo/).
121 | That's why I have added a list of known game-developers who are cool and helpful.
122 |
123 | | Name | Github | Twitter | Blog |
124 | |-------|-------|---------|------|
125 | | Nicolas Cannasse | [ncannasse](https://github.com/ncannasse) | [ncannasse](https://twitter.com/ncannasse) | [http://ncannasse.fr/](http://ncannasse.fr/) |
126 | | Joshua Granick `5` | [jgranick](https://github.com/jgranick) | [singmajesty](https://twitter.com/singmajesty) | [http://www.joshuagranick.com/](http://www.joshuagranick.com/) |
127 | | Lars Doucet | [larsiusprime](https://github.com/larsiusprime) | [larsiusprime](https://twitter.com/larsiusprime) | |
128 |
129 |
130 |
131 |
132 |
133 | ------
134 |
135 |
136 | * `?` I can't find his real name, but he exists!
137 | * `1` Simn is not easy to follow but very important for Haxe!
138 | * `2` Currently working on PHP7, which is really exciting stuff.
139 | * `3` Unofficial maintainer of the current PHP target
140 | * `5` Joshua is not a maintainer, but also a very helpful guy and co-creator of [OpenFL](http://www.openfl.org/).
141 | * `6` Documentation is __the most important part__ of an open source project!!!!
142 |
--------------------------------------------------------------------------------