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

Unified Diff: samples/openglui/src/gl.dart

Issue 13345002: Cleaned up OpenGLUI samples and added Blasteroids. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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
« no previous file with comments | « samples/openglui/src/flashingbox.dart ('k') | samples/openglui/src/openglui_canvas_tests.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/openglui/src/gl.dart
===================================================================
--- samples/openglui/src/gl.dart (revision 20700)
+++ samples/openglui/src/gl.dart (working copy)
@@ -9,32 +9,33 @@
// TODO(vsm): Move this out of the common directory.
library gl_html;
-import 'dart:html';
+import 'dart:html' as html;
export 'dart:html' show WebGLRenderingContext;
export 'dart:html' show Float32Array;
export 'dart:html' show ImageElement;
export 'dart:html' show CanvasElement;
+export 'dart:html' show AudioElement;
+export 'dart:html' show KeyboardEvent;
+export 'dart:html' show MouseEvent;
+export 'dart:html' show HtmlDocument;
+export 'dart:html' show CanvasRenderingContext2D;
+export 'dart:html' show Rect;
+get document => html.document;
+get window => html.window;
+get sfx_extension => 'mp3';
+
log(message) => window.console.log(message);
+glSwapBuffers() {}
getDisplayCanvas(resize) {
- final canvas = new CanvasElement(width: window.innerWidth, height: window.innerHeight);
- document.body.nodes.add(canvas);
-
- window.onResize.listen((e) {
- canvas.width = window.innerWidth;
- canvas.height = window.innerHeight;
- resize(canvas.width, canvas.height);
- });
+ var canvas = document.query('#canvas');
+ if (canvas == null) {
+ canvas = new html.CanvasElement(
+ width: window.innerWidth, height: window.innerHeight);
+ document.body.nodes.add(canvas);
+ }
return canvas;
}
-animate(draw) {
- var render;
- render = (n) {
- draw();
- window.requestAnimationFrame(render);
- };
- render(0);
-}
« no previous file with comments | « samples/openglui/src/flashingbox.dart ('k') | samples/openglui/src/openglui_canvas_tests.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698