• c++ 添加 Tuio 接收点


    在项目下新建两个筛选器,添加TUIO中的文件如下,头文件包TUIO官网可下载,这也能下载

    #include "TuioDump.h"//#include <Vision/Samples/Engine/MobileOffroadPlugin/TUIO/TuioDump.h>
    
    //Tuio全局变量
    int port = 3333;
    TuioDump dump;
    TuioClient client(port);
    float KinectTestX=10,KinectTestY=20;
    
     //在场景加载你可以在这里添加你的特定的代码
    client.addTuioListener(&dump);
    client.connect(false);
    #pragma region TuioDump模拟点
    void TuioDump::addTuioObject(TuioObject *tobj) {
        Vision::Message.Add(1, "Add Tuio point.");
        //std::cout << "add obj " << tobj->getSymbolID() << " (" << tobj->getSessionID() << ") "<< tobj->getX() << " " << tobj->getY() << " " << tobj->getAngle() << std::endl;
        KinectTestX=tobj->getX();
        KinectTestY=tobj->getY();
    }
    
    void TuioDump::updateTuioObject(TuioObject *tobj) {
    
        //std::cout << "set obj " << tobj->getSymbolID() << " (" << tobj->getSessionID() << ") "<< tobj->getX() << " " << tobj->getY() << " " << tobj->getAngle() 
        //    << " " << tobj->getMotionSpeed() << " " << tobj->getRotationSpeed() << " " << tobj->getMotionAccel() << " " << tobj->getRotationAccel() << std::endl;
        Vision::Message.Add(1, "Update Tuio point.");
        KinectTestX=tobj->getX();
        KinectTestY=tobj->getY();
    }
    
    void TuioDump::removeTuioObject(TuioObject *tobj) {
        //std::cout << "del obj " << tobj->getSymbolID() << " (" << tobj->getSessionID() << ")" << std::endl;
    }
    
    void TuioDump::addTuioCursor(TuioCursor *tcur) {
        //std::cout << "add cur " << tcur->getCursorID() << " (" <<  tcur->getSessionID() << ") " << tcur->getX() << " " << tcur->getY() << std::endl;
        KinectTestX=tcur->getX();
        KinectTestY=tcur->getY();
    }
    
    void TuioDump::updateTuioCursor(TuioCursor *tcur) {
        //std::cout << "set cur " << tcur->getCursorID() << " (" <<  tcur->getSessionID() << ") " << tcur->getX() << " " << tcur->getY() 
        //<< " " << tcur->getMotionSpeed() << " " << tcur->getMotionAccel() << " " << std::endl;
        KinectTestX=tcur->getX();
        KinectTestY=tcur->getY();
    }
    
    void TuioDump::removeTuioCursor(TuioCursor *tcur) {
        //std::cout << "del cur " << tcur->getCursorID() << " (" <<  tcur->getSessionID() << ")" << std::endl;
    }
    
    void  TuioDump::refresh(TuioTime frameTime) {
        //std::cout << "refresh " << frameTime.getTotalMilliseconds() << std::endl;
    }
    #pragma endregion
    TuioDump模拟点

     会出现如下问题:

    1.原来的 #include "TuioDump.h"添加头文件的方式提示未找到源文件,这里就添加了全路径

    2.编译后错误:error LNK2019: 无法解析的外部符号 __imp__WSAEventSelect@12,该符号在函数 "public: void __thiscall SocketReceiveMultiplexer::Implementation::Run(void)" (?Run@Implementation@SocketReceiveMultiplexer@@QAEXXZ) 中被引用

    在main.cpp中加入 #pragma comment(lib,"ws2_32.lib")

  • 相关阅读:
    CF703D Mishka and Interesting sum
    CF697D Puzzles
    SCOI2017酱油记
    [BZOJ4730][清华集训2016][UOJ266] Alice和Bob又在玩游戏
    BZOJ4311:向量
    BZOJ4520: [Cqoi2016]K远点对
    BZOJ4555: [Tjoi2016&Heoi2016]求和
    [Codechef November Challenge 2012] Arithmetic Progressions
    agc040
    补题
  • 原文地址:https://www.cnblogs.com/bkycjj/p/3566104.html
Copyright © 2020-2023  润新知