Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- emscripten-stable/src/library_sdl.js 2011-12-29 15:18:57.000000000 -0500
- +++ emscripten/src/library_sdl.js 2012-01-28 20:57:30.000000000 -0500
- @@ -427,7 +431,20 @@
- SDL_GetTicks: function() {
- return Math.floor(Date.now() - SDL.startTime);
- },
- -
- + // Start alberthrocks' code!
- + SDL_AddTimer: function(interval, callback, param) {
- + return setInterval(callback, interval, param); // Not sure if I did this right...
- + },
- + SDL_RemoveTimer: function(id) {
- + return clearInterval(id);
- + },
- + // DIRTY HACK - SHOULD FIX WHEN SurfaceFormat AND THE LIKES ARE DONE!
- + SDL_DisplayFormat: function(surf) {
- + var flags;
- + flags |= 1; // SDL_HWSURFACE - this tells SDL_MUSTLOCK that this needs to be locked
- + return SDL.makeSurface(SDL.surfaces[surf].width, SDL.surfaces[surf].height, flags);
- + },
- + // End alberthrocks' code!
- SDL_PollEvent: function(ptr) {
- if (SDL.events.length === 0) return 0;
- if (ptr) {
- @@ -506,7 +523,7 @@
- SDL.audio.pushAudio = function(ptr, size) {
- var mozBuffer = SDL.audio.mozBuffer;
- for (var i = 0; i < totalSamples; i++) {
- - mozBuffer[i] = ({{{ makeGetValue('ptr', 'i*2', 'i16', 0, 1) }}} / 65536)-1; // hardcoded 16-bit audio
- + mozBuffer[i] = ({{{ makeGetValue('ptr', 'i*2', 'i16', 0, 0) }}}) / 0x8000; // hardcoded 16-bit audio, signed (TODO: reSign if not ta2?)
- }
- SDL.audio.mozOutput['mozWriteAudio'](mozBuffer);
- }
Advertisement
Add Comment
Please, Sign In to add comment