Exemplo n.º 1
0
        public void Draw(RenderTexture texture)
        {
            Vertex[] lines = new Vertex[(endAngle - startAngle) * 2];
            for(int i = startAngle; i < endAngle; i+=2)
            {
               Vector2f heading = new Vector2f((float)Math.Cos(i), (float)Math.Sin(i));
               lines[i] = new Vertex(position, new Color(color.R, color.G, color.B, 255));
               lines[i+1] = new Vertex(position + (heading * radius), new Color(color.R, color.G, color.B, 0));
                
            }

            texture.Draw(lines, 0, (uint)(endAngle - startAngle) * 2, PrimitiveType.Lines, new RenderStates(BlendMode.Multiply));       

          /*  VertexArray shape = new VertexArray(PrimitiveType.Points, (uint)(endAngle - startAngle) * 2);
            shape.Append(new Vertex(position));
            for(int i = startAngle; i < endAngle; i++)
            {
                Vector2f heading = new Vector2f((float)Math.Cos(i), (float)Math.Sin(i));
                heading = Util.Vector.norm(heading);
                shape.Append(new Vertex(position + (heading * radius)));
            }
            shape.Append(new Vertex(position));

            texture.Draw(shape, new RenderStates(BlendMode.None));*/
        }
        public void SetFrame(int newFrame, bool resetTime)
        {
            if (Animation != null)
            {
                // calculate new vertex positions and texture coordinates 
                var rect = Animation.Frames[newFrame];

                var texCoordA = new Vector2f(0, 0);
                var texCoordB = new Vector2f(0, rect.Height);
                var texCoordC = new Vector2f(rect.Width, rect.Height);
                var texCoordD = new Vector2f(rect.Width, 0);

                var left = rect.Left + 0.0001f;
                var right = left + rect.Width;
                float top = rect.Top;
                var bottom = top + rect.Height;

                _vertices[0] = new Vertex(texCoordA, new Vector2f(left, top));
                _vertices[1] = new Vertex(texCoordB, new Vector2f(left, bottom));
                _vertices[2] = new Vertex(texCoordC, new Vector2f(right, bottom));
                _vertices[3] = new Vertex(texCoordD, new Vector2f(right, top));
            }

            if (resetTime)
            {
                _currentTime = Time.Zero;
            }
        }
Exemplo n.º 3
0
 public void Line(int x1, int y1, int x2, int y2)
 {
     Vertex[] verts = new Vertex[2];
     verts[0] = new Vertex(new Vector2f(x1, y1), Color.Red);
     verts[1] = new Vertex(new Vector2f(x2, y2), Color.Red);
     RenderTexture.Draw(verts, PrimitiveType.Lines);
 }
Exemplo n.º 4
0
        public static void drawLine(RenderWindow w, Vector2f a, Vector2f b, Color c)
        {
            Vertex[] verts = new Vertex[8];

            verts[0] = new Vertex(new Vector2f(a.X, a.Y), c);
            verts[1] = new Vertex(new Vector2f(b.X, b.Y), c);

            w.Draw(verts, PrimitiveType.Lines);
        }
Exemplo n.º 5
0
 public void Line(uint dest, Line l)
 {
     IntRect source = Sources[dest];
     Line off = l.Offset(new Vector2f(source.Left + 1, source.Top));
     Vertex[] verts = new Vertex[2];
     verts[0] = new Vertex(off.Start, Color.Magenta);
     verts[1] = new Vertex(off.End, Color.Magenta);
     RenderTexture.Draw(verts, PrimitiveType.Lines);
 }
Exemplo n.º 6
0
        public static void drawTexRectangle(RenderWindow w, List<Vector2> vertecies, Color c, Texture t)
        {
            Vertex[] verts = new Vertex[4];

            verts[0] = new Vertex(new Vector2f(vertecies[3].X, vertecies[3].Y), c, new Vector2f(0,0));
            verts[1] = new Vertex(new Vector2f(vertecies[0].X, vertecies[0].Y), c, new Vector2f(t.Size.X, 0));
            verts[2] = new Vertex(new Vector2f(vertecies[1].X, vertecies[1].Y), c, new Vector2f(t.Size.X, t.Size.Y));
            verts[3] = new Vertex(new Vector2f(vertecies[2].X, vertecies[2].Y), c, new Vector2f(0, t.Size.Y));

            w.Draw(verts, PrimitiveType.Quads, new RenderStates(t));
        }
Exemplo n.º 7
0
        public void Draw()
        {
            var p0 = new SSVector2F(_cBody.X.ToPixels(), _cBody.Y.ToPixels());
            var p1 = p0 + Utils.Math.Angles.ToVectorDegrees(Angle - Amplitude)*66;
            var p2 = p0 + Utils.Math.Angles.ToVectorDegrees(Angle + Amplitude)*66;

            var v0 = new Vertex(new Vector2f(p0.X, p0.Y)) {Color = new Color(255, 0, 0, 125)};
            var v1 = new Vertex(new Vector2f(p1.X, p1.Y)) {Color = new Color(255, 0, 0, 1)};
            var v2 = new Vertex(new Vector2f(p2.X, p2.Y)) {Color = new Color(255, 0, 0, 1)};

            _game.GameWindow.RenderWindow.Draw(new[] {v0, v1, v2}, PrimitiveType.Triangles);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Add a pre-transformed texture to the batcher.
        /// </summary>
        public void Add(Texture tex, Vertex[] transform)
        {
            if (_tex != tex) Flush(tex);

            _array[_idx + 0] = transform[0];
            _array[_idx + 1] = transform[1];
            _array[_idx + 2] = transform[2];
            _array[_idx + 3] = transform[3];
            _idx += 4;

            if (_idx == _array.Length) Flush();
        }
Exemplo n.º 9
0
        public void Draw(RenderWindow window)
        {
            Vertex[] lines = new Vertex[(endAngle - startAngle) * 2];

            for (int i = startAngle; i < endAngle; i += 2)
            {
                Vector2f heading = new Vector2f((float)Math.Cos(i), (float)Math.Sin(i));
                lines[i] = new Vertex(new Vector2f(position.X+ radius/2, position.Y - radius/2), new Color(color.R, color.G, color.B, 255));
                lines[i + 1] = new Vertex(position + (Util.Vector.norm(heading) * radius), new Color(new Color(color.R, color.G, color.B, 1)));
            }

            window.Draw(lines, 0, (uint)(endAngle - startAngle) * 2, PrimitiveType.LinesStrip, new RenderStates(BlendMode.Multiply));
        }
Exemplo n.º 10
0
        public static void drawPolygon(RenderWindow w, List<Vector2> vertecies, Color c)
        {
            Vertex[] verts = new Vertex[vertecies.Count + 1];

            int i = 0;
            foreach (Vector2 v in vertecies)
            {
                verts[i] = new Vertex(new Vector2f(v.X , v.Y ), c);
                i++;
            }
            verts[i] = new Vertex(new Vector2f(vertecies[0].X , vertecies[0].Y ), c);

            w.Draw(verts, PrimitiveType.LinesStrip);
        }
Exemplo n.º 11
0
        public void LoadContent()
        {
            //verts = new VertexTypeList.PositionDiffuse2DTexture1[4]
            //            {
            //                new VertexTypeList.PositionDiffuse2DTexture1(new Vector3(1, -1, 0), Color.Transparent, new Vector2(1, 1)),
            //                new VertexTypeList.PositionDiffuse2DTexture1(new Vector3(-1, -1, 0), Color.Transparent,new Vector2(0, 1)),
            //                new VertexTypeList.PositionDiffuse2DTexture1(new Vector3(-1, 1, 0), Color.Transparent, new Vector2(0, 0)),
            //                new VertexTypeList.PositionDiffuse2DTexture1(new Vector3(1, 1, 0), Color.Transparent, new Vector2(1, 0))
            //            };

            vertex = new VertexArray(PrimitiveType.Lines, 4);
            vertex[0] = new Vertex(new Vector2(1,-1), Color.Transparent.ToSFMLColor(),new Vector2(1,1));
            vertex[1] = new Vertex(new Vector2(-1, -1), Color.Transparent.ToSFMLColor(), new Vector2(0, 1));
            vertex[2] = new Vertex(new Vector2(-1, 1), Color.Transparent.ToSFMLColor(), new Vector2(0, 0));
            vertex[3] = new Vertex(new Vector2(1, 1), Color.Transparent.ToSFMLColor(), new Vector2(1, 0));
        }
Exemplo n.º 12
0
 public Crosshair()
 {
     const float halfWidth = 5f;
     Vertex v = new Vertex(new Vector2f(halfWidth, 0f), SFML.Graphics.Color.White);
     m_vertexArray.Append(v);
     v.Position = new Vector2f(-halfWidth, 0f);
     m_vertexArray.Append(v);
     v.Color = SFML.Graphics.Color.Transparent;
     m_vertexArray.Append(v);
     v.Position = new Vector2f(0f, -halfWidth);
     m_vertexArray.Append(v);
     v.Color = SFML.Graphics.Color.White;
     m_vertexArray.Append(v);
     v.Position = new Vector2f(0f, halfWidth);
     m_vertexArray.Append(v);
 }
Exemplo n.º 13
0
        private void Rebuild()
        {
            var edgeWidth = (_radius * 2) / 3;

            _vertices[00] = new Vertex(new Vector2f(0, 0), _color);
            _vertices[01] = new Vertex(new Vector2f(edgeWidth, 0), _color);
            _vertices[02] = new Vertex(new Vector2f(edgeWidth, _thickness), _color);
            _vertices[03] = new Vertex(new Vector2f(0, _thickness), _color);

            _vertices[04] = new Vertex(new Vector2f(0, 0), _color);
            _vertices[05] = new Vertex(new Vector2f(_thickness, 0), _color);
            _vertices[06] = new Vertex(new Vector2f(_thickness, edgeWidth), _color);
            _vertices[07] = new Vertex(new Vector2f(0, edgeWidth), _color);

            _vertices[08] = new Vertex(new Vector2f(edgeWidth * 2, 0), _color);
            _vertices[09] = new Vertex(new Vector2f(edgeWidth * 3, 0), _color);
            _vertices[10] = new Vertex(new Vector2f(edgeWidth * 3, _thickness), _color);
            _vertices[11] = new Vertex(new Vector2f(edgeWidth * 2, _thickness), _color);

            _vertices[12] = new Vertex(new Vector2f(edgeWidth * 3 - _thickness, 0), _color);
            _vertices[13] = new Vertex(new Vector2f(edgeWidth * 3, 0), _color);
            _vertices[14] = new Vertex(new Vector2f(edgeWidth * 3, edgeWidth), _color);
            _vertices[15] = new Vertex(new Vector2f(edgeWidth * 3 - _thickness, edgeWidth), _color);

            _vertices[16] = new Vertex(new Vector2f(edgeWidth * 3 - _thickness, edgeWidth * 2), _color);
            _vertices[17] = new Vertex(new Vector2f(edgeWidth * 3, edgeWidth * 2), _color);
            _vertices[18] = new Vertex(new Vector2f(edgeWidth * 3, edgeWidth * 3), _color);
            _vertices[19] = new Vertex(new Vector2f(edgeWidth * 3 - _thickness, edgeWidth * 3), _color);

            _vertices[20] = new Vertex(new Vector2f(edgeWidth * 2, edgeWidth * 3 - _thickness), _color);
            _vertices[21] = new Vertex(new Vector2f(edgeWidth * 3, edgeWidth * 3 - _thickness), _color);
            _vertices[22] = new Vertex(new Vector2f(edgeWidth * 3, edgeWidth * 3), _color);
            _vertices[23] = new Vertex(new Vector2f(edgeWidth * 2, edgeWidth * 3), _color);

            _vertices[24] = new Vertex(new Vector2f(0, edgeWidth * 2), _color);
            _vertices[25] = new Vertex(new Vector2f(_thickness, edgeWidth * 2), _color);
            _vertices[26] = new Vertex(new Vector2f(_thickness, edgeWidth * 3), _color);
            _vertices[27] = new Vertex(new Vector2f(0, edgeWidth * 3), _color);

            _vertices[28] = new Vertex(new Vector2f(0, edgeWidth * 3 - _thickness), _color);
            _vertices[29] = new Vertex(new Vector2f(edgeWidth, edgeWidth * 3 - _thickness), _color);
            _vertices[30] = new Vertex(new Vector2f(edgeWidth, edgeWidth * 3), _color);
            _vertices[31] = new Vertex(new Vector2f(0, edgeWidth * 3), _color);

            _dirty = false;
        }
Exemplo n.º 14
0
        public void Draw(Vector2f position, IntRect rec, Color color, Vector2f scale, Vector2f origin, float rotation = 0)
        {
            if (_count >= (_vertices.Length / 4))
                Array.Resize(ref _vertices, _vertices.Length * 2);

            rotation = rotation * (float)Math.PI / 180;
            var sin = (float)Math.Sin(rotation);
            var cos = (float)Math.Cos(rotation);

            origin.X *= scale.X;
            origin.Y *= scale.Y;
            scale.X *= rec.Width;
            scale.Y *= rec.Height;

            Vertex v = new Vertex {Color = color};

            float pX = -origin.X;
            float pY = -origin.Y;

            v.Position.X = pX * cos - pY * sin + position.X;
            v.Position.Y = pX * sin + pY * cos + position.Y;
            v.TexCoords.X = rec.Left;
            v.TexCoords.Y = rec.Top;
            _vertices[_count * 4 + 0] = v;

            pX += scale.X;
            v.Position.X = pX * cos - pY * sin + position.X;
            v.Position.Y = pX * sin + pY * cos + position.Y;
            v.TexCoords.X += rec.Width;
            _vertices[_count * 4 + 1] = v;

            pY += scale.Y;
            v.Position.X = pX * cos - pY * sin + position.X;
            v.Position.Y = pX * sin + pY * cos + position.Y;
            v.TexCoords.Y += rec.Height;
            _vertices[_count * 4 + 2] = v;

            pX -= scale.X;
            v.Position.X = pX * cos - pY * sin + position.X;
            v.Position.Y = pX * sin + pY * cos + position.Y;
            v.TexCoords.X -= rec.Width;
            _vertices[_count * 4 + 3] = v;

            _count++;
        }
Exemplo n.º 15
0
        public static void drawRectangle(RenderWindow w, Rectangle rect, Color c)
        {
            Vertex[] verts = new Vertex[8];

            verts[0] = new Vertex(new Vector2f(rect.x, rect.y), c);
            verts[1] = new Vertex(new Vector2f(rect.x + rect.width, rect.y), c);

            verts[2] = new Vertex(new Vector2f(rect.x + rect.width, rect.y), c);
            verts[3] = new Vertex(new Vector2f(rect.x + rect.width, rect.y + rect.height), c);

            verts[4] = new Vertex(new Vector2f(rect.x + rect.width, rect.y + rect.height), c);
            verts[5] = new Vertex(new Vector2f(rect.x, rect.y + rect.height), c);

            verts[6] = new Vertex(new Vector2f(rect.x, rect.y + rect.height), c);
            verts[7] = new Vertex(new Vector2f(rect.x, rect.y), c);

            w.Draw(verts, PrimitiveType.Lines);
        }
Exemplo n.º 16
0
        /// <summary>
        /// Adds the texture to the batcher, drawn at the (x, y) location with the specified color.
        /// </summary>
        public void Add(Texture tex, float x, float y, Color color)
        {
            if (_tex != tex)
            {
                Flush(tex);
                ur.X = tex.Size.X;
                lr.X = tex.Size.X;
                lr.Y = tex.Size.Y;
                ll.Y = tex.Size.Y;
            }

            float lx = x + tex.Size.X;
            float ly = y + tex.Size.Y;

            _array[_idx + 0] = new Vertex(new Vector2f(x, y), color, ul);
            _array[_idx + 1] = new Vertex(new Vector2f(lx, y), color, ur);
            _array[_idx + 2] = new Vertex(new Vector2f(lx, ly), color, lr);
            _array[_idx + 3] = new Vertex(new Vector2f(x, ly), color, ll);
            _idx += 4;

            if (_idx == _array.Length) Flush();
        }
Exemplo n.º 17
0
        public bool load(string tileset, SFML.Window.Vector2u tileSize, int[] tiles, uint width, uint height)
        {
            m_vertices.PrimitiveType = SFML.Graphics.PrimitiveType.Quads;
            m_vertices.Resize(width * height * 4);
            for (uint i = 0; i < width; ++i) {
                for (uint j = 0; j < height; ++j) {
                    int tileNumber = tiles[i + j * width];

                    long tu = tileNumber % (m_tileset.Size.X / tileSize.X);
                    long tv = tileNumber / (m_tileset.Size.X / tileSize.X);

                    uint index = (i + j * width) * 4;

                    m_vertices[index + 0] = new Vertex(new Vector2f(i * tileSize.X, j * tileSize.Y), new Vector2f(tu * tileSize.X, tv * tileSize.Y));
                    m_vertices[index + 1] = new Vertex(new Vector2f((i + 1) * tileSize.X, j * tileSize.Y), new Vector2f((tu + 1) * tileSize.X, tv * tileSize.Y));
                    m_vertices[index + 2] = new Vertex(new Vector2f((i + 1) * tileSize.X, (j + 1) * tileSize.Y), new Vector2f((tu + 1) * tileSize.X, (tv + 1) * tileSize.Y));
                    m_vertices[index + 3] = new Vertex(new Vector2f(i * tileSize.X, (j + 1) * tileSize.Y), new Vector2f(tu * tileSize.X, (tv + 1) * tileSize.Y));
                }
            }

            return true;
        }
Exemplo n.º 18
0
        public override void Draw(RenderTarget target, RenderStates states)
        {
            var corners = game.WindowBounds.Corners().Concat(game.World.Objects.SelectMany(o => o.Bounds.Corners()));
            var edges = game.WindowBounds.Edges().Concat(game.World.Objects.SelectMany(o => o.Bounds.Edges()));

            //foreach (var edge in edges)
            //    Debug.DrawLine(edge.start, edge.end);

            var hits =
                from c in corners
                let angle = Radians(c.Angle(Position))
                let hit = Raycast(Position, c, edges)
                let left = Raycast(Position, angle - 0.0001f, 10000f, edges)
                let right = Raycast(Position, angle + 0.0001f, 10000f, edges)
                where hit.HasValue && left.HasValue && right.HasValue
                from h in new[] {
                    new { Hit = hit, Angle = angle },
                    new { Hit = left, Angle = angle - 0.0001f },
                    new { Hit = right, Angle = angle + 0.0001f } }
                let a = NormalizeAngle(Position.Angle(h.Hit.Value.ClosestHit))
                orderby h.Angle
                select h.Hit.Value.ClosestHit;

            //foreach (var hit in hits)
            //{
            //    Debug.DrawLine(Position, hit, Color.Red);
            //    Debug.DrawCircle(hit, 5f, 8, Color.Red);
            //}

            var vertices = new VertexArray(PrimitiveType.Triangles);
            var center = new Vertex(Position, Color);

            foreach (var hit in hits.Pairs(Position))
                vertices.Append(new Vertex(hit, Color));

            target.Draw(vertices);
        }
Exemplo n.º 19
0
        protected SquareGridBase(Vector2i cellSize, Vector2i gridSize)
        {
            GridSize = gridSize;
            CellSize = cellSize;
            m_QuadArray = new VertexArray(PrimitiveType.Quads, (uint) (gridSize.X * gridSize.Y * 4));
            m_LineArray = new VertexArray(PrimitiveType.Lines, (uint) (gridSize.X + gridSize.Y + 2) * 2);

            for (uint y = 0; y < gridSize.Y; y++)
            {
                for (uint x = 0; x < gridSize.X; x++)
                {
                    var i = (uint) ((x + (y * gridSize.X)) * 4);
                    var topLeft = new Vector2f(cellSize.X*x, cellSize.Y*y);
                    var topRight = topLeft + new Vector2f(cellSize.X, 0);
                    var bottomLeft = topLeft + new Vector2f(0, cellSize.Y);
                    var bottomRight = topLeft + new Vector2f(cellSize.X, cellSize.Y);

                    m_QuadArray[i] = new Vertex(topLeft, Color.Black);
                    m_QuadArray[i + 1] = new Vertex(topRight, Color.Black);
                    m_QuadArray[i + 2] = new Vertex(bottomRight, Color.Black);
                    m_QuadArray[i + 3] = new Vertex(bottomLeft, Color.Black);
                }
            }

            for (uint x = 0; x <= gridSize.X; x++)
            {
                m_LineArray[x*2] = new Vertex(new Vector2f(x * cellSize.X, 0), Color.White);
                m_LineArray[(x*2) + 1] = new Vertex(new Vector2f(x * cellSize.X, cellSize.Y * gridSize.Y), Color.White);
            }

            var yOffset = (uint) ((gridSize.X + 1)*2);
            for (uint y = 0; y <= gridSize.Y; y++)
            {
                m_LineArray[yOffset + (y*2)] = new Vertex(new Vector2f(0, y * cellSize.Y), Color.White);
                m_LineArray[yOffset + (y*2) + 1] = new Vertex(new Vector2f(cellSize.X * gridSize.X, y * cellSize.Y), Color.White);
            }
        }
Exemplo n.º 20
0
        private static void Draw(float dt)
        {
            wnd.Clear();

            FireworkManager.Draw(wnd, dt);

            if (drawAimLine)
            {
                var mouseDownPositionF = new Vector2f(mouseDownPosition.X, mouseDownPosition.Y);

                var mousePosition = Mouse.GetPosition(wnd);
                var mousePositionF = new Vector2f(mousePosition.X, mousePosition.Y);

                Console.WriteLine("{" + mouseDownPositionF.X + "," + mouseDownPositionF.Y + "} - {" + mousePositionF.X + ", " + mousePositionF.Y + "}");

                var vertices = new Vertex[2];
                vertices[0] = new Vertex(mouseDownPositionF, Color.White);
                vertices[1] = new Vertex(mousePositionF, Color.White);

                wnd.Draw(vertices, PrimitiveType.Lines);
            }

            wnd.Display();
        }
Exemplo n.º 21
0
 /// <summary>
 /// Create a new Vert.
 /// </summary>
 /// <param name="x">The X position.</param>
 /// <param name="y">The Y position.</param>
 /// <param name="color">The Color.</param>
 /// <param name="u">The X position on the Texture.</param>
 /// <param name="v">The Y position on the Texture.</param>
 public Vert(float x, float y, Color color, float u, float v) {
     vertex = new SFML.Graphics.Vertex(new Vector2f(x, y), color.SFMLColor, new Vector2f(u, v));
 }
Exemplo n.º 22
0
 internal void Draw(Vertex[] vertices, PrimitiveType primitiveType, RenderStates states)
 {
     RenderTarget.Draw(vertices, primitiveType, states);
 }
Exemplo n.º 23
0
 unsafe static extern void sfRenderWindow_drawPrimitives(IntPtr CPointer, Vertex* vertexPtr, uint vertexCount, PrimitiveType type, ref RenderStates.MarshalData renderStates);
Exemplo n.º 24
0
            ////////////////////////////////////////////////////////////
            /// <summary>
            /// Draw primitives defined by a sub-array of vertices
            /// </summary>
            /// <param name="vertices">Pointer to the vertices</param>
            /// <param name="start">Index of the first vertex to use in the array</param>
            /// <param name="count">Number of vertices to draw</param>
            /// <param name="type">Type of primitives to draw</param>
            /// <param name="states">Render states to use for drawing</param>
            ////////////////////////////////////////////////////////////
            public void Draw(Vertex[] vertices, uint start, uint count, PrimitiveType type, RenderStates states)
            {
                RenderStates.MarshalData marshaledStates = states.Marshal();

                unsafe
                {
                    fixed (Vertex* vertexPtr = vertices)
                    {
                        sfRenderWindow_drawPrimitives(CPointer, vertexPtr + start, count, type, ref marshaledStates);
                    }
                }
            }
Exemplo n.º 25
0
 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Draw primitives defined by a sub-array of vertices, with default render states
 /// </summary>
 /// <param name="vertices">Array of vertices to draw</param>
 /// <param name="start">Index of the first vertex to draw in the array</param>
 /// <param name="count">Number of vertices to draw</param>
 /// <param name="type">Type of primitives to draw</param>
 ////////////////////////////////////////////////////////////
 public void Draw(Vertex[] vertices, uint start, uint count, PrimitiveType type)
 {
     Draw(vertices, start, count, type, RenderStates.Default);
 }
Exemplo n.º 26
0
 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Draw primitives defined by an array of vertices
 /// </summary>
 /// <param name="vertices">Pointer to the vertices</param>
 /// <param name="type">Type of primitives to draw</param>
 /// <param name="states">Render states to use for drawing</param>
 ////////////////////////////////////////////////////////////
 public void Draw(Vertex[] vertices, PrimitiveType type, RenderStates states)
 {
     Draw(vertices, 0, (uint)vertices.Length, type, states);
 }
Exemplo n.º 27
0
 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Draw primitives defined by an array of vertices, with default render states
 /// </summary>
 /// <param name="vertices">Pointer to the vertices</param>
 /// <param name="type">Type of primitives to draw</param>
 ////////////////////////////////////////////////////////////
 public void Draw(Vertex[] vertices, PrimitiveType type)
 {
     Draw(vertices, type, RenderStates.Default);
 }
Exemplo n.º 28
0
 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Add a vertex to the array
 /// </summary>
 /// <param name="vertex">Vertex to add</param>
 ////////////////////////////////////////////////////////////
 public void Append(Vertex vertex)
 {
     sfVertexArray_append(CPointer, vertex);
 }
Exemplo n.º 29
0
 static extern void sfVertexArray_append(IntPtr CPointer, Vertex vertex);
Exemplo n.º 30
0
        private void addVertex(Vector2f position, float u, float v, SFML.Graphics.Color colour)
        {
            Vertex vert = new Vertex();
            vert.Position = position;
            vert.TexCoords = new Vector2f(u, v);
            vert.Color = colour;

            m_vertices.Append(vert);
        }