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

Unified Diff: sky/examples/raw/hello_world.dart

Issue 1218593002: Move sky/examples to sky/sdk/lib/example, and code changes to support that change. Fixes T277. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: sky/examples/raw/hello_world.dart
diff --git a/sky/examples/raw/hello_world.dart b/sky/examples/raw/hello_world.dart
deleted file mode 100644
index 116ab1015e91330379bcb49645674ebf452d02f5..0000000000000000000000000000000000000000
--- a/sky/examples/raw/hello_world.dart
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-import "dart:math";
-import 'dart:sky';
-
-Picture draw(int a, int r, int g, int b) {
- double width = view.width;
- double height = view.height;
-
- PictureRecorder recorder = new PictureRecorder();
- Canvas canvas = new Canvas(recorder, width, height);
- double radius = min(width, height) * 0.45;
-
- Paint paint = new Paint()..color = new Color.fromARGB(a, r, g, b);
- canvas.drawCircle(width / 2, height / 2, radius, paint);
- return recorder.endRecording();
-}
-
-bool handleEvent(Event event) {
- if (event.type == "pointerdown") {
- view.picture = draw(255, 0, 0, 255);
- view.scheduleFrame();
- return true;
- }
-
- if (event.type == "pointerup") {
- view.picture = draw(255, 0, 255, 0);
- view.scheduleFrame();
- return true;
- }
-
- if (event.type == "back") {
- print("Pressed back button.");
- return true;
- }
-
- return false;
-}
-
-void main() {
- print("Hello, world");
- view.picture = draw(255, 0, 255, 0);
- view.scheduleFrame();
-
- view.setEventCallback(handleEvent);
-}

Powered by Google App Engine
This is Rietveld 408576698