fix various graphics and sound issues
Some checks failed
Build and Deploy / build-linux (push) Successful in 1m11s
Build and Deploy / build-windows (CLANG64) (push) Failing after 9m56s
Build and Deploy / package-dist (push) Has been skipped
Build and Deploy / deploy-itch (push) Has been skipped
Build and Deploy / deploy-gitea (push) Has been skipped
Some checks failed
Build and Deploy / build-linux (push) Successful in 1m11s
Build and Deploy / build-windows (CLANG64) (push) Failing after 9m56s
Build and Deploy / package-dist (push) Has been skipped
Build and Deploy / deploy-itch (push) Has been skipped
Build and Deploy / deploy-gitea (push) Has been skipped
This commit is contained in:
@@ -117,10 +117,7 @@ quickjs_opts += 'default_library=static'
|
|||||||
|
|
||||||
deps += dependency('quickjs', static:true, default_options:quickjs_opts)
|
deps += dependency('quickjs', static:true, default_options:quickjs_opts)
|
||||||
|
|
||||||
storefront = get_option('storefront')
|
#deps += dependency('qjs-steam', static:false)
|
||||||
if storefront == 'steam'
|
|
||||||
deps += dependency('qjs-steam',static:false)
|
|
||||||
endif
|
|
||||||
|
|
||||||
deps += dependency('qjs-layout',static:true)
|
deps += dependency('qjs-layout',static:true)
|
||||||
deps += dependency('qjs-miniz',static:true)
|
deps += dependency('qjs-miniz',static:true)
|
||||||
|
|||||||
1166
scripts/core/doc.js
Normal file
1166
scripts/core/doc.js
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -18,40 +18,60 @@ Internally loads image data from disk and prepares a GPU texture. Used by graphi
|
|||||||
Not intended for direct user calls.
|
Not intended for direct user calls.
|
||||||
*/
|
*/
|
||||||
function create_image(path) {
|
function create_image(path) {
|
||||||
var data = io.slurpbytes(path)
|
try {
|
||||||
var newimg
|
var data = io.slurpbytes(path);
|
||||||
switch (path.ext()) {
|
var newimg;
|
||||||
case 'gif':
|
|
||||||
newimg = graphics.make_gif(data)
|
switch (path.ext()) {
|
||||||
if (newimg.surface)
|
case 'gif':
|
||||||
newimg.texture = prosperon.gpu.load_texture(newimg.surface)
|
newimg = graphics.make_gif(data);
|
||||||
else
|
if (newimg.surface) {
|
||||||
for (var frame of newimg.frames)
|
newimg.texture = prosperon.gpu.load_texture(newimg.surface);
|
||||||
frame.texture = prosperon.gpu.load_texture(frame.surface)
|
} else {
|
||||||
break
|
for (var frame of newimg.frames) {
|
||||||
case 'ase':
|
frame.texture = prosperon.gpu.load_texture(frame.surface);
|
||||||
case 'aseprite':
|
}
|
||||||
newimg = graphics.make_aseprite(data)
|
|
||||||
if (newimg.surface)
|
|
||||||
newimg.texture = prosperon.gpu.load_texture(newimg.surface)
|
|
||||||
else {
|
|
||||||
for (var anim in newimg) {
|
|
||||||
var a = newimg[anim]
|
|
||||||
for (var frame of a.frames)
|
|
||||||
frame.texture = prosperon.gpu.load_texture(frame.surface)
|
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break
|
|
||||||
default:
|
case 'ase':
|
||||||
newimg = {
|
case 'aseprite':
|
||||||
surface: graphics.make_texture(data)
|
newimg = graphics.make_aseprite(data);
|
||||||
}
|
if (newimg.surface) {
|
||||||
newimg.texture = prosperon.gpu.load_texture(newimg.surface)
|
newimg.texture = prosperon.gpu.load_texture(newimg.surface);
|
||||||
break
|
} else {
|
||||||
|
for (var anim in newimg) {
|
||||||
|
var a = newimg[anim];
|
||||||
|
for (var frame of a.frames) {
|
||||||
|
frame.texture = prosperon.gpu.load_texture(frame.surface);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
newimg = {
|
||||||
|
surface: graphics.make_texture(data)
|
||||||
|
};
|
||||||
|
newimg.texture = prosperon.gpu.load_texture(newimg.surface);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return newimg;
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
// Add the path to the error message for better debugging
|
||||||
|
console.error(`Error loading image from path: ${path}`);
|
||||||
|
console.error(e.message);
|
||||||
|
if (e.stack) {
|
||||||
|
console.error(e.stack);
|
||||||
|
}
|
||||||
|
// Optionally, you can throw the error again to let it propagate
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
return newimg
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var image = {}
|
var image = {}
|
||||||
image.dimensions = function() {
|
image.dimensions = function() {
|
||||||
return [this.texture.width, this.texture.height].scale([this.rect[2], this.rect[3]])
|
return [this.texture.width, this.texture.height].scale([this.rect[2], this.rect[3]])
|
||||||
|
|||||||
@@ -41,8 +41,6 @@ function isRecognizedExtension(ext) {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempt to find file with or without extension from the current PATH
|
|
||||||
// (From the original resources.js, unchanged except for code style)
|
|
||||||
function find_in_path(filename, exts = []) {
|
function find_in_path(filename, exts = []) {
|
||||||
if (filename.includes('.')) {
|
if (filename.includes('.')) {
|
||||||
for (var dir of prosperon.PATH) {
|
for (var dir of prosperon.PATH) {
|
||||||
@@ -53,10 +51,15 @@ function find_in_path(filename, exts = []) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (var dir of prosperon.PATH) {
|
for (var dir of prosperon.PATH) {
|
||||||
var candidate = dir + filename
|
// Only check extensions if exts is provided and not empty
|
||||||
if (io.exists(candidate) && !io.is_directory(candidate)) return candidate
|
if (exts.length > 0) {
|
||||||
for (var ext of exts) {
|
for (var ext of exts) {
|
||||||
candidate = dir + filename + '.' + ext
|
var candidate = dir + filename + '.' + ext
|
||||||
|
if (io.exists(candidate) && !io.is_directory(candidate)) return candidate
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Fallback to extensionless file only if no extensions are specified
|
||||||
|
var candidate = dir + filename
|
||||||
if (io.exists(candidate) && !io.is_directory(candidate)) return candidate
|
if (io.exists(candidate) && !io.is_directory(candidate)) return candidate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,8 +62,14 @@ typedef unsigned int voice;
|
|||||||
|
|
||||||
static Soloud *soloud;
|
static Soloud *soloud;
|
||||||
|
|
||||||
|
void voice_free(unsigned int *voice)
|
||||||
|
{
|
||||||
|
Soloud_stop(soloud, *voice);
|
||||||
|
free(voice);
|
||||||
|
}
|
||||||
|
|
||||||
JSCLASS(Wav, Wav_destroy)
|
JSCLASS(Wav, Wav_destroy)
|
||||||
JSCLASS(voice, free)
|
JSCLASS(voice, voice_free)
|
||||||
JSCLASS(Bus, Bus_destroy)
|
JSCLASS(Bus, Bus_destroy)
|
||||||
|
|
||||||
static JSValue js_soloud_make(JSContext *js, JSValue self, int argc, JSValue *argv)
|
static JSValue js_soloud_make(JSContext *js, JSValue self, int argc, JSValue *argv)
|
||||||
|
|||||||
Reference in New Issue
Block a user