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
Pup.cpp
- Committer:
- el18jgb
- Date:
- 2020-05-18
- Revision:
- 9:2836fc3d9ede
- Parent:
- 7:04a7826ff7e4
File content as of revision 9:2836fc3d9ede:
#include "Pup.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; }