aboutsummaryrefslogtreecommitdiff
path: root/src/library_sdl.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/library_sdl.js')
-rw-r--r--src/library_sdl.js20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js
index 1cd99534..b2ca338b 100644
--- a/src/library_sdl.js
+++ b/src/library_sdl.js
@@ -707,7 +707,9 @@ var LibrarySDL = {
SDL_Quit: function() {
for (var i = 0; i < SDL.numChannels; ++i) {
- SDL.channels[i].audio.pause();
+ if (SDL.channels[i].audio) {
+ SDL.channels[i].audio.pause();
+ }
}
if (SDL.music.audio) {
SDL.music.audio.pause();
@@ -1116,7 +1118,7 @@ var LibrarySDL = {
SDL.audio.bufferSize = totalSamples*2; // hardcoded 16-bit audio
SDL.audio.buffer = _malloc(SDL.audio.bufferSize);
SDL.audio.caller = function() {
- FUNCTION_TABLE[SDL.audio.callback](SDL.audio.userdata, SDL.audio.buffer, SDL.audio.bufferSize);
+ Runtime.dynCall('viii', SDL.audio.callback, [SDL.audio.userdata, SDL.audio.buffer, SDL.audio.bufferSize]);
SDL.audio.pushAudio(SDL.audio.buffer, SDL.audio.bufferSize);
};
// Mozilla Audio API. TODO: Other audio APIs
@@ -1160,6 +1162,8 @@ var LibrarySDL = {
SDL_CreateMutex: function() { return 0 },
SDL_LockMutex: function() {},
SDL_UnlockMutex: function() {},
+ SDL_mutexP: function() { return 0 },
+ SDL_mutexV: function() { return 0 },
SDL_DestroyMutex: function() {},
SDL_CreateCond: function() { return 0 },
@@ -1278,7 +1282,7 @@ var LibrarySDL = {
channelInfo.audio = audio = audio.cloneNode(true);
if (SDL.channelFinished) {
audio['onended'] = function() { // TODO: cache these
- Runtime.getFuncWrapper(SDL.channelFinished)(channel);
+ Runtime.getFuncWrapper(SDL.channelFinished, 'vi')(channel);
}
}
// Either play the element, or load the dynamic data into it
@@ -1349,7 +1353,7 @@ var LibrarySDL = {
info.audio = null;
}
if (SDL.channelFinished) {
- Runtime.getFuncWrapper(SDL.channelFinished)(channel);
+ Runtime.getFuncWrapper(SDL.channelFinished, 'vi')(channel);
}
return 0;
},
@@ -1408,7 +1412,7 @@ var LibrarySDL = {
audio.pause();
SDL.music.audio = null;
if (SDL.hookMusicFinished) {
- FUNCTION_TABLE[SDL.hookMusicFinished]();
+ Runtime.dynCall('v', SDL.hookMusicFinished);
}
return 0;
},
@@ -1439,6 +1443,10 @@ var LibrarySDL = {
return id;
},
+ TTF_CloseFont: function(font) {
+ SDL.fonts[font] = null;
+ },
+
TTF_RenderText_Solid: function(font, text, color) {
// XXX the font and color are ignored
text = Pointer_stringify(text) || ' '; // if given an empty string, still return a valid surface
@@ -1557,7 +1565,7 @@ var LibrarySDL = {
SDL_AddTimer: function(interval, callback, param) {
return window.setTimeout(function() {
- FUNCTION_TABLE[callback](interval, param);
+ Runtime.dynCall('ii', callback, [interval, param]);
}, interval);
},
SDL_RemoveTimer: function(id) {