Newer
Older
AlgebraicDataflowArchitectureModel / GameEngine / src / main / java / gameEngine / entites / gameComponents / ButtonComponent.java
package gameEngine.entites.gameComponents;

import gameEngine.entites.Entity;
import gameEngine.views.Button;
import gameEngine.views.Color;

public class ButtonComponent extends GameComponent {
    private Button button;

    public ButtonComponent(Entity entity) {
        this.button = new Button(entity.transform.position.x, entity.transform.position.y,
                entity.transform.scale.x, entity.transform.scale.y);
    }

    @Override
    public GameComponent copy() {
        return this;  // Deep copy if needed
    }

    public void init() {
        button.update();
    }

    public void update() {
        button.update();
    }

    public void addListener(Runnable listener) {
        button.addListener(listener);
    }

    public void clearListeners() {
        button.clearListeners();
    }

    public void setNormalColor(Color color) {
        button.setNormalColor(color);
    }

    public void setPressedColor(Color color) {
        button.setPressedColor(color);
    }
}