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.
Winch.h
00001 #ifndef Winch_H 00002 #define Winch_H 00003 00004 #include "mbed.h" 00005 #include "N5110.h" 00006 #include "Gamepad.h" 00007 00008 /** Winch Class 00009 @brief Controls the winch in the gold miner game 00010 @author Yufan Zhong, University of Leeds and SWJTU 00011 @date May 2020 00012 */ 00013 00014 class Winch 00015 { 00016 public: 00017 /** Constructor */ 00018 Winch(); 00019 00020 /** Destructor */ 00021 ~Winch(); 00022 00023 /** Initialise the winch 00024 * @param height - the height of the winch 00025 * @param width - the width of the winch 00026 */ 00027 void init(int height,int width); 00028 00029 /** Draw the winch on the screen 00030 * @param lcd - N5110 library 00031 */ 00032 void draw(N5110 &lcd); 00033 00034 /** Update data 00035 * @param d - direction of the joystick 00036 * @param mag - magnitude of the joystick 00037 */ 00038 void update(Direction d,float mag); 00039 00040 /** Add highest score 00041 */ 00042 void add_highest_score(); 00043 00044 /** Get highest score 00045 * @return the highest score. 00046 */ 00047 int get_highest_score(); 00048 00049 /** Get position of the winch 00050 * @return the position of the winch. 00051 */ 00052 Vector2D get_pos(); 00053 00054 /** Set position of the winch 00055 * @param p - position of the winch 00056 */ 00057 void set_pos(Vector2D p); 00058 00059 /** Get the speed of the winch 00060 * @return the speed of the winch. 00061 */ 00062 float get_speed(); 00063 00064 private: 00065 00066 int _height; 00067 int _width; 00068 int _x; 00069 int _y; 00070 int _speed_x; 00071 int _highest_score; 00072 00073 }; 00074 #endif
Generated on Sat Jul 16 2022 10:18:04 by
1.7.2