[cocos2d-x 2.0+遊戲開發]滑鼠事件以及座標系

來源:互聯網
上載者:User

歡迎轉載。轉載請註明softboy
部落格: http://www.softboy.uqc.cn

本教程都是cocos2d-2.0-rc2-x-2.0.1  較以前有較大的改變,以前的版本的教程真的是只能做參考.滑鼠事件cocos2dx 已經處理好了.這裡只需要實現相應的虛函數就好了.

    // default implements are used to call script callback if exist    virtual void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent);    virtual void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent);    virtual void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent);    virtual void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent);

ccTouchesCancelled 是劃開的效果.可以看成在touch在button上不鬆手,滑動到其他button上要處理的回調.
在HelloWorld 實現上面函數後.一定要在初始化的地方天上如下代碼不然touch不生效.

setTouchEnabled(true);
提示如果發現CCSet找不到定義.USING_NS_CC;在helloword .h外面定義 

座標系是x 往右.y 往上.

  • 上一篇:[cocos2d-x 2.0+遊戲開發]動畫的建立
  • 下一篇:android 4.0 launcher 2 源碼 eclipse可以編譯(也包含android 4.1 launcher2 源碼編譯 )
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.