F746 GUI over lapping class.
Dependents: DISCO-F746NG_test001
NumericLabelOL.hpp@1:36e616bde4b8, 2016-06-24 (annotated)
- Committer:
- InoueTakashi
- Date:
- Fri Jun 24 01:19:30 2016 +0000
- Revision:
- 1:36e616bde4b8
- Child:
- 2:d7dc710446a8
Baloon touch game. version1.0 revision0.1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
InoueTakashi | 1:36e616bde4b8 | 1 | #ifndef F746_NUMERIC_LABEL_OL_HPP |
InoueTakashi | 1:36e616bde4b8 | 2 | #define F746_NUMERIC_LABEL_OL_HPP |
InoueTakashi | 1:36e616bde4b8 | 3 | |
InoueTakashi | 1:36e616bde4b8 | 4 | #include "NumericLabel.hpp" |
InoueTakashi | 1:36e616bde4b8 | 5 | |
InoueTakashi | 1:36e616bde4b8 | 6 | using namespace Mikami; |
InoueTakashi | 1:36e616bde4b8 | 7 | |
InoueTakashi | 1:36e616bde4b8 | 8 | namespace TakaIno |
InoueTakashi | 1:36e616bde4b8 | 9 | { |
InoueTakashi | 1:36e616bde4b8 | 10 | template <typename T> class NumericLabelOL : public Label |
InoueTakashi | 1:36e616bde4b8 | 11 | { |
InoueTakashi | 1:36e616bde4b8 | 12 | public: |
InoueTakashi | 1:36e616bde4b8 | 13 | // Constructor with drawing value |
InoueTakashi | 1:36e616bde4b8 | 14 | NumericLabelOL(uint16_t x, uint16_t y, |
InoueTakashi | 1:36e616bde4b8 | 15 | const char fmt[], T val, |
InoueTakashi | 1:36e616bde4b8 | 16 | Label::TextAlignMode mode, |
InoueTakashi | 1:36e616bde4b8 | 17 | sFONT &fonts, |
InoueTakashi | 1:36e616bde4b8 | 18 | uint32_t textColor, |
InoueTakashi | 1:36e616bde4b8 | 19 | uint32_t backColor) |
InoueTakashi | 1:36e616bde4b8 | 20 | : Label(x, y, "", mode, fonts, textColor, backColor) |
InoueTakashi | 1:36e616bde4b8 | 21 | |
InoueTakashi | 1:36e616bde4b8 | 22 | |
InoueTakashi | 1:36e616bde4b8 | 23 | { Draw(fmt, val, textColor, backColor); } |
InoueTakashi | 1:36e616bde4b8 | 24 | |
InoueTakashi | 1:36e616bde4b8 | 25 | // Draw value |
InoueTakashi | 1:36e616bde4b8 | 26 | void Draw(const char fmt[], T val, uint32_t txt_color, uint32_t bak_color) |
InoueTakashi | 1:36e616bde4b8 | 27 | { |
InoueTakashi | 1:36e616bde4b8 | 28 | sprintf(pri_str, fmt, val); |
InoueTakashi | 1:36e616bde4b8 | 29 | Label::GetLcdPtr()->SetBackColor(bak_color); |
InoueTakashi | 1:36e616bde4b8 | 30 | Label::Draw(pri_str, txt_color); |
InoueTakashi | 1:36e616bde4b8 | 31 | |
InoueTakashi | 1:36e616bde4b8 | 32 | } |
InoueTakashi | 1:36e616bde4b8 | 33 | |
InoueTakashi | 1:36e616bde4b8 | 34 | |
InoueTakashi | 1:36e616bde4b8 | 35 | |
InoueTakashi | 1:36e616bde4b8 | 36 | private: |
InoueTakashi | 1:36e616bde4b8 | 37 | char pri_str[81]; |
InoueTakashi | 1:36e616bde4b8 | 38 | |
InoueTakashi | 1:36e616bde4b8 | 39 | // disallow copy constructor and assignment operator |
InoueTakashi | 1:36e616bde4b8 | 40 | NumericLabelOL(const NumericLabelOL&); |
InoueTakashi | 1:36e616bde4b8 | 41 | NumericLabelOL& operator=(const NumericLabelOL&); |
InoueTakashi | 1:36e616bde4b8 | 42 | }; |
InoueTakashi | 1:36e616bde4b8 | 43 | } |
InoueTakashi | 1:36e616bde4b8 | 44 | #endif // F746_NUMERIC_LABEL_OL_HPP |