front_idill/extern/fajran-npTuioClient/example/paint.html
changeset 21 e4e5f02787a1
child 28 9ccef81f02ab
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/front_idill/extern/fajran-npTuioClient/example/paint.html	Fri Apr 06 10:44:54 2012 +0200
@@ -0,0 +1,73 @@
+<!DOCTYPE html>
+<html>
+<head><title>TUIO Client plugin test</title>
+<style type="text/css">
+canvas { border: 1px solid black; }
+</style>
+<script type="text/javascript">
+
+var canvas;
+var ctx;
+var w = 300;
+var h = 300;
+
+function tuio_object_add(sid, fid, x, y, a) {
+}
+
+function tuio_object_update(sid, fid, x, y, a) {
+}
+
+function tuio_object_remove(sid, fid, x, y, a) {
+}
+
+function tuio_cursor_add(sid, fid, x, y) {
+}
+
+function tuio_cursor_update(sid, fid, x, y) {
+	var px = x * w;
+	var py = y * h;
+
+	ctx.beginPath();
+	ctx.fillStyle = "rgba(0, 0, 200, 0.2)";
+	ctx.arc(px, py, 5, 0, 2*Math.PI, true);
+	ctx.fill();
+}
+
+function tuio_cursor_remove(sid, fid, x, y) {
+}
+
+function tuio_callback(type, sid, fid, x, y, a) {
+	if (type == 0) {
+		tuio_object_add(sid, fid, x, y, a);
+	}
+	else if (type == 1) {
+		tuio_object_update(sid, fid, x, y, a);
+	}
+	else if (type == 2) {
+		tuio_object_remove(sid, fid, x, y, a);
+	}
+	else if (type == 3) {
+		tuio_cursor_add(sid, fid, x, y);
+	}
+	else if (type == 4) {
+		tuio_cursor_update(sid, fid, x, y);
+	}
+	else if (type == 5) {
+		tuio_cursor_remove(sid, fid, x, y);
+	}
+}
+
+function ol() {
+	canvas = document.getElementById('c');
+	ctx = canvas.getContext('2d');
+}
+
+</script>
+</head>
+<body onload="ol()">
+	
+<canvas id="c" width="300" height="300" style="top:0px; left:0px; width: 300px; height: 300px;"></canvas>
+<object id="tuio" type="application/x-tuio">Plugin FAILED to load</object>
+
+</body>
+</html>