front_idill/extern/fajran-npTuioClient/example/paint.html
author bastiena
Fri, 06 Apr 2012 10:44:54 +0200
changeset 21 e4e5f02787a1
child 28 9ccef81f02ab
permissions -rw-r--r--
Front IDILL : Added Communication extern named fajran-npTuioClient It contains the project generating a dll used as a browser plugin.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     1
<!DOCTYPE html>
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     2
<html>
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     3
<head><title>TUIO Client plugin test</title>
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     4
<style type="text/css">
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     5
canvas { border: 1px solid black; }
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     6
</style>
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     7
<script type="text/javascript">
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     8
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     9
var canvas;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    10
var ctx;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    11
var w = 300;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    12
var h = 300;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    13
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    14
function tuio_object_add(sid, fid, x, y, a) {
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    15
}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    16
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    17
function tuio_object_update(sid, fid, x, y, a) {
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    18
}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    19
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    20
function tuio_object_remove(sid, fid, x, y, a) {
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    21
}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    22
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    23
function tuio_cursor_add(sid, fid, x, y) {
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    24
}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    25
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    26
function tuio_cursor_update(sid, fid, x, y) {
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    27
	var px = x * w;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    28
	var py = y * h;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    29
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    30
	ctx.beginPath();
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    31
	ctx.fillStyle = "rgba(0, 0, 200, 0.2)";
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    32
	ctx.arc(px, py, 5, 0, 2*Math.PI, true);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    33
	ctx.fill();
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    34
}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    35
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    36
function tuio_cursor_remove(sid, fid, x, y) {
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    37
}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    38
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    39
function tuio_callback(type, sid, fid, x, y, a) {
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    40
	if (type == 0) {
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    41
		tuio_object_add(sid, fid, x, y, a);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    42
	}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    43
	else if (type == 1) {
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    44
		tuio_object_update(sid, fid, x, y, a);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    45
	}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    46
	else if (type == 2) {
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    47
		tuio_object_remove(sid, fid, x, y, a);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    48
	}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    49
	else if (type == 3) {
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    50
		tuio_cursor_add(sid, fid, x, y);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    51
	}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    52
	else if (type == 4) {
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    53
		tuio_cursor_update(sid, fid, x, y);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    54
	}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    55
	else if (type == 5) {
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    56
		tuio_cursor_remove(sid, fid, x, y);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    57
	}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    58
}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    59
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    60
function ol() {
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    61
	canvas = document.getElementById('c');
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    62
	ctx = canvas.getContext('2d');
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    63
}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    64
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    65
</script>
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    66
</head>
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    67
<body onload="ol()">
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    68
	
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    69
<canvas id="c" width="300" height="300" style="top:0px; left:0px; width: 300px; height: 300px;"></canvas>
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    70
<object id="tuio" type="application/x-tuio">Plugin FAILED to load</object>
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    71
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    72
</body>
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    73
</html>