From 708a112449a89e7cb6697060dbebdcf714e1a44f Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Sat, 17 May 2025 23:06:27 -0500 Subject: [PATCH] add AGENTS.md and fix rect render --- AGENTS.md | 27 +++++++++++++++++++++++++++ scripts/modules/draw2d.js | 16 +--------------- source/jsffi.c | 2 +- 3 files changed, 29 insertions(+), 16 deletions(-) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000..031ee452 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,27 @@ +# AGENTS.md + +## Project Overview +This is a game engine developed using a QuickJS fork as its scripting language. It is an actor based system, based on Douglas Crockford's Misty. It is a Meson compiled project with a number of dependencies. + +## File Structure +- `source/`: Contains the C source code +- `scripts/`: Contains script code that is loaded on executable start, and modules +- `shaders/`: Contains shaders that ship with the engine (for shader based backends) +- `benchmarks/`: Benchmark programs for testing speed +- `tests/`: Unit tests +- `examples/`: Contains full game examples + +## Coding Practices +- Use K&R style C +- Use as little whitespace as possible +- Javascript style prefers objects and prototypical inheritence over ES6 classes, liberal use of closures, and var everywhere + +## Instructions +- When generating code, adhere to the coding practices outlined above. +- When adding new features, ensure they align with the project's goals. +- When fixing bugs, review the code carefully before making changes. +- When writing unit tests, cover all important scenarios. + +## Compiling, running, and testing +- To compile the code, run "make", which generates a prosperon executable in build_dbg/, and copy it into the root folder +- Run a test by giving it as its command: so ./prosperon tests/overling.js would run the test overling.js, ./prosperon tests/nota.js runs the nota benchmark diff --git a/scripts/modules/draw2d.js b/scripts/modules/draw2d.js index c432328e..5c22afd4 100644 --- a/scripts/modules/draw2d.js +++ b/scripts/modules/draw2d.js @@ -347,10 +347,8 @@ function software_fill_round_rect(rect, radius) var rect_def = { thickness:1, - mode: 'fill', color: Color.white, - radius: 0, - thickness:1 + radius: 0 } draw.rectangle = function render_rectangle(rect, def, pipeline) { var opt = def ? {...rect_def, ...def} : rect_def @@ -390,18 +388,6 @@ draw.slice9 = function slice9(image, rect = [0,0], slice = 0, info = slice9_info image = graphics.texture(image) render.slice9(image, rect, slice, slice9_info, pipeline); -// var mesh = geometry.slice9(image.texture, rect, util.normalizeSpacing(slice), info) -// console.log(json.encode(mesh)) -// render.geometry(image, mesh, pipeline) -/* render.queue({ - type: 'geometry', - mesh, - image, - pipeline, - first_index:0, - num_indices:mesh.num_indices - }) -*/ } draw.slice9[prosperon.DOC] = ` :param image: An image object or string path to a texture. diff --git a/source/jsffi.c b/source/jsffi.c index fa6cec7a..1d4bece0 100644 --- a/source/jsffi.c +++ b/source/jsffi.c @@ -2894,7 +2894,7 @@ JSC_CCALL(renderer_rects, /* single-rect path */ rect w = js2rect(js, argv[0]); - w = renderer_worldrect_to_screen(ctx, w); + w = renderer_worldrect_to_screen(ctx, w); if (!SDL_RenderFillRects(r, &w, 1)) return JS_ThrowReferenceError(js, "SDL_RenderFillRects: %s", SDL_GetError()); )