• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# cocos2d.CCTexture2D类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中cocos2d.CCTexture2D的典型用法代码示例。如果您正苦于以下问题:C# CCTexture2D类的具体用法?C# CCTexture2D怎么用?C# CCTexture2D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CCTexture2D类属于cocos2d命名空间,在下文中一共展示了CCTexture2D类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: grab

        public void grab(ref CCTexture2D pTexture)
        {
            // If the gles version is lower than GLES_VER_1_0, 
            // all the functions in CCGrabber return directly.
            if (m_eGlesVersion <= CCGlesVersion.GLES_VER_1_0)
            {
                return;
            }

            //glGetIntegerv(CC_GL_FRAMEBUFFER_BINDING, &m_oldFBO);

            // bind
            //ccglBindFramebuffer(CC_GL_FRAMEBUFFER, m_fbo);

            m_RenderTarget2D = new RenderTarget2D(CCApplication.sharedApplication().GraphicsDevice,
                (int)pTexture.ContentSizeInPixels.width,
                (int)pTexture.ContentSizeInPixels.height);

            pTexture.Texture = m_RenderTarget2D;

            // associate texture with FBO
            //ccglFramebufferTexture2D(CC_GL_FRAMEBUFFER, CC_GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
            //pTexture->getName(), 0);

            // check if it worked (probably worth doing :) )
            //GLuint status = ccglCheckFramebufferStatus(CC_GL_FRAMEBUFFER);
            //if (status != CC_GL_FRAMEBUFFER_COMPLETE)
            //{
            //    CCLOG("Frame Grabber: could not attach texture to frmaebuffer");
            //}

            //ccglBindFramebuffer(CC_GL_FRAMEBUFFER, m_oldFBO);
        }
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:33,代码来源:CCGrabber.cs


示例2: CCSprite

 public CCSprite(CCTexture2D texture)
 {
     if (!InitWithTexture(texture))
     {
         CCLog.Log("CCSprite (CCTexture2D texture): Problems initializing class");
     }
 }
开发者ID:HarkDev,项目名称:cocos2d-xna,代码行数:7,代码来源:CCSprite.cs


示例3: Selection

        public Selection(Word p_StudyInfo, bool p_IsAnswer,Int32 p_Width,Int32 p_Height)
        {
            base.init();
            this.StudyInfo = p_StudyInfo;

            CCTexture2D texture = new CCTexture2D();
            texture.initWithTexture(PictureManager.GetTexture2D(p_StudyInfo));

            if (p_Width < texture.ContentSizeInPixels.width)
            {
                this.scaleX = p_Width / texture.ContentSizeInPixels.width;
            }
            if (p_Height < texture.ContentSizeInPixels.height)
            {
                this.scaleY = p_Height / texture.ContentSizeInPixels.height;
            }
            this.contentSize.width = p_Width;
            this.contentSize.height = p_Height;

            CCRect rect = new CCRect();
            rect.size = new CCSize(texture.ContentSizeInPixels.width, texture.ContentSizeInPixels.height);
            this.initWithTexture(texture, rect);

            this.IsAnswer = p_IsAnswer;
            LoadResultPeople();
        }
开发者ID:tianjing,项目名称:SayWordByPicture,代码行数:26,代码来源:Selection.cs


示例4: GetCCTexture2D

 public static CCTexture2D GetCCTexture2D(Stream p_PicStrean)
 {
     Texture2D text2D = Texture2D.FromStream(CCApplication.sharedApplication().GraphicsDevice, p_PicStrean);
     CCTexture2D cctext2D = new CCTexture2D();
     cctext2D.initWithTexture(text2D);
     return cctext2D;
 }
开发者ID:tianjing,项目名称:SayWordByPicture,代码行数:7,代码来源:PictureManager.cs


示例5: GetCCTexture2D

        public static CCTexture2D GetCCTexture2D(Word p_Word,Int32 p_Width,Int32 p_Height,bool p_Zoom)
        {
            CCTexture2D result = new CCTexture2D();
            result.initWithTexture(GetTexture2D(p_Word),new CCSize(p_Width,p_Height));

            return result;
        }
开发者ID:tianjing,项目名称:SayWordByPicture,代码行数:7,代码来源:PictureManager.cs


示例6: ballWithTexture

        public static Ball ballWithTexture(CCTexture2D aTexture)
        {
            Ball pBall = new Ball();
            pBall.InitWithTexture(aTexture);
            //pBall->autorelease();

            return pBall;
        }
开发者ID:homocury,项目名称:cocos2d-xna,代码行数:8,代码来源:Ball.cs


示例7: paddleWithTexture

        public static Paddle paddleWithTexture(CCTexture2D aTexture)
        {
            Paddle pPaddle = new Paddle();
            pPaddle.initWithTexture(aTexture);
            //pPaddle->autorelease();

            return pPaddle;
        }
开发者ID:Openxlive,项目名称:cocos2d-x-for-xna,代码行数:8,代码来源:Paddle.cs


示例8: initWithTexture

 public new bool initWithTexture(CCTexture2D aTexture)
 {
     if (base.initWithTexture(aTexture))
     {
         m_state = PaddleState.kPaddleStateUngrabbed;
     }
     return true;
 }
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:8,代码来源:Paddle.cs


示例9: create

 public static CCMotionStreak create(float fade, float minSeg, float stroke, ccColor3B color, CCTexture2D texture)
 {
     CCMotionStreak pRet = new CCMotionStreak();
     if (pRet.initWithFade(fade, minSeg, stroke, color, texture))
     {
         return pRet;
     }
     return null;
 }
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:9,代码来源:CCMotionStreak.cs


示例10: Create

 public static CCTiledGrid3D Create(CCGridSize gridSize, CCTexture2D pTexture, bool bFlipped)
 {
     var pRet = new CCTiledGrid3D();
     if (pRet.InitWithSize(gridSize, pTexture, bFlipped))
     {
         return pRet;
     }
     return null;
 }
开发者ID:homocury,项目名称:cocos2d-xna,代码行数:9,代码来源:CCTiledGrid3D.cs


示例11: gridWithSize

        public static new CCTiledGrid3D gridWithSize(ccGridSize gridSize, CCTexture2D pTexture, bool bFlipped)
        {
            CCTiledGrid3D pRet = new CCTiledGrid3D();

            if (pRet.initWithSize(gridSize, pTexture, bFlipped))
            {
                return pRet;
            }

            return null;
        }
开发者ID:hiceka,项目名称:cocos2d-x-for-xna,代码行数:11,代码来源:CCTiledGrid3D.cs


示例12: afterRender

        public void afterRender(CCTexture2D pTexture)
        {
            // If the gles version is lower than GLES_VER_1_0,
            // all the functions in CCGrabber return directly.
            if (m_eGlesVersion <= CCGlesVersion.GLES_VER_1_0)
            {
                return;
            }

            //ccglBindFramebuffer(CC_GL_FRAMEBUFFER, m_oldFBO);
            //glColorMask(true, true, true, true);	// #631
        }
开发者ID:ChowZenki,项目名称:cocos2d-x-for-xna,代码行数:12,代码来源:CCGrabber.cs


示例13: afterRender

        public void afterRender(ref CCTexture2D pTexture)
        {
            // If the gles version is lower than GLES_VER_1_0,
            // all the functions in CCGrabber return directly.
            if (m_eGlesVersion <= CCGlesVersion.GLES_VER_1_0)
            {
                return;
            }

            CCApplication.sharedApplication().GraphicsDevice.SetRenderTarget(null);
            pTexture.texture2D = m_RenderTarget2D;

            //ccglBindFramebuffer(CC_GL_FRAMEBUFFER, m_oldFBO);
            //glColorMask(true, true, true, true);	// #631
        }
开发者ID:hiceka,项目名称:cocos2d-x-for-xna,代码行数:15,代码来源:CCGrabber.cs


示例14: gridWithSize

        public static CCGridBase gridWithSize(ccGridSize gridSize, CCTexture2D texture, bool flipped)
        {
            CCGridBase pGridBase = new CCGridBase();

            if (pGridBase != null)
            {
                if (pGridBase.initWithSize(gridSize, texture, flipped))
                {
                    //pGridBase->autorelease();
                }
                else
                {
                    //CC_SAFE_RELEASE_NULL(pGridBase);
                }
            }

            return pGridBase;
        }
开发者ID:ChowZenki,项目名称:cocos2d-x-for-xna,代码行数:18,代码来源:CCGridBase.cs


示例15: gridWithSize

        public static CCTiledGrid3D gridWithSize(ccGridSize gridSize, CCTexture2D pTexture, bool bFlipped)
        {
            CCTiledGrid3D pRet = new CCTiledGrid3D();

            if (pRet != null)
            {
                if (pRet.initWithSize(gridSize, pTexture, bFlipped))
                {
                    //pRet->autorelease();
                }
                else
                {
                    //delete pRet;
                    pRet = null;
                }
            }

            return pRet;
        }
开发者ID:ChowZenki,项目名称:cocos2d-x-for-xna,代码行数:19,代码来源:CCTiledGrid3D.cs


示例16: LoadWordText

        private void LoadWordText()
        {
            CCSprite sprite = new CCSprite();
            CCTexture2D texture = new CCTexture2D();

            switch (Platform.QuestionLanguage)
            {
                case Lib.Core.Language.Chinese:
                    texture.initWithString(m_Word.ChineseName, "ChineseContent", 20,Color.White,Color.Transparent);
                    break;
                case Lib.Core.Language.Enlish:
                default:
                    texture.initWithString(m_Word.EnglishName, "EnglishContent", 20, Color.White, Color.Transparent);
                    break;
            }
            sprite.initWithTexture(texture);
            sprite.Color = new ccColor3B(Color.White);
            sprite.position = new CCPoint((m_Size.width / 2) - (sprite.contentSize.width / 2) - m_StillWhile, (sprite.contentSize.height / 2));
            addChild(sprite);
        }
开发者ID:tianjing,项目名称:SayWordByPicture,代码行数:20,代码来源:FloorLayer.cs


示例17: saveImage

        public void saveImage(object pSender)
        {
            using (var stream = new MemoryStream())
            {

                m_pTarget.SaveToStream(stream, ImageFormat.PNG);
                //m_pTarget.saveToFile(jpg, ImageFormat.JPG);

                stream.Position = 0;

                Texture2D xnatex = Texture2D.FromStream(DrawManager.graphicsDevice, stream);
                var tex = new CCTexture2D();
                tex.InitWithTexture(xnatex);
                CCSprite sprite = new CCSprite(tex);

                sprite.Scale = 0.3f;
                AddChild(sprite);
                sprite.Position = new CCPoint(40, 40);
                sprite.Rotation = counter * 3;
            }
            counter++;
        }
开发者ID:eickegao,项目名称:cocos2d-xna,代码行数:22,代码来源:RenderTextureSave.cs


示例18: beforeRender

        public void beforeRender(CCTexture2D pTexture)
        {
            // If the gles version is lower than GLES_VER_1_0,
            // all the functions in CCGrabber return directly.
            if (m_eGlesVersion <= CCGlesVersion.GLES_VER_1_0)
            {
                return;
            }

            //glGetIntegerv(CC_GL_FRAMEBUFFER_BINDING, &m_oldFBO);
            //ccglBindFramebuffer(CC_GL_FRAMEBUFFER, m_fbo);

            // BUG XXX: doesn't work with RGB565.

            /*glClearColor(0, 0, 0, 0);*/

            // BUG #631: To fix #631, uncomment the lines with #631
            // Warning: But it CCGrabber won't work with 2 effects at the same time
            //glClearColor(0.0f, 0.0f, 0.0f, 1.0f);	// #631

            //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

            //glColorMask(true, true, true, false);	// #631
        }
开发者ID:ChowZenki,项目名称:cocos2d-x-for-xna,代码行数:24,代码来源:CCGrabber.cs


示例19: beforeRender

        public void beforeRender(ref CCTexture2D pTexture)
        {
            // If the gles version is lower than GLES_VER_1_0,
            // all the functions in CCGrabber return directly.
            if (m_eGlesVersion <= CCGlesVersion.GLES_VER_1_0)
            {
                return;
            }

            CCApplication.sharedApplication().GraphicsDevice.SetRenderTarget(m_RenderTarget2D);
            //CCApplication.sharedApplication().GraphicsDevice.Clear(new Color(0, 0, 0, 0));

            //CCApplication app = CCApplication.sharedApplication();
            //Texture2D td = app.content.Load<Texture2D>("Images/blocks");
            //app.spriteBatch.Begin();
            //app.spriteBatch.Draw(td, new Rectangle(100, 100, 200, 200), Color.White);
            //app.spriteBatch.End();

            //glGetIntegerv(CC_GL_FRAMEBUFFER_BINDING, &m_oldFBO);
            //ccglBindFramebuffer(CC_GL_FRAMEBUFFER, m_fbo);

            // BUG XXX: doesn't work with RGB565.

            /*glClearColor(0, 0, 0, 0);*/

            // BUG #631: To fix #631, uncomment the lines with #631
            // Warning: But it CCGrabber won't work with 2 effects at the same time
            //glClearColor(0.0f, 0.0f, 0.0f, 1.0f);	// #631

            //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

            //glColorMask(true, true, true, false);	// #631
        }
开发者ID:hiceka,项目名称:cocos2d-x-for-xna,代码行数:33,代码来源:CCGrabber.cs


示例20: AddImage

        public CCTexture2D AddImage(string fileimage)
        {
            Debug.Assert(!String.IsNullOrEmpty(fileimage), "TextureCache: fileimage MUST not be NULL");

            CCTexture2D texture;

            lock (m_pDictLock)
            {
                //remove possible -HD suffix to prevent caching the same image twice (issue #1040)
                string pathKey = fileimage;
                //CCFileUtils.ccRemoveHDSuffixFromFile(pathKey);

                bool bHasTexture = m_pTextures.TryGetValue(pathKey, out texture);
                if(!bHasTexture || texture == null)
                {
                    // Create a new one only if the current one does not exist
                    texture = new CCTexture2D();
                }
                if(!texture.IsTextureDefined)
                {
                    // Either we are creating a new one or else we need to refresh the current one.
                    // CCLog.Log("Loading texture {0}", fileimage);
                    Texture2D textureXna = null;
                    try
                    {
                        textureXna = CCApplication.SharedApplication.Content.Load<Texture2D>(fileimage);
                    }
                    catch (Exception)
                    {
                        string srcfile = fileimage;
                        if (srcfile.IndexOf('.') > -1)
                        {
                            // Remove the extension
                            srcfile = srcfile.Substring(0, srcfile.LastIndexOf('.'));
                        }
                        textureXna = CCApplication.SharedApplication.Content.Load<Texture2D>(srcfile);
                    }
                    bool isInited = texture.InitWithTexture(textureXna);

                    if (isInited)
                    {
                        texture.IsManaged = true;
                        texture.ContentFile = fileimage;
                        m_pTextures[pathKey] = texture;
                        m_pTextureRefNames[texture] = fileimage;
                    }
                    else
                    {
                        Debug.Assert(false, "cocos2d: Couldn't add image:" + fileimage + " in CCTextureCache");
                        return null;
                    }
                }
            }
            return texture;
        }
开发者ID:homocury,项目名称:cocos2d-xna,代码行数:55,代码来源:CCTextureCache.cs



注:本文中的cocos2d.CCTexture2D类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# cocos2d.CCTouch类代码示例发布时间:2022-05-26
下一篇:
C# cocos2d.CCSprite类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap