package fr.monkhanny.dorfromantik.controller;

import fr.monkhanny.dorfromantik.gui.ButtonHoverAnimator;
import fr.monkhanny.dorfromantik.utils.MusicPlayer;
import fr.monkhanny.dorfromantik.enums.Sounds;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class ButtonHoverListener extends MouseAdapter {

    private final ButtonHoverAnimator animator;

    public ButtonHoverListener(ButtonHoverAnimator animator) {
        this.animator = animator;
    }

    @Override
    public void mouseEntered(MouseEvent e) {
        animator.startAnimation(true);
        MusicPlayer.loadSound(Sounds.SOUNDS1);  // Charge le son
        MusicPlayer.playSound();                // Joue le son
    }

    @Override
    public void mouseExited(MouseEvent e) {
        animator.startAnimation(false);
    }
}
