Permalink
Browse files

Don't use waitEvent, it's buggy

  • Loading branch information...
1 parent 9fdb0bd commit 3266113d4d1eeb8915f8a42fb467fde52a0f004f @creationix committed Jul 25, 2011
Showing with 2 additions and 5 deletions.
  1. +2 −5 sdl.js
View
7 sdl.js
@@ -7,8 +7,7 @@ Object.defineProperty(SDL, 'events', {
get: function () {
if (events) return events;
events = new (require('events').EventEmitter);
- function getEvent(err) {
- if (err) events.emit('error', err);
+ setInterval(function () {
var data;
var mousemotion;
while (data = SDL.pollEvent()) {
@@ -25,9 +24,7 @@ Object.defineProperty(SDL, 'events', {
events.emit(mousemotion.type, mousemotion);
events.emit("event", mousemotion);
}
- SDL.waitEvent(getEvent);
- }
- SDL.waitEvent(getEvent);
+ }, 13);
return events;
}
});

0 comments on commit 3266113

Please sign in to comment.