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: manager/EAHitBox.h
- Revision:
- 1:f04bcaea1d60
- Child:
- 3:24fbf4dbd7e5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/manager/EAHitBox.h Thu Mar 04 10:54:06 2010 +0000 @@ -0,0 +1,62 @@ +// Copyright 2010 Richard Parker + +#ifndef MBED_EAHITBOX_H +#define MBED_EAHITBOX_H + +#include "mbed.h" + +#include "../widgets/EAWidget.h" + +class EAHitBox; + +/** + * Class to handle detection of a hit in an area of the screen. + * @author Richard Parker + */ +class EAHitBox +{ +public: + typedef void (*ActionFunction)(EAHitBox*, short, short) ; + + EAHitBox(); + + ~EAHitBox(); + + inline unsigned short width() const { return _width; } + inline unsigned short height() const { return _height; } + + inline void setWidth(unsigned int w) { _width = w; } + inline void setHeight(unsigned int h) { _height = h; } + + inline unsigned short x() const { return _x; } + inline unsigned short y() const { return _y; } + + inline void setX(short x) { _x = x; } + inline void setY(short y) { _y = y; } + + inline EAHitBox* next() const { return _next; } + inline void setNext(EAHitBox* value) { _next = value; } + + bool checkContains(short x, short y); + + inline void setAction(EAHitBox::ActionFunction action) { _action = action; } + + inline EAWidget* widget() const { return _widget; } + inline void setWidget(EAWidget* value) { _widget = value; } + +private: + EAHitBox* _next; + + EAWidget* _widget; + + unsigned short _width; + unsigned short _height; + + short _x; + short _y; + + ActionFunction _action; + +}; + +#endif \ No newline at end of file