-
Notifications
You must be signed in to change notification settings - Fork 0
/
BrickFactory.h
executable file
·54 lines (42 loc) · 1.11 KB
/
BrickFactory.h
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
49
50
51
52
53
54
//
// Created by Anders on 13.12.2015.
//
#ifndef INNLEVERING3_BRICKFACTORY_H
#define INNLEVERING3_BRICKFACTORY_H
// arduino libs
#include <Arduino.h>
// own libs
#include "LevelManager.h"
struct ActiveBrick;
struct Coordinate;
// colors
#define ST7735_PINK_COLOR 0
#define ST7735_MAGENTA_COLOR 1
#define ST7735_YELLOW_COLOR 2
#define ST7735_BLUE_COLOR 3
#define ST7735_WHITE_COLOR 4
#define ST7735_RED_COLOR 5
#define ST7735_LOW_BLUE_COLOR 6
#define ST7735_GREEN_COLOR 7
// bricks
typedef struct Brick {
byte brickID;
} Brick;
#define BRICK_SIZE 5
#define BRICK_PACK_SIZE 7
// contains 7 randomized brick configurations to comply with "no triple brick within 7 bricks" rule
typedef struct BrickPack {
Brick bricks[7];
byte size;
} BrickPack;
class BrickFactory {
public:
void newRandomBrick(ActiveBrick& activeBrick);
void buildBrickPack();
private:
BrickPack brickPack;
Brick createBrick(byte currentLength);
void setVisualRepresentation(ActiveBrick& brickToSet, byte color,
unsigned long representation) const;
};
#endif