cocos2d游戏中添加放大镜
问题描述
我想在 cocos2d 游戏中添加放大镜.这是我在网上找到的:http://coffeeshopped.com/2010/03/a-simple-magnifying-glass-loupe-view-for-the-iphone我稍微修改了代码:(因为我不想让放大镜跟随我们的触摸)
i want to add a magnifier in cocos2d game. here is what i found online: http://coffeeshopped.com/2010/03/a-simpler-magnifying-glass-loupe-view-for-the-iphone I've changed the code a bit:(since i don't want to let the loupe follow our touch)
然后我想将它添加到我的场景初始化方法之一中:
Then i want to add it in one of my scene init method:
但结果是:放大镜内的区域是黑色的.另外这个放大镜只是放大相同比例的图像,我怎样才能改变它以放大更多靠近中心和靠近边缘的地方?(就像真正的放大镜一样)谢谢!!!
But the result is: the area inside the loupe is black. Also this loupe just magnify images with the same scale, how can i change it to magnify more near the center and less near the edge? (just like real magnifier) Thank you !!!
推荐答案
这里我假设你想放大屏幕的中心.
Here I assume that you want to magnify the center of the screen.
您必须根据您的应用需求动态更改大小属性.
You have to change dynamically size attribute to your wishes according to your app needs.
这篇关于cocos2d游戏中添加放大镜的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!