XNA Required information to represent 2D Sprite graphically
- by Fire-Dragon-DoL
I was thinking about dividing my game engine into 2 threads: render thread and update thread (I can't come up on how to divide update thread from physic thread at the moment).
That said, I have to duplicate all Sprite informations, what do I really need to represents a 2D Sprite graphically?
Here are my ideas (I'll mark with ? things that I'm not sure):
Vector2 Position
float Rotation ?
Vector2 Pivot ?
Rectangle TextureRectangle
Texture2D Texture
Vector2 ImageOrigin ? (is it tracked somewhere else?)
If you have any suggestion about using different types for datas, it's appreciated
Last part of the question: isn't this a lot of data to copy in a buffer?what should I really copy in the buffer?I'm following this tutorial:
http://www.sgtconker.com/2009/11/article-multi-threading-your-xna/3/
Thanks
UPDATE 1:
Newer values at the moment:
Vector2 Position
float Rotation
Vector2 Pivot
Rectangle TextureRectangle
Texture2D Texture
Color Color
byte Facing (can be left or right, I'll do it with an enum)
I re-read the tutorial, what I was doing wrong is not that I need to pass all those values, I need to pass only changed values as messages.
UPDATE 2:
Vector2 Position
float Rotation
Vector2 Pivot
Rectangle TextureRectangle
Texture2D Texture
Color Color
bool Flip
uint DrawOrder
Vector2 Scale
bool Visible ?
Mhhh, should Visibile be included?