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.
EAHitBox.h
00001 // Copyright 2010 Richard Parker 00002 00003 #ifndef MBED_EAHITBOX_H 00004 #define MBED_EAHITBOX_H 00005 00006 #include "mbed.h" 00007 00008 #include "../widgets/EAWidget.h" 00009 00010 class EAHitBox; 00011 class EAHitHandler; 00012 00013 /** 00014 * Class to handle detection of a hit in an area of the screen. 00015 * @author Richard Parker 00016 */ 00017 class EAHitBox 00018 { 00019 public: 00020 typedef void (*ActionFunction)(EAHitBox*, short, short) ; 00021 00022 EAHitBox(); 00023 00024 ~EAHitBox(); 00025 00026 inline unsigned short width() const { return _width; } 00027 inline unsigned short height() const { return _height; } 00028 00029 inline void setWidth(unsigned int w) { _width = w; } 00030 inline void setHeight(unsigned int h) { _height = h; } 00031 00032 inline unsigned short x() const { return _x; } 00033 inline unsigned short y() const { return _y; } 00034 00035 inline void setX(short x) { _x = x; } 00036 inline void setY(short y) { _y = y; } 00037 00038 inline EAHitBox* next() const { return _next; } 00039 inline void setNext(EAHitBox* value) { _next = value; } 00040 00041 bool checkContains(short x, short y); 00042 00043 inline void setAction(EAHitBox::ActionFunction action) { _action = action; } 00044 00045 inline EAHitHandler* handler() const { return _handler; } 00046 inline void setHandler(EAHitHandler* value) { _handler = value; } 00047 00048 inline bool enabled() { return _enabled; } 00049 inline void setEnabled(bool yes) { _enabled = yes; } 00050 00051 private: 00052 EAHitBox* _next; 00053 00054 EAHitHandler* _handler; 00055 00056 unsigned short _width; 00057 unsigned short _height; 00058 00059 short _x; 00060 short _y; 00061 00062 bool _enabled; 00063 00064 ActionFunction _action; 00065 00066 }; 00067 00068 #endif
Generated on Wed Jul 13 2022 10:26:51 by
1.7.2