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: ELEC2645_JoystickLCD_LPC1768_2021
Diff: lib/Road.cpp
- Revision:
- 5:7930d289e7fc
- Parent:
- 4:def20a1665d1
- Child:
- 9:6f060f495536
diff -r def20a1665d1 -r 7930d289e7fc lib/Road.cpp
--- a/lib/Road.cpp Sun Mar 21 17:03:59 2021 +0000
+++ b/lib/Road.cpp Fri Mar 26 15:21:07 2021 +0000
@@ -1,5 +1,4 @@
#include "Road.h"
-#include <vector>
// constructure
Road::Road() {}
@@ -17,25 +16,15 @@
_inclination = inclination;
}
-void Road::draw(N5110 &lcd, Utils &utils, float direction) {
- /*
- if (direction == 0) {
- lcd.drawLine( 0,12,84,12,0,1);
- lcd.drawLine(42,12,42,48,0,4);
- lcd.drawLine(28,12,12,48,0,1);
- lcd.drawLine(56,12,72,48,0,1);
- }*/
-
- //else {
- lcd.drawLine (0,12,84,12,0,1);
- std::vector<Vector2Df> curve_points_1 = utils.getCurve(12,48,20 + 5 * direction, 30 - abs(direction),28,12);
- std::vector<Vector2Df> curve_points_2 = utils.getCurve(72,48,64 + 5 * direction, 30 - abs(direction),56,12);
- std::vector<Vector2Df> curve_points_3 = utils.getCurve(42,48,42 + 5 * direction, 30 - abs(direction),42,12);
+void Road::draw(N5110 &lcd, Utils &utils, float direction, float offset) {
+ lcd.drawLine (0,12,84,12,0,1);
+ std::vector<Vector2Df> curve_points_1 = utils.getCurve(12,48,20 + 5 * direction, 30 - abs(direction),28,12);
+ std::vector<Vector2Df> curve_points_2 = utils.getCurve(72,48,64 + 5 * direction, 30 - abs(direction),56,12);
+ std::vector<Vector2Df> curve_points_3 = utils.getCurve(42,48,42 + 5 * direction, 30 - abs(direction),42,12);
- lcd.drawCurve(curve_points_1, 0, 1, TYPE_SOLID);
- lcd.drawCurve(curve_points_2, 0, 1, TYPE_SOLID);
- lcd.drawCurve(curve_points_3, 0, 1, TYPE_DOTTED);
- //}
+ lcd.drawCurve(curve_points_1, 0, 1, TYPE_SOLID);
+ lcd.drawCurve(curve_points_2, 0, 1, TYPE_SOLID);
+ lcd.drawCurve(curve_points_3, offset, 1, TYPE_DOTTED);
}