| Index: runtime/embedders/openglui/common/gl.dart
|
| ===================================================================
|
| --- runtime/embedders/openglui/common/gl.dart (revision 19664)
|
| +++ runtime/embedders/openglui/common/gl.dart (working copy)
|
| @@ -13,6 +13,43 @@
|
| BodyElement() : _nodes = new List();
|
| }
|
|
|
| +// The OpenGLUI "equivalent" of Window.
|
| +
|
| +typedef void RequestAnimationFrameCallback(num highResTime);
|
| +
|
| +class Window {
|
| + static int _nextId = 0;
|
| + Map<int, RequestAnimationFrameCallback> _callbacks;
|
| +
|
| + Window._internal() : _callbacks = new Map();
|
| +
|
| + int requestAnimationFrame(RequestAnimationFrameCallback callback) {
|
| + _callbacks[_nextId++] = callback;
|
| + }
|
| + void cancelAnimationFrame(id) {
|
| + if (_callbacks.containsKey(id)) {
|
| + _callbacks.remove(id);
|
| + }
|
| + }
|
| + get animationFrame {
|
| + // TODO(gram)
|
| + return null;
|
| + }
|
| +
|
| + void _dispatch() {
|
| + var when = (new DateTime.now()).millisecondsSinceEpoch;
|
| + // We clear out the callbacks map before calling any callbacks,
|
| + // as they may schedule new callbacks.
|
| + var oldcallbacks = _callbacks;
|
| + _callbacks = new Map();
|
| + for (var c in oldcallbacks.values) {
|
| + c(when);
|
| + }
|
| + }
|
| +}
|
| +
|
| +Window window = new Window._internal();
|
| +
|
| // The OpenGLUI "equivalent" of HtmlDocument.
|
| class Document {
|
| BodyElement _body;
|
| @@ -22,6 +59,11 @@
|
|
|
| Document document = new Document._internal();
|
|
|
| +// TODO(gram): make private and call from within library context.
|
| +update_() {
|
| + window._dispatch();
|
| +}
|
| +
|
| // Event handling. This is very kludgy for now, especially the
|
| // bare-bones Stream stuff!
|
|
|
|
|