front_idill/extern/fajran-npTuioClient/example/paint.html
author bastiena
Thu, 12 Apr 2012 15:33:25 +0200
changeset 28 9ccef81f02ab
parent 21 e4e5f02787a1
permissions -rw-r--r--
Charset set to UTF-8 without bom tab replaced by 4 spaces \r\n replaced by \n in non cs files
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) {
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    27
    var px = x * w;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    28
    var py = y * h;
21
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    29
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    30
    ctx.beginPath();
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    31
    ctx.fillStyle = "rgba(0, 0, 200, 0.2)";
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    32
    ctx.arc(px, py, 5, 0, 2*Math.PI, true);
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    33
    ctx.fill();
21
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) {
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    40
    if (type == 0) {
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    41
        tuio_object_add(sid, fid, x, y, a);
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    42
    }
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    43
    else if (type == 1) {
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    44
        tuio_object_update(sid, fid, x, y, a);
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    45
    }
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    46
    else if (type == 2) {
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    47
        tuio_object_remove(sid, fid, x, y, a);
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    48
    }
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    49
    else if (type == 3) {
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    50
        tuio_cursor_add(sid, fid, x, y);
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    51
    }
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    52
    else if (type == 4) {
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    53
        tuio_cursor_update(sid, fid, x, y);
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    54
    }
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    55
    else if (type == 5) {
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    56
        tuio_cursor_remove(sid, fid, x, y);
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    57
    }
21
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() {
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    61
    canvas = document.getElementById('c');
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    62
    ctx = canvas.getContext('2d');
21
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()">
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    68
    
21
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>