v1.1.1
[hackover2013-badge-firmware.git] / drivers / displays / tft / controls / button.c
index a3de42c..db29382 100644 (file)
 /**************************************************************************/
 void buttonRender(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t fontColor, char *text, theme_t theme)
 {
 /**************************************************************************/
 void buttonRender(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t fontColor, char *text, theme_t theme)
 {
+  uint16_t brighter, darker;
+  uint16_t buttonEnd;
+
+  // Draw background gradient then outline
+  drawGradient(x+2, y+2, x+width-2, y+height-2, theme.colorFill, theme.colorBorder);
+  drawRoundedRectangle(x+1, y+1, x+width-1, y+height-1, theme.colorFill, 5, DRAW_CORNERS_ALL);
+  drawRoundedRectangle(x, y, x+width, y+height, theme.colorBorderDarker, 5, DRAW_CORNERS_ALL);
+
   #if CFG_TFTLCD_USEAAFONTS
     uint16_t ctable[4];
 
   #if CFG_TFTLCD_USEAAFONTS
     uint16_t ctable[4];
 
@@ -66,19 +74,11 @@ void buttonRender(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint1
     // This should really be optimized out into theme.h!
     aafontsCalculateColorTable(theme.colorFill, fontColor, &ctable[0], 4);
 
     // This should really be optimized out into theme.h!
     aafontsCalculateColorTable(theme.colorFill, fontColor, &ctable[0], 4);
 
-    // Draw the primitive shapes for the button
-    drawRoundedRectangleFilled(x, y, x+width, y+height, theme.colorBorder, 5, DRAW_CORNERS_ALL);
-    drawRoundedRectangleFilled(x+1, y+1, x+width-1, y+height-1, theme.colorFill, 5, DRAW_CORNERS_ALL);
-
     if (text != NULL)
     {
       aafontsCenterString(x + width / 2, y + 1 + (height / 2) - (THEME_FONT.fontHeight / 2), ctable, &THEME_FONT, text);
     }
   #else
     if (text != NULL)
     {
       aafontsCenterString(x + width / 2, y + 1 + (height / 2) - (THEME_FONT.fontHeight / 2), ctable, &THEME_FONT, text);
     }
   #else
-    // Draw the primitive shapes for the button
-    drawRoundedRectangleFilled(x, y, x+width, y+height, theme.colorBorder, 5, DRAW_CORNERS_ALL);
-    drawRoundedRectangleFilled(x+1, y+1, x+width-1, y+height-1, theme.colorFill, 5, DRAW_CORNERS_ALL);
-
     // Render text
     if (text != NULL)
     {
     // Render text
     if (text != NULL)
     {
This page took 0.025305 seconds and 4 git commands to generate.