Gornova / MarteEngine

MarteEngine is a Java Engine for videogames
http://randomtower.blogspot.com
Other
74 stars 20 forks source link

Resource Copies #86

Closed Stef569 closed 12 years ago

Stef569 commented 12 years ago

When you retrieve the same image from the resourcemanager and rotate 1 of them, they are all rotated!

for example:

Image a = ResourceManager.getImage("star"); Entity starA = new Star(50, 50 ,a) Image b = ResourceManager.getImage("star"); Entity starB = new Star(100, 150, b)

starA.setAngle(50);

starB is also rotated, since they share the same image instance.

ResourceManager.getImage and getAnimation could return a copy...

image.copy() and animation.copy()

or

Entity could create a copy when an image or animation is set (using the setGraphic or addAnimation methods)

additional problem is that BigImage does not support copy()

Stef569 commented 12 years ago

Would it be useful to add ResourceManager.setReturnCopies(Boolean)

This would make the Resource manager return a shallow copy when you request an image or animation using the getter. It's a shallow copy because the image texture is not copied.

Stef569 commented 12 years ago

not needed for now