-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInnlevering3.ino
executable file
·48 lines (41 loc) · 1.08 KB
/
Innlevering3.ino
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// arduino libs
#include <Arduino.h>
#include <Adafruit_ST7735.h>
#include <ADXL335.h>
#include <SD.h>
// own libs
#include "GameManager.h"
GameManager gameManager;
LevelManager levelManager;
BrickFactory brickFactory;
Screen screen;
InputManager inputManager;
SDCardManager sdCardManager;
MusicPlayer musicPlayer;
Accelerometer accelerometer;
void setup() {
levelManager.setBrickFactory(brickFactory);
gameManager.setManagers(levelManager, screen, accelerometer, sdCardManager, inputManager);
gameManager.setMusicPlayer(musicPlayer);
gameManager.initializeNewGameState();
}
// set in game manager
ISR(TIMER1_COMPA_vect) {
gameManager.updateMusic();
}
void loop() {
while (*gameManager.getGameState() == GameInit) {
if (gameManager.checkPushInput()) {
gameManager.startGame();
break;
}
}
if (*gameManager.getGameState() != GameOver) {
gameManager.doGameLoop();
}
while (*gameManager.getGameState() == GameOver) {
if (gameManager.checkPushInput()) {
gameManager.resetToNewGame();
}
}
}