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.
Dependencies: BSP_DISCO_F746NG LCD_DISCO_F746NG TS_DISCO_F746NG mbed BUTTON_GROUP
Revision 1:27bfb11afcff, committed 2015-11-05
- Comitter:
- MikamiUitOpen
- Date:
- Thu Nov 05 04:38:28 2015 +0000
- Parent:
- 0:9a78f27b84a4
- Child:
- 2:6c1471e4a4b1
- Commit message:
- 2
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| my_classes/button.hpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Nov 03 05:44:41 2015 +0000
+++ b/main.cpp Thu Nov 05 04:38:28 2015 +0000
@@ -5,7 +5,7 @@
// Tap the Mandelbrot set on the screen, expanded figure by a
// factor of two around the tapped position is displayed.
//
-// 2015/11/03, Copyright (c) 2015 MIKAMI, Naoki
+// 2015/11/05, Copyright (c) 2015 MIKAMI, Naoki
//---------------------------------------------------------------
#include "button.hpp"
@@ -79,7 +79,7 @@
buttons[n] = new Button(lcd_, ts_, 340, Y0_+45*n, 60, 40,
LCD_COLOR_BLUE, strButton[n], Font12);
Button back(lcd_, ts_, 410, Y0_, 60, 40, LCD_COLOR_BLUE, "Back", Font12);
- back.Draw(0xFFE0E0FF);
+ back.Erase(backColor); //back.Draw(0xFFE0E0FF);
// area of Mandelbrot set
Button area(lcd_, ts_, X0_, Y0_, NX_, NY_, backColor);
@@ -96,8 +96,9 @@
for (int k=0; k<3; k++)
{
buttons[k]->ReDraw();
- if (buttons[k]->Touched(LCD_COLOR_DARKBLUE))
+ if (buttons[k]->Touched() && (pattern != k))
{
+ buttons[k]->Draw(LCD_COLOR_DARKBLUE);
mandel[k]->Display(x1, x2, y1, y2);
pattern = k;
@@ -150,9 +151,10 @@
ReDraw(mandel[pattern], wH, hH, xy[level], level, x1, x2, y1, y2);
if (level > 0) back.ReDraw();
- else back.Draw(0xFFE0E0FF);
+ else back.Erase(backColor); //back.Draw(0xFFE0E0FF);
}
}
wait(0.1f);
}
}
+
--- a/my_classes/button.hpp Tue Nov 03 05:44:41 2015 +0000
+++ b/my_classes/button.hpp Thu Nov 05 04:38:28 2015 +0000
@@ -1,7 +1,7 @@
//-----------------------------------------------------------
// Button class -- Header
//
-// 2015/11/03, Copyright (c) 2015 MIKAMI, Naoki
+// 2015/11/05, Copyright (c) 2015 MIKAMI, Naoki
//-----------------------------------------------------------
#ifndef F746_BUTTON_HPP
@@ -29,6 +29,10 @@
void ReDraw(uint32_t textColor = LCD_COLOR_WHITE)
{ Draw(COLOR_, textColor); }
+ // Erase button with selected color
+ void Erase(uint32_t color)
+ { Draw(color, color); }
+
// Check touch detected
bool Touched();