cocos2dx win32修改鼠标指针图案

win32的api实在太麻烦了,但是glView里面有个setCursorVisible的方法,可是借此实现同样的效果

AppDelegate.cpp中:

glview = GLViewImpl::createWithFullScreen("123465");
glview->setCursorVisible(false);
director->setOpenGLView(glview);

自己的layer中:

//鼠标指针
auto cursor = Sprite::create("cursor_nor.png");
this->_cursor = Node::create();
this->_cursor->addChild(cursor);
this->addChild(this->_cursor,10000);

auto listenerMouse = EventListenerMouse::create();
    listenerMouse->onMouseMove = [&](cocos2d::EventMouse* event) {
        Point mouse = event->getLocation();
        mouse.y = 1024 - mouse.y;

        this->_cursor->setPosition(Point(mouse.x+20,mouse.y-30));
    };
    listenerMouse->onMouseDown = [&](cocos2d::EventMouse* event) {
        this->_cursor->removeAllChildren();
        auto cursor = Sprite::create("cursor_pre.png");
        this->_cursor->addChild(cursor);
    };
    listenerMouse->onMouseUp = [&](cocos2d::EventMouse* event) {
        this->_cursor->removeAllChildren();
        auto cursor = Sprite::create("cursor_nor.png");
        this->_cursor->addChild(cursor);
    };
    this->_eventDispatcher->addEventListenerWithFixedPriority(listenerMouse,1);

相关文章

操作步骤 1、创建cocos2d-x工程 2、新建 Scene1.cpp Scene1.h Scene1.h代码 #ifndef __SCENE1_H__#defi...
开发环境:OS(WINDOWS 8.1 X64 企业版) cocos2d-x 2.2.1 vs2010 想给vs安装上cocos的模版,执行Install...
把创建项目做成一个批处理,当创建项目时可以省时省力很多。 操作步骤 1、在 E:cocos2d-x-2.2.1toolspr...
https://www.cnblogs.com/JiaoQing/p/3906780.html 四个响应函数 1 EventListenerPhysicsContact* evC...
转载于 http://www.cnblogs.com/kenkofox/p/3926797.html 熟悉js的dom事件或者flash事件的,基本都能立...
ScrollView(滚动容器)加载大量item时会导致游戏界面的卡顿,严重时整个界面会出现卡死的情况。最近项...