I am currently building a game about infrastructure building and management in XNA(C#).
What I am currently trying to achieve is to make the game draw 'bends' between train tracks. I want to do this by drawing only a certain part of a circle texture.
In other words, I only want to draw a "pizza slice" of this texture. The slice of the circle that needs to be drawn is based on three points:
- The center of the sprite;
- A variable position 'a';
- A variable position 'b';
These three points together determine how much of my circle is drawn on the screen e.g. how big the pizza slice is.
To put it simply: If I have a circle and cut it from the centre to a point 'a' and then again from the centre to a point 'b', how can I only draw the part I've just cut out?
This slice has to be altered in real-time, so the slice becomes bigger and smaller based on those two positions 'a' and 'b'.
What is the best way to achieve this effect?