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
Diff: Rasturizer/Rasturizer.cpp
- Revision:
- 25:3995271e411c
- Parent:
- 22:236319885874
- Child:
- 26:8a85aede976d
--- a/Rasturizer/Rasturizer.cpp Wed Apr 03 16:19:05 2019 +0000
+++ b/Rasturizer/Rasturizer.cpp Wed Apr 03 20:03:47 2019 +0000
@@ -25,9 +25,9 @@
void Rasturizer::drawHorizon(float angle){
lcd.drawLine(0,
- 21-rint(angle*40),
+ 21-rint(-angle*40),
84,
- 21+rint(angle*40),
+ 21+rint(-angle*40),
1);
}
@@ -44,8 +44,8 @@
y = points[vertex][1];
x = points[vertex][0];
- points[vertex][0] = x*cos(angle)-y*sin(angle);
- points[vertex][1] = y*cos(angle)+x*sin(angle);
+ points[vertex][0] = x*cos(-angle)-y*sin(-angle);
+ points[vertex][1] = y*cos(-angle)+x*sin(-angle);
}
if (checkOnScreen(points)){
@@ -123,12 +123,20 @@
lcd.printString(text, x, y);
}
+void Rasturizer::printScore(int score){
+ char buffer[5];
+ sprintf(buffer, "%d", score/3);
+ print(buffer, 0, 0);
+ memset(buffer, 0, sizeof buffer);
+}
+
void Rasturizer::clear(){
lcd.clear();
}
void Rasturizer::refresh(){
lcd.refresh();
+ wait_ms(1000/60);
}
void Rasturizer::drawDeathScreen(bool selection){