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: Levelengine.cpp
- Revision:
- 5:0655bddafd9e
- Parent:
- 4:b92da6a09c8b
diff -r b92da6a09c8b -r 0655bddafd9e Levelengine.cpp
--- a/Levelengine.cpp Thu Mar 21 21:29:11 2019 +0000
+++ b/Levelengine.cpp Thu Mar 21 22:55:40 2019 +0000
@@ -2,25 +2,36 @@
#include "Levelengine.h"
Levelengine::Levelengine()
-{
+{
}
Levelengine::~Levelengine()
{
}
+void Levelengine::level_direction(Gamepad &pad)
+{
+ _d = pad.get_direction();
+ printf("direction %i \n", _d);
+}
+
+void Levelengine::level_move(Gamepad &pad)
+{
+ if (_d==3) {
+ _x += 1;
+ }
+ if (_d==7) {
+ _x = _x - 1;
+ }
+}
+
+
void Levelengine::test_level(N5110 &lcd)
-{
-
- //Border
- //lcd.drawRect(0,0,1,HEIGHT,FILL_BLACK);
- //lcd.drawRect(0,0,WIDTH,1,FILL_BLACK);
- //lcd.drawRect(WIDTH -1,15,1,33,FILL_BLACK);
- lcd.drawRect(0,HEIGHT -1,168,1,FILL_BLACK);
-
+{
+ lcd.drawRect(0 - _x,HEIGHT -1,168,1,FILL_BLACK);
+
//platforms
- lcd.drawRect(0,34,30,1,FILL_BLACK);
- lcd.drawRect(40,42,30,1,FILL_BLACK);
- lcd.drawRect(0,22,15,1,FILL_BLACK);
-
+ lcd.drawRect(-5 -_x,34,300,1,FILL_BLACK);
+ lcd.drawRect(140 - _x,42,200,1,FILL_BLACK);
+ lcd.drawRect(50 - _x,22,150,1,FILL_BLACK);
}
\ No newline at end of file