front_idill/extern/fajran-tuiojs/connector/npTuioClient/tuiojs.npTuioClient.js
author bastiena
Thu, 12 Apr 2012 15:33:25 +0200
changeset 28 9ccef81f02ab
parent 27 6c08d4d7219e
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:
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
     1
/*
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
     2
    Modified by alexandre.bastien@iri.centrepompidou.fr to manage TUIO strings.
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
     3
*/
25
a7b0e40bcab0 Front IDILL :
bastiena
parents:
diff changeset
     4
a7b0e40bcab0 Front IDILL :
bastiena
parents:
diff changeset
     5
tuio.setConnector({
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
     6
    _failmsg: "Unable to initialize npTuioClient plugin.",
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
     7
    _id: "__tuiojs_connector_npTuioClient",
25
a7b0e40bcab0 Front IDILL :
bastiena
parents:
diff changeset
     8
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
     9
    start: function() {
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    10
        var el = document.getElementById(this._id);
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    11
        if (el == undefined) {
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    12
            var el = document.createElement('object');
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    13
            el.setAttribute('id', this._id);
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    14
            el.setAttribute('type', 'application/x-tuio');
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    15
            el.appendChild(document.createTextNode(this._failmsg));
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    16
            document.body.appendChild(el);
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    17
        }
25
a7b0e40bcab0 Front IDILL :
bastiena
parents:
diff changeset
    18
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    19
        // TODO: check if the plugin can be loaded. 
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    20
        //       if so, hide the plugin (display:none).
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    21
    },
25
a7b0e40bcab0 Front IDILL :
bastiena
parents:
diff changeset
    22
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    23
    stop: function() {
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    24
        var el = document.getElementById(this._id);
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    25
        if (el != undefined) {
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    26
            document.body.removeChild(el);
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    27
        }
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    28
    }
25
a7b0e40bcab0 Front IDILL :
bastiena
parents:
diff changeset
    29
});
a7b0e40bcab0 Front IDILL :
bastiena
parents:
diff changeset
    30
27
6c08d4d7219e Middleware :
bastiena
parents: 26
diff changeset
    31
function tuio_callback(type, sid, fid, x, y, z, angle, code)  {
6c08d4d7219e Middleware :
bastiena
parents: 26
diff changeset
    32
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    33
    if(type < 6)
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    34
        tuio.cursorCallback(type, sid, fid, x, y, z, angle);
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    35
    else
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 27
diff changeset
    36
        tuio.stringCallback(type, sid, code);
25
a7b0e40bcab0 Front IDILL :
bastiena
parents:
diff changeset
    37
}
a7b0e40bcab0 Front IDILL :
bastiena
parents:
diff changeset
    38