Instead of extending Actor
you could extend Image
, which is a subclass of Actor
. Image
allready holds a Drawable
(you can use your TextureRegion
in the constructor of TextureRegionDrawable
). Then in your Image
-subclass you can override draw(Batch batch, float parentAlpha)
, do some controlls if necessary and call suoer.draw(batch, parentAlpha)
and there your Actor
will be drawn at the right position
, rotation
, scale
...
EDIT: Image
is a subclass of Widget
. Widget
itself extends Actor
.
From LibGDX Api:
Displays a Drawable, scaled various way within the widgets bounds. The
preferred size is the min size of the drawable. Only when using a
TextureRegionDrawable will the actor's scale, rotation, and origin be
used when drawing.
So if you use a TextureRegionDrawable it will also handle the rotation, scale and origin you set to your Actor
, if you need that. It has everything that Actor
class has and MORE
Another EDIT: As you said you have to store other data you can simply have your MyActor extends Image
. In your MyActor
you can store all the Data you need, but you don't need to store the Image anymore and you don't have to take care about drawing anymore. So this is just a suggestion.