Beispiel #1
0
        public Atlas1()
        {
            m_textureAtlas = CCTextureAtlas.textureAtlasWithFile(TestResource.s_AtlasTest, 3);
            //m_textureAtlas.retain();

            CCSize s = CCDirector.sharedDirector().getWinSize();

            //
            // Notice: u,v tex coordinates are inverted
            //
            //ccV3F_C4B_T2F_Quad quads[] =
            //{
            //    {
            //        {{0,0,0},new ccColor4B(0,0,255,255),{0.0f,1.0f},},				// bottom left
            //        {{s.width,0,0},new ccColor4B(0,0,255,0),{1.0f,1.0f},},			// bottom right
            //        {{0,s.height,0},new ccColor4B(0,0,255,0),{0.0f,0.0f},},	    // top left
            //        {{s.width,s.height,0},{0,0,255,255},{1.0f,0.0f},},	                // top right
            //    },
            //    {
            //        {{40,40,0}, new ccColor4B(255,255,255,255),{0.0f,0.2f},},			// bottom left
            //        {{120,80,0},new ccColor4B(255,0,0,255),{0.5f,0.2f},},			        // bottom right
            //        {{40,160,0},new ccColor4B(255,255,255,255),{0.0f,0.0f},},		    // top left
            //        {{160,160,0},new ccColor4B(0,255,0,255),{0.5f,0.0f},},			    // top right
            //    },

            //    {
            //        {{s.width/2,40,0},new ccColor4B(255,0,0,255),{0.0f,1.0f},},		         // bottom left
            //        {{s.width,40,0},new ccColor4B(0,255,0,255),{1.0f,1.0f},},		        // bottom right
            //        {{s.width/2-50,200,0},new ccColor4B(0,0,255,255),{0.0f,0.0f},},		// top left
            //        {{s.width,100,0},new ccColor4B(255,255,0,255),{1.0f,0.0f},},		    // top right
            //    },
            //};

            //for( int i=0;i<3;i++)
            //{
            //    m_textureAtlas.updateQuad(&quads[i], i);
            //}
        }
Beispiel #2
0
 public Atlas1()
 {
     m_textureAtlas = new CCTextureAtlas(TestResource.s_AtlasTest, 3);
     //m_textureAtlas.retain();
 }
Beispiel #3
0
        public Atlas1()
        {
            m_textureAtlas = CCTextureAtlas.Create(TestResource.s_AtlasTest, 3);
            //m_textureAtlas.retain();

            CCSize s = CCDirector.SharedDirector.WinSize;

            //
            // Notice: u,v tex coordinates are inverted
            //
            CCV3F_C4B_T2F_Quad[] quads =
            {
                new  CCV3F_C4B_T2F_Quad()
                {
                    BottomLeft = new CCV3F_C4B_T2F()
                    {
                        Vertices = new CCVertex3F(0, 0, 0), Colors = new CCColor4B(0, 0, 255, 255), TexCoords = new CCTex2F(0.0f, 1.0f)
                    },                                                                                                                                                                          // bottom left
                    BottomRight = new CCV3F_C4B_T2F()
                    {
                        Vertices = new CCVertex3F(s.Width, 0, 0), Colors = new CCColor4B(0, 0, 255, 0), TexCoords = new CCTex2F(1.0f, 1.0f)
                    },                                                                                                                                                                  // bottom right
                    TopLeft = new CCV3F_C4B_T2F()
                    {
                        Vertices = new CCVertex3F(0, s.Height, 0), Colors = new CCColor4B(0, 0, 255, 0), TexCoords = new CCTex2F(0.0f, 0.0f)
                    },                                                                                                                                                                  // bottom right
                    TopRight = new CCV3F_C4B_T2F()
                    {
                        Vertices = new CCVertex3F(s.Width, s.Height, 0), Colors = new CCColor4B(0, 0, 255, 255), TexCoords = new CCTex2F(1.0f, 0.0f)
                    },                                                                                                                                                                          // bottom right
                },
                new  CCV3F_C4B_T2F_Quad()
                {
                    BottomLeft = new CCV3F_C4B_T2F()
                    {
                        Vertices = new CCVertex3F(40, 40, 0), Colors = new CCColor4B(255, 255, 255, 255), TexCoords = new CCTex2F(0.0f, 0.2f)
                    },                                                                                                                                                                          // bottom left
                    BottomRight = new CCV3F_C4B_T2F()
                    {
                        Vertices = new CCVertex3F(120, 80, 0), Colors = new CCColor4B(255, 0, 0, 255), TexCoords = new CCTex2F(0.5f, 0.2f)
                    },                                                                                                                                                                  // bottom right
                    TopLeft = new CCV3F_C4B_T2F()
                    {
                        Vertices = new CCVertex3F(40, 160, 0), Colors = new CCColor4B(255, 255, 255, 255), TexCoords = new CCTex2F(0.0f, 0.0f)
                    },                                                                                                                                                                  // bottom right
                    TopRight = new CCV3F_C4B_T2F()
                    {
                        Vertices = new CCVertex3F(160, 160, 0), Colors = new CCColor4B(0, 255, 0, 255), TexCoords = new CCTex2F(0.5f, 0.0f)
                    },                                                                                                                                                                  // bottom right
                },
                new  CCV3F_C4B_T2F_Quad()
                {
                    BottomLeft = new CCV3F_C4B_T2F()
                    {
                        Vertices = new CCVertex3F(s.Width / 2, 40, 0), Colors = new CCColor4B(255, 0, 0, 255), TexCoords = new CCTex2F(0.0f, 1.0f)
                    },                                                                                                                                                                                  // bottom left
                    BottomRight = new CCV3F_C4B_T2F()
                    {
                        Vertices = new CCVertex3F(s.Width, 40, 0), Colors = new CCColor4B(0, 255, 0, 255), TexCoords = new CCTex2F(1.0f, 1.0f)
                    },                                                                                                                                                                          // bottom right
                    TopLeft = new CCV3F_C4B_T2F()
                    {
                        Vertices = new CCVertex3F(s.Width / 2 - 50, 200, 0), Colors = new CCColor4B(0, 0, 255, 255), TexCoords = new CCTex2F(0.0f, 0.0f)
                    },                                                                                                                                                                          // bottom right
                    TopRight = new CCV3F_C4B_T2F()
                    {
                        Vertices = new CCVertex3F(s.Width, 100, 0), Colors = new CCColor4B(255, 255, 0, 255), TexCoords = new CCTex2F(1.0f, 0.0f)
                    },                                                                                                                                                                          // bottom right
                },
            };

            for (int i = 0; i < 3; i++)
            {
                m_textureAtlas.UpdateQuad(ref quads[i], i);
            }
        }