This commit is contained in:
2026-02-23 11:32:45 -06:00
parent ff2e4bd578
commit 1619122a58
4 changed files with 19 additions and 23 deletions

View File

@@ -160,7 +160,7 @@ function pick_user(canon) {
if (canon.kind == 'button' && canon.pressed) {
if (picked.active_device != canon.device_id) {
// Release all held actions when switching device
old_down = picked.router.down
old_down = picked.router.down()
arrfor(array(old_down), action => {
if (old_down[action]) {
picked.dispatch(action, { pressed: false, released: true, time: canon.time })

View File

@@ -1,14 +1,5 @@
var io = use('cellfs')
function hashify(fn) {
var hash = {}
return function(arg) {
var key = arg
if (hash[key] == null) hash[key] = fn(arg)
return hash[key]
}
}
// Merge of the old resources.js and packer.js functionalities
var Resources = {}
@@ -77,21 +68,21 @@ Resources.canonical = function(file) {
}
// The resource finders
Resources.find_image = hashify(function(file) {
Resources.find_image = function(file) {
return find_in_path(file, Resources.images)
})
}
Resources.find_sound = hashify(function(file) {
Resources.find_sound = function(file) {
return find_in_path(file, Resources.sounds)
})
}
Resources.find_script = hashify(function(file) {
Resources.find_script = function(file) {
return find_in_path(file, Resources.scripts)
})
}
Resources.find_font = hashify(function(file) {
Resources.find_font = function(file) {
return find_in_path(file, Resources.fonts)
})
}
// .prosperonignore reading helper
function read_ignore(dir) {

View File

@@ -762,8 +762,8 @@ sdl_gpu.get_texture_info = function(path) {
sdl_gpu.get_or_create_target = function(width, height, key) {
// Clamp dimensions to minimum 1x1 to prevent GPU errors
var w = (!width || width < 1) ? 1 : width
var h = (!height || height < 1) ? 1 : height
var w = (is_number(width) && width > 0) ? width : 1
var h = (is_number(height) && height > 0) ? height : 1
var pool_key = `${w}x${h}`
@@ -1149,9 +1149,9 @@ function _preload_textures(commands) {
})
// Load all textures
arrfor(array(paths, function(path) {
arrfor(array(paths), function(path) {
sdl_gpu.get_texture(path)
}))
})
}
function _execute_commands(commands, window_size) {

View File

@@ -74,9 +74,14 @@ feeder.resume_device()
// Audio pump - called periodically to fill the audio buffer
function pump() {
var mixed = null
while (feeder.queued() < CHUNK_BYTES * 3) {
var iters = 0
var q = feeder.queued()
while (q < CHUNK_BYTES * 3) {
mixed = player.pull(FRAMES_PER_CHUNK)
feeder.put(mixed)
iters = iters + 1
if (iters > 100) break
q = feeder.queued()
}
$delay(pump, 1/240)