added readme and example

This commit is contained in:
2018-04-25 22:04:09 +03:00
parent 373ee7703d
commit cb405efd26
10 changed files with 261 additions and 5 deletions

52
example/gulpfile.js Normal file
View File

@@ -0,0 +1,52 @@
const gulp = require('gulp');
const gulpClean = require('gulp-clean');
const packageInfo = require('./package.json');
const {Sdk, Haxe, Project} = require('gulp-haxetool');
//Sdk.dir = '/opt/sdk';
exports.clean = function clean() {
return gulp.src('target/*', {read: false}).pipe(gulpClean());
};
exports.install = function install() {
const haxe = new Haxe();
return haxe.prepare().then(() => haxe.install(packageInfo.haxeDependencies));
};
const config = new Project.Config({
meta: {
title: 'Application',
filename: 'app',
icon: './resources/icon.jpg',
pack: 'com.example',
author: 'Anonim <anonim@anonim.com>',
company: 'Any company',
version: packageInfo.version,
},
name: 'app',
libs: packageInfo.haxeDependencies,
sources: ['src'],
assets: ['resources'],
main: 'Main',
});
const project = new Project(
Project.BuildSystem.OPENFL,
[
Project.Platform.FLASH,
Project.Platform.HTML5,
Project.Platform.LINUX,
],
config
).bind(module, gulp);
module.exports.default = gulp.series(
exports.clean,
exports.install,
module.exports['app:flash:build'],
module.exports['app:html5:build'],
module.exports['app:linux:build'],
module.exports['app:flash:pack'],
module.exports['app:linux:pack'],
);

14
example/package.json Normal file
View File

@@ -0,0 +1,14 @@
{
"name": "app",
"version": "0.0.1",
"devDependencies": {
"gulp": "^4.0.0",
"gulp-clean": "^0.4.0",
"gulp-haxetool": "file:../../gulp-haxetool"
},
"haxeDependencies": {
"lime": "6.0.1",
"openfl": "7.0.0",
"hxcpp": "3.4.188"
}
}

BIN
example/resources/icon.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

14
example/src/Main.hx Normal file
View File

@@ -0,0 +1,14 @@
import flash.display.Shape;
import flash.Lib;
class Main {
public static function main() {
trace("Hello world!");
var shape = new Shape();
shape.graphics.beginFill(0x00ff00);
shape.graphics.drawCircle(50, 50, 20);
shape.graphics.endFill();
Lib.current.addChild(shape);
}
}