fix prosperon layout

This commit is contained in:
2026-02-20 21:23:21 -06:00
parent e78faccab8
commit ff2e4bd578
44 changed files with 17 additions and 18 deletions

View File

@@ -1,6 +1,6 @@
[compilation] [compilation]
LDFLAGS = "-lSDL3 -lstdc++ -lm -lc++" LDFLAGS = "-lSDL3 -lstdc++ -lm -lc++"
CFLAGS = "-Iimgui" CFLAGS = "-Isrc/imgui"
[dependencies] [dependencies]
rtree = "gitea.pockle.world/john/cell-rtree" rtree = "gitea.pockle.world/john/cell-rtree"

View File

@@ -23,7 +23,7 @@ for (i = 0; i < 100; i++) {
}) })
} }
this.update = function(dt) { var update = function(dt) {
// If left mouse is down, spawn some more bunnies: // If left mouse is down, spawn some more bunnies:
var mouse = input.mousestate() var mouse = input.mousestate()
var i = 0; var i = 0;
@@ -54,6 +54,6 @@ this.update = function(dt) {
} }
} }
this.hud = function() { var hud = function() {
draw.images(bunnyTex, bunnies) draw.images(bunnyTex, bunnies)
} }

View File

@@ -23,7 +23,7 @@ function resetBall() {
resetBall() resetBall()
this.update = function(dt) { var update = function(dt) {
// Move paddles: positive Y is up, so W/↑ means p.y += speed // Move paddles: positive Y is up, so W/↑ means p.y += speed
if (input.keyboard.down('w')) p1.y += p1.speed*dt if (input.keyboard.down('w')) p1.y += p1.speed*dt
if (input.keyboard.down('s')) p1.y -= p1.speed*dt if (input.keyboard.down('s')) p1.y -= p1.speed*dt
@@ -69,7 +69,7 @@ this.update = function(dt) {
if (l>config.width) { score1++; resetBall() } if (l>config.width) { score1++; resetBall() }
} }
this.hud = function() { var hud = function() {
// Clear screen black // Clear screen black
draw.rectangle({x:0, y:0, width:config.width, height:config.height}, [0,0,0,1]) draw.rectangle({x:0, y:0, width:config.width, height:config.height}, [0,0,0,1])

View File

@@ -50,7 +50,7 @@ function wrap(pos) {
resetGame() resetGame()
this.update = function(dt) { var update = function(dt) {
if (gameState != "playing") return if (gameState != "playing") return
moveTimer += dt moveTimer += dt
if (moveTimer < moveInterval) return if (moveTimer < moveInterval) return
@@ -80,7 +80,7 @@ this.update = function(dt) {
else pop(snake) else pop(snake)
} }
this.hud = function() { var hud = function() {
// Optional clear screen // Optional clear screen
draw.rectangle({x:0, y:0, width:config.width, height:config.height}, [0,0,0,1]) draw.rectangle({x:0, y:0, width:config.width, height:config.height}, [0,0,0,1])
@@ -104,7 +104,7 @@ this.hud = function() {
// No immediate reversal // No immediate reversal
// "Up" means y=1, so going physically up on screen // "Up" means y=1, so going physically up on screen
this.inputs = { var inputs = {
up: function() { up: function() {
if (direction.y != -1) nextDirection = {x:0,y:1} if (direction.y != -1) nextDirection = {x:0,y:1}
}, },
@@ -122,4 +122,4 @@ this.inputs = {
} }
} }
input.player[0].control(this) //input.player[0].control()

View File

@@ -166,7 +166,7 @@ function hardDrop() {
spawnPiece() spawnPiece()
this.update = function(dt) { var update = function(dt) {
if (gameOver) return if (gameOver) return
// ======= Horizontal Movement Gate ======= // ======= Horizontal Movement Gate =======
@@ -243,7 +243,7 @@ this.update = function(dt) {
} }
} }
this.hud = function() { var hud = function() {
// Clear screen // Clear screen
draw.rectangle({x:0, y:0, width:config.width, height:config.height}, [0,0,0,1]) draw.rectangle({x:0, y:0, width:config.width, height:config.height}, [0,0,0,1])

View File

@@ -4,7 +4,6 @@ var io = use('cellfs')
var time = use('time') var time = use('time')
var res = use('resources') var res = use('resources')
var json = use('json') var json = use('json')
var os = use('os')
var staef = use('staef') var staef = use('staef')
var qoi = use('image/qoi') var qoi = use('image/qoi')
var png = use('image/png') var png = use('image/png')

View File

@@ -19,9 +19,9 @@
#include <SDL3/SDL.h> #include <SDL3/SDL.h>
#include <SDL3/SDL_render.h> #include <SDL3/SDL_render.h>
#include <SDL3/SDL_gpu.h> #include <SDL3/SDL_gpu.h>
#include "imgui/backends/imgui_impl_sdl3.h" #include "src/imgui/backends/imgui_impl_sdl3.h"
//#include "imgui_impl_sdlrenderer3.h" //#include "imgui_impl_sdlrenderer3.h"
#include "imgui/backends/imgui_impl_sdlgpu3.h" #include "src/imgui/backends/imgui_impl_sdlgpu3.h"
// Forward declarations for the functions we need // Forward declarations for the functions we need
extern "C" { extern "C" {

View File

@@ -17,7 +17,7 @@ lay_id VAR; \
if (JS_ToUint32(js, &VAR, ARG)) return JS_EXCEPTION; \ if (JS_ToUint32(js, &VAR, ARG)) return JS_EXCEPTION; \
static JSValue js_layout_context_new(JSContext *js, JSValueConst self, int argc, JSValueConst *argv) { static JSValue js_layout_context_new(JSContext *js, JSValueConst self, int argc, JSValueConst *argv) {
lay_context *lay = js_malloc(js, sizeof(*lay)); lay_context *lay = js_malloc_rt(sizeof(*lay));
lay_init_context(lay); lay_init_context(lay);
JSValue obj = JS_NewObjectClass(js, js_layout_class_id); JSValue obj = JS_NewObjectClass(js, js_layout_class_id);
JS_SetOpaque(obj, lay); JS_SetOpaque(obj, lay);

View File

@@ -110,7 +110,7 @@ static JSValue js_mersenne_use_call(JSContext *js, JSValueConst new_target, int
} }
} }
MTRand *mrand = js_malloc(js, sizeof(MTRand)); MTRand *mrand = js_malloc_rt(sizeof(MTRand));
if (!mrand) return JS_ThrowOutOfMemory(js); if (!mrand) return JS_ThrowOutOfMemory(js);
m_seedRand(mrand, seed); m_seedRand(mrand, seed);
@@ -118,7 +118,7 @@ static JSValue js_mersenne_use_call(JSContext *js, JSValueConst new_target, int
JS_FRAME(js); JS_FRAME(js);
JS_ROOT(obj, JS_NewObjectClass(js, js_mersenne_class_id)); JS_ROOT(obj, JS_NewObjectClass(js, js_mersenne_class_id));
if (JS_IsException(obj.val)) { if (JS_IsException(obj.val)) {
js_free(js, mrand); js_free_rt(mrand);
JS_RETURN_EX(); JS_RETURN_EX();
} }

View File

@@ -847,7 +847,7 @@ static JSValue js_msdf_font_constructor(JSContext *ctx, JSValueConst new_target,
CELL_USE_INIT( CELL_USE_INIT(
// Initialize font class // Initialize font class
JS_NewClassID(&js_font_id); JS_NewClassID(&js_font_id);
JS_NewClass(JS_GetRuntime(js), js_font_id, &js_font_class); JS_NewClass(js, js_font_id, &js_font_class);
JS_FRAME(js); JS_FRAME(js);
JS_ROOT(proto, JS_NewObject(js)); JS_ROOT(proto, JS_NewObject(js));
JS_SetPropertyFunctionList(js, proto.val, js_font_funcs, countof(js_font_funcs)); JS_SetPropertyFunctionList(js, proto.val, js_font_funcs, countof(js_font_funcs));