haxe toolkit for cross-platform applications development

Post on 24-Jun-2015

499 Views

Category:

Software

2 Downloads

Preview:

Click to see full reader

DESCRIPTION

The Haxe Toolkit is a increasingly popular solution when it comes to developing applications which run on multiple platforms. The presentation aims to outline its capabilities, as well as highlighting some available tools, when choosing Haxe for software development

TRANSCRIPT

Cross-platform DevelopmentIntroducing the Haxe Toolkit

by Romuald Halasz, 02.08.2014

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

Presentation structure

Introduction to Haxe- language features

Cross-platform aspects- specific APIs- target specific platforms

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

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

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!');

}

}

}

Language Architecture

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

Haxe Standard Library

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

Haxelib

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

Haxe and multiple platforms

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

first, a bit of context...

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

Platform Use Cases

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

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

OpenFl, NME

- provide support for creating

cross-platform interfaces

- flash-like API (display, events,

text, external, net etc.)

Supported platforms

Take your pick!

OpenFl in practice

Targets:

Desktop: Windows, Mac, Linux

Mobile: iOS, Android, BlackBerry

Web: Tizen, Emscripten, HTML5

Exposes:

OpenGL, Audio, Input

Windowing

Useful native features

Haxe and Mobile

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

For iOS and Android: Basis

HTML5 target works with PhoneGap

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

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

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

Haxe on the Web

Client targets:- JavaScript, ActionScript 3

Server targets:- PHP, Node, Neko

Haxe Web - clients

Haxe and jQuery:

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

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

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

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

});

import JQuery;

class Main {

static public function main():Void {

new JQuery(function():Void {

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

});

}

}

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/

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/');

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/');

}

}

And last but not least, Games!

Libraries:Frameworks: HaxeFlixel, awe6, HaxePunk

A close look at HaxePunk

More information

haxe.orgopenfl.orghaxepunk.com

Thank you very much !

top related