There is a point:

class Dot extends Actor { @Override public void draw(Batch batch, float parentAlpha){ batch.draw(dotimg, getX(), getY(), getWidth(), getHeight()); } } 

There is inputlistener

 class MyInputListener extends InputListener{ @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { event.getListenerActor().setSize(200,200); event.getListenerActor().setColor(Color.BLUE); } } 

setSize () works, but setColor () does not. How does he work? Why he does not change the color of the point? Or does it depend on the texture? Thank you in advance

    1 answer 1

    We must do so:

     @Override public void draw(Batch batch, float parentAlpha) { Color batchColor = batch.getColor(); final float r = batchColor.r; final float g = batchColor.g; final float b = batchColor.b; final float a = batchColor.a; Color dotColor = getColor(); batch.setColor(dotColor.r, dotColor.g, dotColor.b, dotColor.a * parentAlpha); batch.draw(dotimg, getX(), getY(), getWidth(), getHeight()); batch.setColor(r, g, b, a); } 
    • Thank you, but how to make it so that it covers not a square, but a circle? Or do I need to trim the texture from the white (invisible edges) so that it paints only the circle? - ramazan793
    • and I also write color in rgba (217, 46, 46, 1), but the point is not painted, And through Color.BLUE it is painted - ramazan793
    • and everything depends on the form of the texture itself - ramazan793