Processing 如何通过处理更改addTuioCursor()实现?
我目前正在使用TUIO库的处理语言开发一款小型多点触控游戏。Processing 如何通过处理更改addTuioCursor()实现?,processing,multi-touch,tuio,Processing,Multi Touch,Tuio,我目前正在使用TUIO库的处理语言开发一款小型多点触控游戏。 我想手动设置CursorID,这取决于添加光标的屏幕的哪一半,因为只有在调用该方法时,它才会打印一条消息,如下所示 // called when a cursor is added to the scene void addTuioCursor(TuioCursor tcur) { if (verbose) println("add cur "+tcur.getCursorID()+" ("+tcur.getSessionID()
我想手动设置CursorID,这取决于添加光标的屏幕的哪一半,因为只有在调用该方法时,它才会打印一条消息,如下所示
// called when a cursor is added to the scene
void addTuioCursor(TuioCursor tcur) {
if (verbose) println("add cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+ ") " +tcur.getX()+" "+tcur.getY());
//redraw();
}
我四处搜索了一下,但什么也没找到。有没有办法更改addTuioCursor()方法的实现 您应该仍然能够在上面设置do add逻辑。 例如,您将拥有一个单独的自定义游标ID列表,该列表将根据TuioCursor事件进行更新 这只是一个示例,假设您有一个
Integer
的ArrayList
来添加您的自定义ID:
// called when a cursor is added to the scene
void addTuioCursor(TuioCursor tcur) {
if (verbose) println("add cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+ ") " +tcur.getX()+" "+tcur.getY());
// if newly added cursor is on the left half of the screen
if(tcur.getX() < width / 2){
// set a custom ID
int customID = (int)random(0,100);
// add a custom ID
//leftCursorsList.add(customID);
}
}
//将光标添加到场景时调用
void addTuioCursor(TuioCursor tcur){
如果(详细)println(“添加cur”+tcur.getCursorID()+”(“+tcur.getSessionID()+”)“+tcur.getX()+”+tcur.getY());
//如果新添加的光标位于屏幕的左半部分
if(tcur.getX()
这是intself,可能不是super youself:您可能希望使自定义游标类不仅包含ID,还可以包含x、y或对TuioCursor
的引用,只要满足您的最终目标即可。没有什么可以阻止您基于TUIO事件管理自己的自定义游标数据列表