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: Pup.cpp
- Revision:
- 7:04a7826ff7e4
- Child:
- 9:2836fc3d9ede
diff -r d560ecc21ae6 -r 04a7826ff7e4 Pup.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Pup.cpp Sun May 17 17:05:13 2020 +0000
@@ -0,0 +1,63 @@
+#include "Pup.h"
+#include "Aim.h"
+
+const int stime [9][9] =
+{
+ {0,0,0,1,1,1,0,0,0},
+ {0,0,1,0,1,0,1,0,0},
+ {0,1,0,0,1,0,0,1,0},
+ {1,0,0,0,1,0,0,0,1},
+ {1,0,0,0,1,1,1,0,1},
+ {1,0,0,0,0,0,0,0,1},
+ {0,1,0,0,0,0,0,1,0},
+ {0,0,1,0,0,0,1,0,0},
+ {0,0,0,1,1,1,0,0,0},
+};
+
+Pup::Pup()
+{
+
+}
+
+Pup::~Pup()
+{
+
+}
+
+void Pup::init(){
+ _x = 0;
+ _y = 0;
+ _height = 9;
+ _width = 9;
+}
+
+void Pup::draw(N5110 &lcd, bool state)
+{
+ // draw clock
+ bool _state = state;
+
+ if (_state == 0){
+ lcd.drawSprite(_x,_y,9,9,(int*)stime);
+ }
+}
+
+void Pup::position(int x, int y)
+{
+ //Vector2D aim_pos = aim.get_pos();
+ _y = 2 * y;
+ if (_y > 39){
+ _y = rand() % 42 + 1;
+ }
+ _x = 2 * x;
+ if (_x > 74){
+ _x = rand() % 24 + 1;
+ }
+}
+
+Vector2D Pup::get_pos() {
+ Vector2D p = {_x,_y};
+ return p;
+}
+
+
+
\ No newline at end of file