/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package GUI.game;

import Program.Settings;


/**
 *
 * @author Kovax
 */
public class Controller
{
    public View view;
    private Model model;
    public Settings settings;
    
    private Boolean isStopButtonPressed = false;
    
    public Controller(Settings settings)
    {
        this.settings = settings;
    }
    
    public void registerView(View view)
    {
        this.view = view;
    }
    public void registerModel(Model model)
    {
        this.model = model;
    }
    public int getButtonState()
    {
        if( isStopButtonPressed )
            return 1;
        return -1;
        
    }
    public void resetButtonState()
    {
        this.isStopButtonPressed = false;
    }
    
    private int[] getButtonPos(String buttonName)
    {
        String[] splitted =  buttonName.split(":");
        int[] pos = new int[2];
        pos[0] = Integer.parseInt(splitted[0]);
        pos[1] = Integer.parseInt(splitted[1]);
        
        return pos;
    }
    
    public void gameMineButtonPressed(String button)
    {
        int[]pos = this.getButtonPos(button);
        model.calculateButtonStyle(pos);
        
    }
    

    
    
    
}