Exemple #1
0
        protected override void Draw()
        {
            base.Draw();

            var visibleRect = VisibleBoundsWorldspace;

            var geoBatch = new CCGeometryBatch();

            geoBatch.Begin();

            var item = geoBatch.CreateGeometryInstance(3, 3);

            var vertices = item.GeometryPacket.Vertices;

            var windowSize = VisibleBoundsWorldspace.Size;
            var packet     = item.GeometryPacket;

            packet.Texture      = texture;
            item.GeometryPacket = packet;
            // Draw polygons

            vertices[0].Colors = CCColor4B.White;
            vertices[1].Colors = CCColor4B.White;
            vertices[2].Colors = CCColor4B.White;

            // Texture coordinates use a normalzed value 0 to 1
            vertices[0].TexCoords.U = 0;
            vertices[0].TexCoords.V = 0;

            vertices[1].TexCoords.U = 1;
            vertices[1].TexCoords.V = 0;

            vertices[2].TexCoords.U = 1;
            vertices[2].TexCoords.V = 1;

            vertices[0].Vertices.X = 0;
            vertices[0].Vertices.Y = 0;

            vertices[1].Vertices.X = texture.PixelsWide;
            vertices[1].Vertices.Y = 0;

            vertices[2].Vertices.X = texture.PixelsWide;
            vertices[2].Vertices.Y = texture.PixelsHigh;

            item.GeometryPacket.Indicies = new int[] { 2, 1, 0 };

            var rotation = CCAffineTransform.Identity;

            rotation.Rotation = (float)Math.PI / 4.0f;
            rotation.Tx       = windowSize.Center.X - texture.PixelsWide / 2;
            rotation.Ty       = windowSize.Center.Y - texture.PixelsHigh / 2;

            item.InstanceAttributes.AdditionalTransform = rotation;

            geoBatch.End();
        }
Exemple #2
0
        public void Initialize()
        {
            atlas              = null;
            DebugSlots         = false;
            DebugBones         = false;
            PremultipliedAlpha = false;
            ImagesDirectory    = string.Empty;
            DebugSlotColor     = CCColor4B.Magenta;
            DebugBoneColor     = CCColor4B.Blue;
            DebugJointColor    = CCColor4B.Red;
            batcher            = new CCGeometryBatch();
            OpacityModifyRGB   = true;

            Schedule();
        }