SFML community forums
Bindings - other languages => DotNet => Topic started by: RcColes on June 26, 2013, 01:21:56 pm
-
I'm not sure if this is a bug or if I'm fundamentally misunderstanding how this function works, but whenever I call InverseTransform on a sprite it crashes with "'System.AccessViolationException' occurred in mscorlib.dll".
namespace Testcase
{ class Program
{ static void Main
(string[] args
) { Sprite sp1
= new Sprite
(new Texture
("test.png")); //16*16 image sp1
.Transform.Translate(1,
1); // make sure it has a transform applied Transform step1
= sp1
.Transform; Transform step2
= step1
.GetInverse(); //crashes here } }}
Note that in the testcase I get the transform then call GetInverse, so that I could isolate the problem the the inversion of the transform.
-
The Transform property is read-only (if only it was supported by C#...), you're not supposed to call Translate on it, the result is undefined.
-
Unfortunately the problem is still occurring when the call to transform.translate is removed, and replaced with what I think is the correct method for translating sprites.
namespace Testcase
{ class Program
{ static void Main
(string[] args
) { Sprite sp1
= new Sprite
(new Texture
("test.png")); //16*16 image sp1
.Position = new Vector2f
(1,
1); Transform step1
= sp1
.Transform; Transform step2
= step1
.GetInverse(); //crashes here } }}