package fr.monkhanny.dorfromantik.listeners;

import fr.monkhanny.dorfromantik.game.Board;

import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;

public class GameMouseWheelListener implements MouseWheelListener {
    private Board board;

    // Constructeur de la classe
    public GameMouseWheelListener(Board board) {
        this.board = board;
    }

    @Override
    public void mouseWheelMoved(MouseWheelEvent e) {
        if (board.getNextTile() != null) {
            boolean clockwise = e.getWheelRotation() < 0;  // Si la molette va vers le haut, rotation horaire
            board.getNextTile().rotate(clockwise);  // Applique la rotation sur la tuile
            board.repaint();
        }
    }
}
