Newer
Older
/*
* 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;
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;
}
{
int[]pos = this.getButtonPos(button);
public void gameRightButtonPressed(String button)
{
int[] pos = this.getButtonPos(button);
model.flagButton(pos);
}
public void gameStart()
{
if( this.model != null && this.view != null )
{
StopWatch watch = new StopWatch(this);
watch.start();
}
}
public void timeLeft()
{
view.timeLeft();
}