预打算使用windows中的鼠标指针功能,发现效果不佳,和COCOS不是很匹配,最终和cocos使用同一个glfw库的,代码如下:
std::string strCur = "../../res/bg_d.png";
auto image = new (std::nothrow)Image();
image->initWithImageFile(strCur);
GLFWimage *fwImage = new (std::nothrow)GLFWimage();
fwImage->width = image->getWidth();
fwImage->height = image->getHeight();
fwImage->pixels = image->getData();
auto cursor =glfwCreateCursor(fwImage,10, 10);
glfwSetCursor(_mainWindow, cursor);
本文介绍如何在Cocos中使用glfw库自定义鼠标光标,通过加载图片资源并转换为GLFWimage格式,创建并设置自定义鼠标光标,实现与Cocos引擎更好的视觉匹配。
3858

被折叠的 条评论
为什么被折叠?



