Lab4
Dependencies: SeeedStudioTFTv2 TFT_fonts mbed
Fork of Seeed_TFT_Touch_Shield by
Button.cpp@4:ebcf8d366b91, 2014-09-26 (annotated)
- Committer:
- uswickra
- Date:
- Fri Sep 26 12:40:19 2014 +0000
- Revision:
- 4:ebcf8d366b91
- Child:
- 6:ebffa73d4f95
Lab 4;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
uswickra | 4:ebcf8d366b91 | 1 | #include "Button.h" |
uswickra | 4:ebcf8d366b91 | 2 | #include "Arial24x23.h" |
uswickra | 4:ebcf8d366b91 | 3 | #include "Arial12x12.h" |
uswickra | 4:ebcf8d366b91 | 4 | |
uswickra | 4:ebcf8d366b91 | 5 | Button::Button(char* label, int p_color, int bd_color):Panel(p_color, bd_color, 1, 1, 1 , 1){ |
uswickra | 4:ebcf8d366b91 | 6 | lbl = label; |
uswickra | 4:ebcf8d366b91 | 7 | } |
uswickra | 4:ebcf8d366b91 | 8 | |
uswickra | 4:ebcf8d366b91 | 9 | Button::Button(char* label, int p_color, int bd_color, int w, int h):Panel(p_color, bd_color, w, h, 1 , 1){ |
uswickra | 4:ebcf8d366b91 | 10 | lbl = label; |
uswickra | 4:ebcf8d366b91 | 11 | } |
uswickra | 4:ebcf8d366b91 | 12 | |
uswickra | 4:ebcf8d366b91 | 13 | void Button::paint(){ |
uswickra | 4:ebcf8d366b91 | 14 | Panel::paint(); |
uswickra | 4:ebcf8d366b91 | 15 | TFT.background(DarkGrey); |
uswickra | 4:ebcf8d366b91 | 16 | TFT.foreground(Black); |
uswickra | 4:ebcf8d366b91 | 17 | TFT.set_font((unsigned char*) Arial12x12); |
uswickra | 4:ebcf8d366b91 | 18 | TFT.locate(x0+8,y0+12); |
uswickra | 4:ebcf8d366b91 | 19 | TFT.printf(lbl); |
uswickra | 4:ebcf8d366b91 | 20 | } |
uswickra | 4:ebcf8d366b91 | 21 | |
uswickra | 4:ebcf8d366b91 | 22 | void Button::trigger_action(ActionType type, ActionEvent evnt){ |
uswickra | 4:ebcf8d366b91 | 23 | //do something |
uswickra | 4:ebcf8d366b91 | 24 | |
uswickra | 4:ebcf8d366b91 | 25 | } |