-
Notifications
You must be signed in to change notification settings - Fork 0
/
TankAttack.java
32 lines (32 loc) · 1.07 KB
/
TankAttack.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class TankAttack{
public static void main(String[] args){
levelLogic = new LevelLogic();
levelLogic.createNewGameScreen();
gameController = new GamePadController();
gameController.setRumbler(false);
startPolling();
}
private static void startPolling(){
ActionListener pollPerformer = new ActionListener(){
public void actionPerformed(ActionEvent e){
gameController.poll();
//int hatDxn = gameController.getHatDir();
//int xyStickDxn = gameController.getXYStickDir();
//int zrzStickDxn = gameController.getZRZStickDir();
double[] xyStickDxn = gameController.getRawXYStickDir();
double[] zrzStickDxn = gameController.getRawZRZStickDir();
boolean[] buttons = gameController.getButtons();
levelLogic.update(xyStickDxn,zrzStickDxn,buttons);
}
};
pollTimer = new Timer(DELAY, pollPerformer);
pollTimer.start();
}
private static final int DELAY = 20;
private static LevelLogic levelLogic;
private static GamePadController gameController;
private static Timer pollTimer;
}