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.
Diff: plane.cpp
- Revision:
- 2:cc9d8ec2e1f4
- Parent:
- 1:48b0bf0bcda8
- Child:
- 3:31ff7b3e2005
--- a/plane.cpp Fri May 15 12:32:47 2020 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-#include "plane.h"
-
-void plane::init(){
- _width = 7;
- _height = 8;
- int d[56] = {
- 0,0,1,1,1,0,0,
- 0,0,1,0,1,0,0,
- 0,0,1,1,1,0,0,
- 1,1,0,1,0,0,0,
- 1,0,1,1,1,1,0,
- 1,0,1,1,0,0,0,
- 1,1,0,0,1,0,0,
- 0,0,0,0,1,0,0
- };
- for(int i = 0; i<56;i++){
- data[i] = d[i];
- }
- _xy.x = 0;
- _xy.y = 25;
-}
-
-void plane::update(Gamepad &pad, FXOS8700CQ &device){
- Data values = device.get_values();
-
- printf("ax = %f ay = %f az = %f | mx = %f my = %f mz = %f\n"
- ,values.ax, values.ay, values.az
- ,values.mx, values.my, values.mz);
-
- if(pad.get_direction() == N){
- _xy.y = _xy.y -4;
- }else{
- _xy.y = _xy.y + 3;
- }
-
- if(values.ay>=0){
- _xy.x = _xy.x - int(values.ay*10);
- }else if(values.ay<=0){
- _xy.x = _xy.x - int(values.ay*10);
- }
-
- if(_xy.x>=77){
- _xy.x = 77;
- }else if(_xy.x<=0){
- _xy.x=0;
- }
- if(_xy.y>=41){
- _xy.y = 41 ;
- }else if(_xy.y<=7){
- _xy.y=7;
- }
-}
-
-void plane::display(N5110 &lcd){
- unsigned int width = _width;
- unsigned int height = _height;
- Bitmap p(data, height, width);
- p.render(lcd, _xy.x, _xy.y);
-}
-
-xy plane::getxy(){return _xy;}
-
-int plane::getwidth(){return _width;}
-int plane::getheight(){return _height;}
-