Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: samples/stm32f746g-discovery/touch.dart

Issue 1996533003: Change framebuffer.clear to use background color (Closed) Base URL: git@github.com:dartino/sdk.git@master
Patch Set: Review feedback Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dartino project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dartino project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 import 'dart:dartino'; 5 import 'dart:dartino';
6 6
7 import 'package:stm32/lcd.dart'; 7 import 'package:stm32/lcd.dart';
8 import 'package:stm32/stm32f746g_disco.dart'; 8 import 'package:stm32/stm32f746g_disco.dart';
9 import 'package:stm32/ts.dart'; 9 import 'package:stm32/ts.dart';
10 10
11 main() { 11 main() {
12 var disco = new STM32F746GDiscovery(); 12 var disco = new STM32F746GDiscovery();
13 var frameBuffer = disco.frameBuffer; 13 var frameBuffer = disco.frameBuffer;
14 var touchScreen = disco.touchScreen; 14 var touchScreen = disco.touchScreen;
15 15
16 frameBuffer.backgroundColor = Color.white; 16 frameBuffer.backgroundColor = Color.white;
17 frameBuffer.clear(Color.white); 17 frameBuffer.clear();
18 int x = 25; 18 int x = 25;
19 int y = 25; 19 int y = 25;
20 frameBuffer.drawLine(x, y - 5, x, y + 5, Color.blue); 20 frameBuffer.drawLine(x, y - 5, x, y + 5, Color.blue);
21 frameBuffer.drawLine(x - 5, y, x + 5, y, Color.blue); 21 frameBuffer.drawLine(x - 5, y, x + 5, y, Color.blue);
22 frameBuffer.writeText(x + 3, y + 3, "$x, $y"); 22 frameBuffer.writeText(x + 3, y + 3, "$x, $y");
23 x = frameBuffer.width - 25; 23 x = frameBuffer.width - 25;
24 frameBuffer.drawLine(x, y - 5, x, y + 5, Color.blue); 24 frameBuffer.drawLine(x, y - 5, x, y + 5, Color.blue);
25 frameBuffer.drawLine(x - 5, y, x + 5, y, Color.blue); 25 frameBuffer.drawLine(x - 5, y, x + 5, y, Color.blue);
26 frameBuffer.writeText(x - 50, y + 3, "$x, $y"); 26 frameBuffer.writeText(x - 50, y + 3, "$x, $y");
27 27
28 while (true) { 28 while (true) {
29 TouchState t = touchScreen.state; 29 TouchState t = touchScreen.state;
30 var msg = new StringBuffer('touch: ${t.count}'); 30 var msg = new StringBuffer('touch: ${t.count}');
31 for (int index = 0; index < t.count; ++index) { 31 for (int index = 0; index < t.count; ++index) {
32 msg.write(' - ${t.x[index]}, ${t.y[index]}'); 32 msg.write(' - ${t.x[index]}, ${t.y[index]}');
33 } 33 }
34 print(msg); 34 print(msg);
35 sleep(500); 35 sleep(500);
36 } 36 }
37 } 37 }
OLDNEW
« no previous file with comments | « samples/stm32f746g-discovery/disco-light.dart ('k') | samples/stm32f746g-discovery/turtle-graphics/turtle.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698