Package fr.iut.tetris.controllers
Class CoopController
- java.lang.Object
-
- fr.iut.tetris.controllers.CoopController
-
- All Implemented Interfaces:
java.awt.event.ActionListener,java.awt.event.KeyListener,java.util.EventListener
public class CoopController extends java.lang.Object implements java.awt.event.ActionListener, java.awt.event.KeyListener
-
-
Field Summary
Fields Modifier and Type Field Description (package private) AudioControlleraudio(package private) MainControllermainCtrl(package private) CoopModelmodelprivate longtimerCounterThe main game timer ticks every 10 ms but to set adjustable times we increment the variable timerCounter by 10 and can then compare it with model.fallSpeed to seed if we should do somethingCoopVuevue
-
Constructor Summary
Constructors Constructor Description CoopController(MainController mainCtrl, CoopModel model, AudioController audio)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent e)Listen for incoming event and do some action accordinglyintgameEnded()Fonction executed by the model when the game ends and return the best scrore (and save it to the config)voidkeyPressed(java.awt.event.KeyEvent e)Listen for key presses and do action according to the keys in the config filevoidkeyReleased(java.awt.event.KeyEvent e)voidkeyTyped(java.awt.event.KeyEvent e)voidsetVue(CoopVue vue)(package private) voidtimerTicked()
-
-
-
Field Detail
-
mainCtrl
MainController mainCtrl
-
model
CoopModel model
-
vue
public CoopVue vue
-
audio
AudioController audio
-
timerCounter
private long timerCounter
The main game timer ticks every 10 ms but to set adjustable times we increment the variable timerCounter by 10 and can then compare it with model.fallSpeed to seed if we should do something
-
-
Constructor Detail
-
CoopController
public CoopController(MainController mainCtrl, CoopModel model, AudioController audio)
-
-
Method Detail
-
setVue
public void setVue(CoopVue vue)
-
gameEnded
public int gameEnded()
Fonction executed by the model when the game ends and return the best scrore (and save it to the config)- Returns:
- the best score
-
timerTicked
void timerTicked()
-
keyTyped
public void keyTyped(java.awt.event.KeyEvent e)
- Specified by:
keyTypedin interfacejava.awt.event.KeyListener
-
keyReleased
public void keyReleased(java.awt.event.KeyEvent e)
- Specified by:
keyReleasedin interfacejava.awt.event.KeyListener
-
keyPressed
public void keyPressed(java.awt.event.KeyEvent e)
Listen for key presses and do action according to the keys in the config file- Specified by:
keyPressedin interfacejava.awt.event.KeyListener- Parameters:
e- the event
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
Listen for incoming event and do some action accordingly- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener- Parameters:
e- the event
-
-