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

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

public class ButtonComponent extends GameComponent {
    private Button button;

    public ButtonComponent(GameObject parent) {
        this.button = new Button(parent.transform.position.x, parent.transform.position.y,
                parent.transform.scale.x, parent.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);
    }
}