Class containing all the bitmaps for the 10 different mazes used throughout the game.

Committer:
el15mh
Date:
Fri Apr 07 10:28:57 2017 +0000
Revision:
1:8ed19eb9e7e5
Parent:
0:d5a32831fa28
Child:
2:834bd321a30d
whole program basic with menu interface

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el15mh 0:d5a32831fa28 1 //
el15mh 0:d5a32831fa28 2 // maze.cpp
el15mh 0:d5a32831fa28 3 //
el15mh 0:d5a32831fa28 4 //
el15mh 0:d5a32831fa28 5 // Created by Max Houghton on 19/03/2017.
el15mh 0:d5a32831fa28 6 //
el15mh 0:d5a32831fa28 7 //
el15mh 0:d5a32831fa28 8
el15mh 0:d5a32831fa28 9 #include "Maze.h"
el15mh 0:d5a32831fa28 10
el15mh 0:d5a32831fa28 11 Maze::Maze()
el15mh 0:d5a32831fa28 12 {
el15mh 0:d5a32831fa28 13
el15mh 0:d5a32831fa28 14 }
el15mh 0:d5a32831fa28 15
el15mh 0:d5a32831fa28 16 Maze::~Maze()
el15mh 0:d5a32831fa28 17 {
el15mh 0:d5a32831fa28 18
el15mh 0:d5a32831fa28 19 }
el15mh 0:d5a32831fa28 20
el15mh 1:8ed19eb9e7e5 21 void Maze::init(int mazeIndex)
el15mh 1:8ed19eb9e7e5 22 {
el15mh 1:8ed19eb9e7e5 23 _mazeIndex = mazeIndex;
el15mh 1:8ed19eb9e7e5 24 }
el15mh 1:8ed19eb9e7e5 25
el15mh 1:8ed19eb9e7e5 26 void Maze::draw(N5110 &lcd)
el15mh 1:8ed19eb9e7e5 27 {
el15mh 1:8ed19eb9e7e5 28 if (_mazeIndex == 0){
el15mh 1:8ed19eb9e7e5 29 drawBox(lcd);
el15mh 1:8ed19eb9e7e5 30 }
el15mh 1:8ed19eb9e7e5 31 else if (_mazeIndex == 1){
el15mh 1:8ed19eb9e7e5 32 drawMazeOne(lcd);
el15mh 1:8ed19eb9e7e5 33 }
el15mh 1:8ed19eb9e7e5 34 else if (_mazeIndex == 2){
el15mh 1:8ed19eb9e7e5 35 drawMazeTwo(lcd);
el15mh 1:8ed19eb9e7e5 36 }
el15mh 1:8ed19eb9e7e5 37 }
el15mh 1:8ed19eb9e7e5 38
el15mh 0:d5a32831fa28 39 void Maze::drawBox(N5110 &lcd)
el15mh 0:d5a32831fa28 40 {
el15mh 0:d5a32831fa28 41 // lcd.clear();
el15mh 0:d5a32831fa28 42
el15mh 0:d5a32831fa28 43 for (int i = 0; i < WIDTH; i++){
el15mh 0:d5a32831fa28 44 lcd.setPixel(i, 0);
el15mh 0:d5a32831fa28 45 lcd.setPixel(i, HEIGHT - 1);
el15mh 0:d5a32831fa28 46 }
el15mh 0:d5a32831fa28 47
el15mh 0:d5a32831fa28 48 for (int j = 0; j < HEIGHT; j++){
el15mh 0:d5a32831fa28 49 lcd.setPixel(0, j);
el15mh 0:d5a32831fa28 50 lcd.setPixel(WIDTH - 1, j);
el15mh 0:d5a32831fa28 51 }
el15mh 0:d5a32831fa28 52 }
el15mh 0:d5a32831fa28 53
el15mh 0:d5a32831fa28 54 void Maze::drawTest(N5110 &lcd)
el15mh 0:d5a32831fa28 55 {
el15mh 0:d5a32831fa28 56 // lcd.clear();
el15mh 0:d5a32831fa28 57
el15mh 0:d5a32831fa28 58 lcd.drawLine(2, 2, 30, 2, FILL_BLACK);
el15mh 0:d5a32831fa28 59 lcd.drawLine(20, 2, 20, 20, FILL_BLACK);
el15mh 0:d5a32831fa28 60 }
el15mh 0:d5a32831fa28 61
el15mh 0:d5a32831fa28 62 void Maze::drawMazeOne(N5110 &lcd)
el15mh 0:d5a32831fa28 63 {
el15mh 0:d5a32831fa28 64 // lcd.clear();
el15mh 0:d5a32831fa28 65
el15mh 0:d5a32831fa28 66 lcd.drawRect(0, 0, 83, 47, FILL_TRANSPARENT);
el15mh 0:d5a32831fa28 67
el15mh 0:d5a32831fa28 68 lcd.drawLine(10, 0, 10, 40, FILL_BLACK);
el15mh 0:d5a32831fa28 69 lcd.drawLine(10, 40, 20, 40, FILL_BLACK);
el15mh 0:d5a32831fa28 70 lcd.drawLine(20, 0, 20, 20, FILL_BLACK);
el15mh 0:d5a32831fa28 71 lcd.drawLine(20, 10, 30, 10, FILL_BLACK);
el15mh 0:d5a32831fa28 72 lcd.drawLine(20, 30, 30, 30, FILL_BLACK);
el15mh 0:d5a32831fa28 73 lcd.drawLine(20, 20, 40, 20, FILL_BLACK);
el15mh 0:d5a32831fa28 74 lcd.drawLine(40, 0, 40, 10, FILL_BLACK);
el15mh 0:d5a32831fa28 75 lcd.drawLine(30, 30, 30, HEIGHT - 1, FILL_BLACK);
el15mh 0:d5a32831fa28 76 lcd.drawLine(30, 40, 50, 40, FILL_BLACK);
el15mh 0:d5a32831fa28 77 lcd.drawLine(40, 20, 40, 30, FILL_BLACK);
el15mh 0:d5a32831fa28 78 lcd.drawLine(40, 30, 60, 30, FILL_BLACK);
el15mh 0:d5a32831fa28 79 lcd.drawLine(50, 20, 70, 20, FILL_BLACK);
el15mh 0:d5a32831fa28 80 lcd.drawLine(50, 10, 50, 20, FILL_BLACK);
el15mh 0:d5a32831fa28 81 lcd.drawLine(60, 30, 60, 40, FILL_BLACK);
el15mh 0:d5a32831fa28 82 lcd.drawLine(70, 20, 70, 40, FILL_BLACK);
el15mh 0:d5a32831fa28 83 lcd.drawLine(50, 10, WIDTH - 1, 10, FILL_BLACK);
el15mh 0:d5a32831fa28 84
el15mh 0:d5a32831fa28 85 // lcd.drawRect(20, 10, 11, 10, FILL_BLACK);
el15mh 0:d5a32831fa28 86 // lcd.drawRect(80, 10, 4, 38, FILL_BLACK);
el15mh 0:d5a32831fa28 87
el15mh 0:d5a32831fa28 88 }
el15mh 0:d5a32831fa28 89
el15mh 0:d5a32831fa28 90 void Maze::drawMazeTwo(N5110 &lcd)
el15mh 0:d5a32831fa28 91 {
el15mh 0:d5a32831fa28 92
el15mh 0:d5a32831fa28 93 }