fixes
This commit is contained in:
2
input.cm
2
input.cm
@@ -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 })
|
||||
|
||||
25
resources.cm
25
resources.cm
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
7
sound.cm
7
sound.cm
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user