This commit is contained in:
Dante
2026-05-21 23:40:20 -07:00
parent 3e2915dff7
commit 877a69d844
5737 changed files with 29796 additions and 1589684 deletions

View File

@ -105,18 +105,7 @@ class CanvasGraphics extends Graphics {
}
override function set_imageScaleQuality(value: ImageScaleQuality): ImageScaleQuality {
if (value == ImageScaleQuality.Low) {
untyped canvas.mozImageSmoothingEnabled = false;
untyped canvas.webkitImageSmoothingEnabled = false;
untyped canvas.msImageSmoothingEnabled = false;
canvas.imageSmoothingEnabled = false;
}
else {
untyped canvas.mozImageSmoothingEnabled = true;
untyped canvas.webkitImageSmoothingEnabled = true;
untyped canvas.msImageSmoothingEnabled = true;
canvas.imageSmoothingEnabled = true;
}
canvas.imageSmoothingEnabled = value == ImageScaleQuality.High;
return scaleQuality = value;
}

View File

@ -0,0 +1,28 @@
package kha.js;
import js.html.MessageChannel;
class Microtask {
static var messageChannel: MessageChannel;
static final callbacks: Array<() -> Void> = [];
static function init(): Void {
if (messageChannel != null) {
return;
}
messageChannel = new MessageChannel();
messageChannel.port1.onmessage = _ -> {
final copy = callbacks.copy();
callbacks.resize(0);
for (callback in copy) {
callback();
}
};
}
public static function queueMicrotask(callback: () -> Void): Void {
init();
callbacks.push(callback);
messageChannel.port2.postMessage(js.Lib.undefined);
}
}

View File

@ -32,7 +32,7 @@ class Video extends kha.Video {
video.done = done;
video.element = cast Browser.document.createElement("video");
video.element = Browser.document.createVideoElement();
video.filenames = [];
for (filename in filenames) {

View File

@ -16,7 +16,7 @@ import kha.audio2.Audio;
super();
this.offset = 0;
this.buffer = buffer;
this.startTime = Audio._context.currentTime;
this.startTime = Audio._context.currentTime;
this.source = Audio._context.createBufferSource();
this.source.buffer = this.buffer;
this.source.connect(Audio._context.destination);
@ -91,7 +91,7 @@ class WebAudioSound extends kha.Sound {
var i = 0;
final lidx = len * 2;
function uncompressInner() {
var chk_len = idx + 11025;
var chk_len = idx + 44100;
var next_chk = chk_len > lidx ? lidx : chk_len;
while (idx < next_chk) {
uncompressedData[idx] = ch0[i];
@ -100,7 +100,7 @@ class WebAudioSound extends kha.Sound {
++i;
}
if (idx < lidx)
js.Browser.window.setTimeout(uncompressInner, 0);
Microtask.queueMicrotask(uncompressInner);
else {
compressedData = null;
done();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff