Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Map/Map.cpp
- Committer:
- lewisgw
- Date:
- 2019-03-23
- Revision:
- 8:5327418f823a
- Parent:
- 6:8741d2011692
- Child:
- 9:fff2009f826e
File content as of revision 8:5327418f823a:
#include "Map.h" Map::Map(){} Map::~Map(){} void Map::init() { _line_1.x_start = 0; _line_1.x_end = 15; _line_1.y = 40; _line_2.x_start = 25; _line_2.x_end = 50; _line_2.y = 40; _line_3.x_start = 60; _line_3.x_end = 80; _line_3.y = 40; } void Map::generate_line_1(int length) { _line_1.x_start--; if(_line_1.x_start < 80 - length) { _line_1.x_end--; } if(_line_1.x_start <= 0) { _line_1.x_start = 0; } if(_line_1.x_end <= 0) { _line_1.x_start = 80; _line_1.x_end = 80; } } void Map::generate_line_2(int length) { _line_2.x_start--; if(_line_2.x_start < 80 - length) { _line_2.x_end--; } if(_line_2.x_start <= 0) { _line_2.x_start = 0; } if(_line_2.x_end <= 0) { _line_2.x_start = 80; _line_2.x_end = 80; } } void Map::generate_line_3(int length) { _line_3.x_start--; if(_line_3.x_start < 80 - length) { _line_3.x_end--; } if(_line_3.x_start <= 0) { _line_3.x_start = 0; } if(_line_3.x_end <= 0) { _line_3.x_start = 80; _line_3.x_end = 80; } } Line Map::get_line_1() { return _line_1; } Line Map::get_line_2() { return _line_2; } Line Map::get_line_3() { return _line_3; } /* if(_line_1.x_end < (80 - gap_size)) { // only start moving line 2 if the gap has passed _line_2_counter = 1; } else { _line_2_counter = 0; } _line_2.x_start = _line_2.x_start - _line_2_counter; // on every iteration increase size of line 2, fixed on RHS and increasing on LHS _line_2.x_end = _line_2.x_start + 80; if(_line_2.x_end > 81) { _line_2.x_end = 80; // ensure ends at 80 TEST THIS ON ITS OWN } if(_line_2.x_start == 1) { _line_1.x_start = 0; _line_1.x_end = 80; _line_2.x_start = 80; _line_2.x_end = 80; } */