Transcript
Page 1: Haxe Toolkit for cross-platform applications development

Cross-platform DevelopmentIntroducing the Haxe Toolkit

by Romuald Halasz, 02.08.2014

Page 2: Haxe Toolkit for cross-platform applications development

A little bit about me

- started work with QuickBasic, BPascal, C++- Visual Studio 2005, OpenGL, DirectX- PHP, HTML, CSS, JavaScript- Flash, Flex- Haxe, NME- currently hosting TGD Meetup

Page 3: Haxe Toolkit for cross-platform applications development

Presentation structure

Introduction to Haxe- language features

Cross-platform aspects- specific APIs- target specific platforms

Page 4: Haxe Toolkit for cross-platform applications development

Getting acquainted with Haxe

A bit of history:

22 October 2005 by French developer Nicolas Cannasse

Haxe 2.0 was released in July 2008,

Haxe 3 was released in May 2013

open source

Toolkit:

- language

- standard library

- compiler

Page 5: Haxe Toolkit for cross-platform applications development

Language Specifics

- based on ECMAScript standard, similar to ActionScript

- strictly typed

- object oriented

- conditional compilation

- inline calls

- metadata

- type params, constraints, variance

- etc. (pattern matching, abstract types, string interpolation …)

- more info: http://haxe.org/documentation/introduction/language-features.html

Page 6: Haxe Toolkit for cross-platform applications development

What does it look like ?class Test {

static function main():Void {

var people:Array = [

"Elizabeth" => "Programming",

"Joel" => "Design"

];

for (name in people.keys()) {

var job = people[name];

trace('$name does $job for a living!');

}

}

}

Page 7: Haxe Toolkit for cross-platform applications development

Language Architecture

- Haxe API- platform-specific APIs- libraries- frameworks

Page 8: Haxe Toolkit for cross-platform applications development
Page 9: Haxe Toolkit for cross-platform applications development

Haxe Standard Library

- general classes- system (requires platform compilation)- target specific APIs (cpp, cs, flash, php etc.)

Page 10: Haxe Toolkit for cross-platform applications development

Haxelib

- library manager- CLI tool- browse and download libraries: http://lib.haxe.org/

Page 11: Haxe Toolkit for cross-platform applications development

Haxe and multiple platforms

Going cross-platform!Let’s dive right into it.

first, a bit of context...

Page 12: Haxe Toolkit for cross-platform applications development
Page 13: Haxe Toolkit for cross-platform applications development

Targets and Use Cases

Name Kind Static typed Sys Use Cases

Flash byte code Yes No Games, Mobile

Neko byte code No Yes Web, CLI

ActionScript 3 source Yes Yes Games, Mobile, API

JavaScript source No No Web, Desktop, API

PHP source No Yes Web

C++ source Yes Yes Games, CLI, Mobile, Desktop

Java source Yes Yes CLI, Mobile, Desktop

C# source Yes Yes Mobile, Desktop

Python source No Yes CLI, Web, Desktop

Page 14: Haxe Toolkit for cross-platform applications development

Platform Use Cases

We will focus on:- Mobile- Desktop- Web- Games!

Page 15: Haxe Toolkit for cross-platform applications development

Library Spotlight: Lime

“A foundational Haxe framework for cross-platform

native development.”

- abstraction layer

- compile code to C++, JavaScript etc.

Structure

- CLI tools - platform-specific process

- native layer (C++, Objective-C, Java)

- Haxe wrapper

Page 16: Haxe Toolkit for cross-platform applications development

OpenFl, NME

- provide support for creating

cross-platform interfaces

- flash-like API (display, events,

text, external, net etc.)

Page 17: Haxe Toolkit for cross-platform applications development

Supported platforms

Take your pick!

Page 18: Haxe Toolkit for cross-platform applications development

OpenFl in practice

Targets:

Desktop: Windows, Mac, Linux

Mobile: iOS, Android, BlackBerry

Web: Tizen, Emscripten, HTML5

Exposes:

OpenGL, Audio, Input

Windowing

Useful native features

Page 19: Haxe Toolkit for cross-platform applications development

Haxe and Mobile

Targets: C++, HTML5Tools: - cross-platform APIs- libraries: StablexUI, HaxeUI

For iOS and Android: Basis

HTML5 target works with PhoneGap

Page 20: Haxe Toolkit for cross-platform applications development

Targeting iOS, Android, BlackBerryAndroid:

- Android SDK/NDK, Apache ANT, Java JDK

- supported by lime

iOS:

- Xcode required

- target Flash, publish using AIR

BlackBerry:

- OpenFl is compatible with BlackBerry Tablet SDK

- supported by lime

Page 21: Haxe Toolkit for cross-platform applications development

Desktop Targets

Targets: C++, HTML5Tools: Libraries: Waxe (Haxe + wxW)

HTML5 targets work with Node-socket- app runtime- based on Chromium and Node.jshttps://github.com/rogerwang/node-webkit

Page 22: Haxe Toolkit for cross-platform applications development

Targeting Windows, Mac, LinuxWindows:

- Neko (no dependencies)

- C++, Visual Studio required

Mac:

- Neko

- C++, requires Xcode

Linux:

- g++, gcc-multilib required

!! Targeting restricted to current platform

Page 23: Haxe Toolkit for cross-platform applications development

Haxe on the Web

Client targets:- JavaScript, ActionScript 3

Server targets:- PHP, Node, Neko

Page 24: Haxe Toolkit for cross-platform applications development

Haxe Web - clients

Haxe and jQuery:

- Haxe js.jQuery API- jQueryExternForHaxe (library)- more recent jQuery version

- https://github.com/andyli/jQueryExternForHaxe

Page 25: Haxe Toolkit for cross-platform applications development

jQuery Example$(document).ready(function(){

$("#myDiv").hide();

});

import JQuery;

class Main {

static public function main():Void {

new JQuery(function():Void {

new JQuery("#myDiv").hide();

});

}

}

Page 26: Haxe Toolkit for cross-platform applications development

Haxe Web - servers

Haxe JS Kithttps://github.com/clemos/haxe-js-kit

includes Node.js

- NPM libraries:

Mongoose, Connect.js, Express.js, Socket.io, Passport.js,

Atom-shell

Haxenode- Node.js port for Haxe

http://haxenode.herokuapp.com/

Page 27: Haxe Toolkit for cross-platform applications development

Haxenode Example (node)Node.js:

var http = require('http');

var server = http.createServer(

function (req, res) {

res.writeHead(200, {'Content-Type': 'text/plain'});

res.end('Hello World\\n');

}

);

server.listen(1337, "127.0.0.1");

console.log('Server running at http://127.0.0.1:1337/');

Page 28: Haxe Toolkit for cross-platform applications development

Haxenode Example (haxe)import js.Node;

class Haxenode {

public static function main() {

var server = Node.http.createServer(function(req:NodeHttpServerReq, res:NodeHttpServerResp) {

res.setHeader("Content-Type","text/plain");

res.writeHead(200);

res.end('Hello World\\n');

}

);

server.listen(1337,"localhost");

trace('Server running at http://127.0.0.1:1337/');

}

}

Page 29: Haxe Toolkit for cross-platform applications development

And last but not least, Games!

Libraries:Frameworks: HaxeFlixel, awe6, HaxePunk

Page 30: Haxe Toolkit for cross-platform applications development

A close look at HaxePunk

Page 31: Haxe Toolkit for cross-platform applications development

More information

haxe.orgopenfl.orghaxepunk.com

Page 32: Haxe Toolkit for cross-platform applications development

Thank you very much !


Top Related