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
PeopleEngine.cpp
00001 #include "PeopleEngine.h" 00002 00003 PeopleEngine::PeopleEngine() 00004 { 00005 00006 } 00007 00008 PeopleEngine::~PeopleEngine() 00009 { 00010 00011 } 00012 00013 void PeopleEngine::init() 00014 { 00015 _people.init(); 00016 } 00017 void PeopleEngine::read_input(Gamepad &pad) 00018 { 00019 //directions held in an enum and magnitude in polar coordinates 00020 _d = pad.get_direction(); 00021 _mag = pad.get_mag(); 00022 //printf("velocity = %d,%f\n",_d,_mag); 00023 } 00024 void PeopleEngine::update() 00025 { 00026 _people.set_velocity(_d,_mag); 00027 _people.update(); 00028 //_p=_people.get_pos(); 00029 //printf("position = %f,%f\n",_p.x,_p.y); 00030 } 00031 00032 void PeopleEngine::draw(N5110 &lcd,int flag) 00033 { 00034 //lcd.clear(); 00035 _people.draw(lcd,flag); 00036 lcd.drawRect(0,0,WIDTH,HEIGHT,FILL_TRANSPARENT);//box of the game 00037 lcd.drawCircle(0,HEIGHT/2,7,FILL_TRANSPARENT);//destination 00038 lcd.drawCircle(WIDTH-1,HEIGHT/2,7,FILL_TRANSPARENT);//starting point 00039 } 00040 00041 Vector2D PeopleEngine::get_pos() 00042 { 00043 _p = _people.get_pos(); 00044 return _p; 00045 }
Generated on Thu Jul 14 2022 12:45:25 by
1.7.2