Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How can i get access to vertex in VertexArray?  (Read 4461 times)

0 Members and 1 Guest are viewing this topic.

kubawich

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
How can i get access to vertex in VertexArray?
« on: July 29, 2016, 12:26:33 pm »
Hi, i'm learning SFML.net and i've created vertex array with
public static VertexArray arr = new VertexArray(PrimitiveType.Lines, 2);
And when i try to get access to arr[0].position 4example i get error 'Cannot modify return value, because it's not variable' So how can i get access to any vertex in this array? In normal vertex class it works properly.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: How can i get access to vertex in VertexArray?
« Reply #1 on: July 29, 2016, 12:55:05 pm »
Vertex is a structure, so it is always passed by copy. I'm not an expert but think you have to do this:

Vertex v = arr[0];
v.position = ...;
arr[0] = v;
Laurent Gomila - SFML developer

kubawich

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: How can i get access to vertex in VertexArray?
« Reply #2 on: July 29, 2016, 01:04:23 pm »
Thanks Laurent, it works... and creates big amounts of additional code  :'( Btw. is there binding of sfml 2.3 for .net?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: How can i get access to vertex in VertexArray?
« Reply #3 on: July 29, 2016, 01:18:58 pm »
Quote
and creates big amounts of additional code
Yes, there are many things that I don't like in SFML.Net, but there's no way to do them differently with C#.

Quote
Btw. is there binding of sfml 2.3 for .net?
Nop, sorry.
Laurent Gomila - SFML developer