Joe Body 201215898
Embed:
(wiki syntax)
Show/hide line numbers
Pup.cpp
00001 #include "Pup.h" 00002 00003 00004 const int stime [9][9] = 00005 { 00006 {0,0,0,1,1,1,0,0,0}, 00007 {0,0,1,0,1,0,1,0,0}, 00008 {0,1,0,0,1,0,0,1,0}, 00009 {1,0,0,0,1,0,0,0,1}, 00010 {1,0,0,0,1,1,1,0,1}, 00011 {1,0,0,0,0,0,0,0,1}, 00012 {0,1,0,0,0,0,0,1,0}, 00013 {0,0,1,0,0,0,1,0,0}, 00014 {0,0,0,1,1,1,0,0,0}, 00015 }; 00016 00017 Pup::Pup() 00018 { 00019 00020 } 00021 00022 Pup::~Pup() 00023 { 00024 00025 } 00026 00027 void Pup::init(){ 00028 _x = 0; 00029 _y = 0; 00030 _height = 9; 00031 _width = 9; 00032 } 00033 00034 void Pup::draw(N5110 &lcd, bool state) 00035 { 00036 // draw clock 00037 bool _state = state; 00038 00039 if (_state == 0){ 00040 lcd.drawSprite(_x,_y,9,9,(int*)stime); 00041 } 00042 } 00043 00044 void Pup::position(int x, int y) 00045 { 00046 //Vector2D aim_pos = aim.get_pos(); 00047 _y = 2 * y; 00048 if (_y > 39){ 00049 _y = rand() % 42 + 1; 00050 } 00051 _x = 2 * x; 00052 if (_x > 74){ 00053 _x = rand() % 24 + 1; 00054 } 00055 } 00056 00057 Vector2D Pup::get_pos() { 00058 Vector2D p = {_x,_y}; 00059 return p; 00060 } 00061 00062 00063
Generated on Wed Jul 13 2022 05:56:35 by
1.7.2