<tfoot id='REQgz'></tfoot>
  1. <small id='REQgz'></small><noframes id='REQgz'>

      • <bdo id='REQgz'></bdo><ul id='REQgz'></ul>
      <legend id='REQgz'><style id='REQgz'><dir id='REQgz'><q id='REQgz'></q></dir></style></legend>
      <i id='REQgz'><tr id='REQgz'><dt id='REQgz'><q id='REQgz'><span id='REQgz'><b id='REQgz'><form id='REQgz'><ins id='REQgz'></ins><ul id='REQgz'></ul><sub id='REQgz'></sub></form><legend id='REQgz'></legend><bdo id='REQgz'><pre id='REQgz'><center id='REQgz'></center></pre></bdo></b><th id='REQgz'></th></span></q></dt></tr></i><div id='REQgz'><tfoot id='REQgz'></tfoot><dl id='REQgz'><fieldset id='REQgz'></fieldset></dl></div>

    1. cocos2d游戏中添加放大镜

      时间:2024-08-11
        <i id='xEkPb'><tr id='xEkPb'><dt id='xEkPb'><q id='xEkPb'><span id='xEkPb'><b id='xEkPb'><form id='xEkPb'><ins id='xEkPb'></ins><ul id='xEkPb'></ul><sub id='xEkPb'></sub></form><legend id='xEkPb'></legend><bdo id='xEkPb'><pre id='xEkPb'><center id='xEkPb'></center></pre></bdo></b><th id='xEkPb'></th></span></q></dt></tr></i><div id='xEkPb'><tfoot id='xEkPb'></tfoot><dl id='xEkPb'><fieldset id='xEkPb'></fieldset></dl></div>

      • <small id='xEkPb'></small><noframes id='xEkPb'>

        <tfoot id='xEkPb'></tfoot>

        1. <legend id='xEkPb'><style id='xEkPb'><dir id='xEkPb'><q id='xEkPb'></q></dir></style></legend>
            <bdo id='xEkPb'></bdo><ul id='xEkPb'></ul>

                <tbody id='xEkPb'></tbody>
                本文介绍了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)

                - (id)initWithFrame:(CGRect)frame {
                if ((self = [super initWithFrame:magnifier_rect])) {
                    // make the circle-shape outline with a nice border.
                    self.layer.borderColor = [[UIColor lightGrayColor] CGColor];
                    self.layer.borderWidth = 3;
                    self.layer.cornerRadius = 250;
                    self.layer.masksToBounds = YES;
                    touchPoint = CGPointMake(CGRectGetMidX(magnifier_rect), CGRectGetMidY(magnifier_rect));
                }
                return self;
                }
                

                然后我想将它添加到我的场景初始化方法之一中:

                Then i want to add it in one of my scene init method:

                    loop = [[MagnifierView alloc] init];
                    [loop setNeedsDisplay];
                    loop.viewToMagnify = [CCDirector sharedDirector].openGLView;
                
                    [[CCDirector sharedDirector].openGLView.superview addSubview:loop];
                

                但结果是:放大镜内的区域是黑色的.另外这个放大镜只是放大相同比例的图像,我怎样才能改变它以放大更多靠近中心和靠近边缘的地方?(就像真正的放大镜一样)谢谢!!!

                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.

                CGSize size = [[CCDirector sharedDirector] winSize];
                
                id lens = [CCLens3D actionWithPosition:ccp(size.width/2,size.height/2) radius:240 grid:ccg(15,10) duration:0.0f]; 
                
                [self runAction:lens];
                

                这篇关于cocos2d游戏中添加放大镜的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:如何在 iOS coco2d 中无限移动背景图像 下一篇:cocos2d中如何对多个精灵进行像素完美碰撞?

                相关文章

                  <small id='m4kS2'></small><noframes id='m4kS2'>

                    <legend id='m4kS2'><style id='m4kS2'><dir id='m4kS2'><q id='m4kS2'></q></dir></style></legend>

                      <bdo id='m4kS2'></bdo><ul id='m4kS2'></ul>
                    <i id='m4kS2'><tr id='m4kS2'><dt id='m4kS2'><q id='m4kS2'><span id='m4kS2'><b id='m4kS2'><form id='m4kS2'><ins id='m4kS2'></ins><ul id='m4kS2'></ul><sub id='m4kS2'></sub></form><legend id='m4kS2'></legend><bdo id='m4kS2'><pre id='m4kS2'><center id='m4kS2'></center></pre></bdo></b><th id='m4kS2'></th></span></q></dt></tr></i><div id='m4kS2'><tfoot id='m4kS2'></tfoot><dl id='m4kS2'><fieldset id='m4kS2'></fieldset></dl></div>
                  1. <tfoot id='m4kS2'></tfoot>