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);

相关文章

    本文实践自 RayWenderlich、Ali Hafizji 的文章《...
Cocos-code-ide使用入门学习地点:杭州滨江邮箱:appdevzw@1...
第一次開始用手游引擎挺激动!!!进入正题。下载资源1:从C...
    Cocos2d-x是一款强大的基于OpenGLES的跨平台游戏开发...
1.  来源 QuickV3sample项目中的2048样例游戏,以及最近《...
   Cocos2d-x3.x已经支持使用CMake来进行构建了,这里尝试...