Skip to content

Commit

Permalink
-updated to Haxe 3
Browse files Browse the repository at this point in the history
-removing submodules
  • Loading branch information
rjanicek committed Oct 9, 2013
1 parent e1df28b commit 3fe9113
Show file tree
Hide file tree
Showing 159 changed files with 7,372 additions and 122 deletions.
6 changes: 0 additions & 6 deletions .gitmodules
@@ -1,9 +1,3 @@
[submodule "lib/jasmine-haxe"]
path = lib/jasmine-haxe
url = git://github.com/rjanicek/jasmine-haxe.git
[submodule "lib/janicek-core-haxe"]
path = lib/janicek-core-haxe
url = git://github.com/rjanicek/janicek-core-haxe.git
[submodule "lib/html5-haxe"]
path = lib/html5-haxe
url = git://github.com/rjanicek/html5-haxe.git
39 changes: 39 additions & 0 deletions bin/index.css
@@ -0,0 +1,39 @@
body { margin:0; padding:0; }

canvas { position: absolute; }

fieldset {
position:absolute;
top:10px;
left:10px;
padding-top:10px;
font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333333;
background:#C38EC7;
-moz-border-radius:5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}

label {
clear: both;
display: block;
width: 125px;
float: left;
}

input[type=text], input[type=file], input[type=range] { width: 110px; }

input[type=file] { color: #C38EC7; }

input[type=range] { border-bottom-left-radius: 5px; }

#seed,#shapeSeed { width: 50px; }

img { width: 110px; }

.section { margin-top: 10px; }

.hide { display: none; }

.timer { display: inline-block; text-align: right; width: 40px; }
.total { border-top: solid 1px black; }
71 changes: 15 additions & 56 deletions bin/index.html
@@ -1,65 +1,20 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<!doctype html>
<html lang="en-us">
<head>
<title>voronoi-map-haxe</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="en" />

<style>

fieldset {
position:absolute;
top:10px;
left:10px;
padding-top:10px;
font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333333;
background:#C38EC7;
-moz-border-radius:5px;
border-radius: 5px;
-webkit-border-radius: 5px;
}

label {
clear: both;
display: block;
width: 125px;
float: left;
}

input[type=text], input[type=file], input[type=range] {
width: 110px;
}

input[type=file] {
color: #C38EC7;
}

input[type=range] {
border-bottom-left-radius: 5px;
}

#seed,#shapeSeed {
width: 50px;
}

img {
width: 110px;
}

.section {
margin-top: 10px;
}

</style>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="index.css">
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
</head>
<body style="margin:0px;padding:0px;">
<body>
<canvas id="map"></canvas>
<fieldset id="fieldset">
<div id="fields">
<div style="font-size:15px;">voronoi-map-haxe</div>
<br/>
<a href="https://github.com/rjanicek/voronoi-map-haxe">source code on GitHub</a>
<br/><br/>
<div><label for="seed" title="integer or text">seed</label><input id="seed" type="text" value="haxe!" /><button id="random">random</button></div>
<div><label for="seed" title="integer or text">seed</label><input id="seed" type="text" value="voronoi!" /><button id="random">random</button></div>
<div>
<label for="islandShape">island shape</label>
<select id="islandShape">
Expand All @@ -71,15 +26,15 @@
<option>square</option>
</select>
</div>
<div><label for="shapeSeed" title="integer or text">island shape seed</label><input id="shapeSeed" type="text" value="haxe!" /><button id="shapeRandom">random</button></div>
<div><label for="shapeSeed" title="integer or text">island shape seed</label><input id="shapeSeed" type="text" value="voronoi!" /><button id="shapeRandom">random</button></div>
<div style="display:none;"><label for="imageFile" title="black & white images work best">image file</label><input type="file" id="imageFile" name="files[]" /></div>
<div style="display:none;"><label for="imageThumb">&nbsp;</label><img id="imageThumb" /></div>
<div style="display:none;"><label for="invertImage">invert image?</label><input id="invertImage" type="checkbox" checked /></div>
<div style="display:none;"><label for="imageThreshold" title="0 to 255">threshold</label><input id="imageThreshold" type="range" min="0" max="255" value="127" /></div>
<div style="display:none;"><label for="islandFactor" title="1.0 means no small islands; 2.0 leads to a lot">island factor</label><input id="islandFactor" type="text" value="1.07" /></div>
<div><label for="oceanRatio" title="0 = least ocean, 1 = most ocean">ocean ratio</label><input id="oceanRatio" type="text" value="0.5" /></div>
<div><label for="width">width</label><input id="width" type="text" /></div>
<div><label for="height">height</label><input id="height" type="text" /></div>
<div><label for="width">width</label><input id="width" type="text" value="" /></div>
<div><label for="height">height</label><input id="height" type="text" value="" /></div>
<div><label for="numberOfPoints">number of points</label><input id="numberOfPoints" type="text" value="1000" /></div>
<div><label for="numberOfLands">number of lands</label><input id="numberOfLands" type="text" value="" /></div>
<div><label for="lakeThreshold" title="0 to 1, fraction of water corners for water polygon">lake threshold</label><input id="lakeThreshold" type="text" value="0.3" /></div>
Expand All @@ -105,6 +60,10 @@
<div><label for="viewWatersheds">watersheds?</label><input id="viewWatersheds" type="checkbox" /></div>
<div><label for="viewEdges">edges?</label><input id="viewEdges" type="checkbox" /></div>
<div><label for="addNoise">add noise?</label><input id="addNoise" type="checkbox" checked /></div>
<br/>
<div><label>generate</label><div class="timer"><span id="generateMs">0</span></div> ms</div>
<div><label>render</label><div class="timer"><span id="renderMs">0</span></div> ms</div>
<div><label>&nbsp;</label><div class="timer"><span id="totalMs" class="total">0</span></div> ms</div>
</div>
<a id="toggle" style="float:right;">hide</a>
</fieldset>
Expand Down
5 changes: 3 additions & 2 deletions build-test.hxml
@@ -1,7 +1,8 @@
-cp test/src
-cp src
-cp lib/janicek-core-haxe/src
-cp lib/janicek-core-haxe-6630d81bc734a8886e0156fd3a95e7dd3104bd0a/src
-cp lib/jasmine-haxe/src
-js test/bin/voronoi-map-test.js
-main Main
-debug
-debug
-D js-classic
3 changes: 1 addition & 2 deletions build.hxml
Expand Up @@ -3,6 +3,5 @@
-cp lib/html5-haxe
-js bin/voronoi-map.js
-main voronoimap.Main
--js-modern
--dead-code-elimination
-dce full
-debug
1 change: 0 additions & 1 deletion lib/html5-haxe
Submodule html5-haxe deleted from 7423e2
25 changes: 25 additions & 0 deletions lib/html5-haxe/README
@@ -0,0 +1,25 @@

html5-haxe
==========
HaXe/Javascript html5 typedef signatures not available in the haXe std library.

Tested with haXe 2.07 and Chrome.

html5 - haXe html5 bindings.
html5Test - Jasmine specs for html5.

LINKS
-----
https://github.com/tong/hx.html5

http://www.w3.org/TR/html5/

https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html

http://www.w3.org/TR/webstorage/
http://www.w3.org/TR/file-system-api/
http://dev.w3.org/geo/api/
https://developer.mozilla.org/En/E4X/Processing_XML_with_E4X

http://www.webrtc.org/
http://dev.w3.org/2011/webrtc/editor/webrtc.html
5 changes: 5 additions & 0 deletions lib/html5-haxe/haxelib.xml
@@ -0,0 +1,5 @@
<project name="html5" url="https://github.com/tong/hx.html5" license="Public">
<user name="tong"/>
<description>Javascript html5 typedef signatures</description>
<version name="1.1">Misc</version>
</project>
31 changes: 31 additions & 0 deletions lib/html5-haxe/html5/ApplicationCache.hx
@@ -0,0 +1,31 @@
package html5;

/**
Create instance: var cache : ApplicationCache = untyped window.applicationCache;
*/
@:native("window.applicationCache") extern class ApplicationCache {

static var UNCACHED(default,null) : Int;
static var IDLE(default,null) : Int;
static var CHECKING(default,null) : Int;
static var DOWNLOADING(default,null) : Int;
static var UPDATEREADY(default,null) : Int;
static var OBSOLETE(default,null) : Int;

var onchecking : Void->Void;
var onerror : Void->Void;
var onnoupdate : Void->Void;
var ondownloading : Void->Void;
var onprogress : Void->Void;
var onupdateready : Void->Void;
var oncached : Void->Void;
var onobsolete : Void->Void;

var status(default,null) : Int;
//var status(default,null) : ApplicationCacheStatus;

function update() : Void;
function abort() : Void;
function swapCache() : Void;

}
6 changes: 6 additions & 0 deletions lib/html5-haxe/html5/Audio.hx
@@ -0,0 +1,6 @@
package html5;
//http://www.w3.org/TR/html5/video.html#audio

extern class Audio extends HTMLMediaElement {
function new( ?src : String ) : Void;
}
8 changes: 8 additions & 0 deletions lib/html5-haxe/html5/Blob.hx
@@ -0,0 +1,8 @@
package html5;

@:native("Blob")
extern class Blob {
var size(default,null) : Float;
var type(default,null) : String;
function slice( start : Int, length : Int, ?contentType : String ) : Blob;
}
11 changes: 11 additions & 0 deletions lib/html5-haxe/html5/BlobBuilder.hx
@@ -0,0 +1,11 @@
package html5;

//TODO
//extern class BlobBuilder {
@:native("window.WebKitBlobBuilder") extern class BlobBuilder {
function new() : Void;
@:overload(function(data:ArrayBuffer):Void{})
@:overload(function(data:Blob):Void{})
function append( data : String, ?endings : String ) : Void;
function getBlob( ?contentType : String ) : Blob;
}
10 changes: 10 additions & 0 deletions lib/html5-haxe/html5/Canvas.hx
@@ -0,0 +1,10 @@
package html5;
import js.html.CanvasElement;

typedef Canvas = { >CanvasElement,
var width : Int;
var height : Int;
function getContext( id : String ) : CanvasRenderingContext2D;
//DOMString toDataURL(optional in DOMString type, in any... args);
function toDataURL( ?mimetype : String ) : String;
}
5 changes: 5 additions & 0 deletions lib/html5-haxe/html5/CanvasGradient.hx
@@ -0,0 +1,5 @@
package html5;

typedef CanvasGradient = {
function addColorStop( offset : Float, color : String ) : Void;
}
4 changes: 4 additions & 0 deletions lib/html5-haxe/html5/CanvasPattern.hx
@@ -0,0 +1,4 @@
package html5;

typedef CanvasPattern = {
}
5 changes: 5 additions & 0 deletions lib/html5-haxe/html5/CanvasPixelArray.hx
@@ -0,0 +1,5 @@
package html5;

extern class CanvasPixelArray implements ArrayAccess<Dynamic> {
var length : Int;
}
92 changes: 92 additions & 0 deletions lib/html5-haxe/html5/CanvasRenderingContext2D.hx
@@ -0,0 +1,92 @@
package html5;

typedef CanvasRenderingContext2D = {

// back-reference to the canvas
var canvas(default,null) : Canvas;

// state
function save() : Void;
function restore() : Void;

// transformations (default transform is the identity matrix)
function scale( x : Float, y : Float ) : Void;
function rotate( angle : Float ) : Void;
function translate( x : Float, y : Float ) : Void;
function transform( m11 : Float, m12 : Float, m21 : Float, m22 : Float, dx : Float, dy : Float ) : Void;
function setTransform( m11 : Float, m12 : Float, m21 : Float, m22 : Float, dx : Float, dy : Float ) : Void;
function rect( x : Float, y : Float, width : Float, height : Float ) : Void;

// compositing
var globalAlpha : Float;
var globalCompositeOperation : String;

// colors and styles
var strokeStyle : Dynamic;
var fillStyle : Dynamic;
function createLinearGradient( x0 : Float, y0 : Float, x1 : Float, y1 : Float ) : CanvasGradient;
function createRadialGradient( x0 : Float, y0 : Float, r0 : Float, x1 : Float, y1 : Float, r1 : Float ) : CanvasGradient;
@:overload(function (image:HTMLVideoElement,repetition:String):Void{})
@:overload(function (image:Canvas,repetition:String):Void{})
function createPattern( image : Image, repetition : String ) : Void;

// line caps/joins
var lineWidth : Float;
var lineCap : String;
var lineJoin : String;
var miterLimit : Float;

// shadows
var shadowOffsetX : Float;
var shadowOffsetY : Float;
var shadowBlur : Float;
var shadowColor : String;

// rects
function clearRect( x : Int, y : Int, w : Int, h : Int ) : Void;
function fillRect( x : Int, y : Int, w : Int, h : Int ) : Void;
function strokeRect( x : Int, y : Int, w : Int, h : Int ) : Void;

// path API
function beginPath() : Void;
function closePath() : Void;
function moveTo( x : Float, y : Float ) : Void;
function lineTo( x : Float, y : Float ) : Void;
function quadraticCurveTo( cpx : Float, cpy : Float, x : Float, y : Float ) : Void;
function bezierCurveTo( cp1x : Float, cp1y : Float, cp2x : Float, cp2y : Float, x : Float, y : Float ) : Void;
function arcTo( x1 : Float, y1 : Float, x2 : Float, y2 : Float, radius : Float ) : Void;
function arc( x : Float, y : Float, radius : Float, startAngle : Float, endAngle : Float, anticlockwise : Bool ) : Void;
function fill() : Void;
function stroke() : Void;
function drawSystemFocusRing( element : Dynamic ) : Void;
function drawCustomFocusRing( element : Dynamic ) : Bool;
function scrollPathIntoView() : Void;
function clip() : Void;
function isPointInPath( x : Float, y : Float ) : Bool;

// text
var font : String;
var textAlign : String;
var textBaseline : String;
function fillText( text : String, x : Float, y : Float, ?maxWidth : Float ) : Void;
function strokeText( text : String, x : Float, y : Float, ?maxWidth : Float ) : Void;
function measureText( text : String ) : TextMetrics;

@:overload(function (image:HTMLVideoElement,sx:Float,sy:Float,sw:Float,sh:Float,dx:Float,dy:Float,dw:Float,dh:Float) : Void {} )
@:overload(function (image:HTMLVideoElement,dx:Float,dy:Float,dw:Float,dh:Float) : Void {} )
@:overload(function (image:HTMLVideoElement,dx:Float,dy:Float) : Void {} )
@:overload(function (image:Canvas,sx:Float,sy:Float,sw:Float,sh:Float,dx:Float,dy:Float,dw:Float,dh:Float) : Void {} )
@:overload(function (image:Canvas,dx:Float,dy:Float,dw:Float,dh:Float) : Void {} )
@:overload(function (image:Canvas,dx:Float,dy:Float) : Void {} )
@:overload(function (image:Image,sx:Float,sy:Float,sw:Float,sh:Float,dx:Float,dy:Float,dw:Float,dh:Float) : Void {} )
@:overload(function (image:Image,dx:Float,dy:Float,dw:Float,dh:Float) : Void {} )
function drawImage( image : Image, dx : Float, dy : Float ) : Void;

// pixel manipulation
@:overload(function (imagedata:ImageData) : Void {} )
function createImageData( sw : Float, sh : Float ) : Void;
function getImageData( sx : Float, sx : Float, sw : Float, sh : Float ) : ImageData;
@:overload(function (imagedata:ImageData,?dirtyX:Float,?dirtyY:Float,?dirtyWidth:Float,?dirtyHeight:Float):Void{})
function putImageData( imagedata : ImageData, dx : Float, dy : Float ) : Void;

}

0 comments on commit 3fe9113

Please sign in to comment.