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); |
-} |