fix prosperon layout
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[compilation]
|
||||
LDFLAGS = "-lSDL3 -lstdc++ -lm -lc++"
|
||||
CFLAGS = "-Iimgui"
|
||||
CFLAGS = "-Isrc/imgui"
|
||||
|
||||
[dependencies]
|
||||
rtree = "gitea.pockle.world/john/cell-rtree"
|
||||
|
||||
@@ -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:
|
||||
var mouse = input.mousestate()
|
||||
var i = 0;
|
||||
@@ -54,6 +54,6 @@ this.update = function(dt) {
|
||||
}
|
||||
}
|
||||
|
||||
this.hud = function() {
|
||||
var hud = function() {
|
||||
draw.images(bunnyTex, bunnies)
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ function resetBall() {
|
||||
|
||||
resetBall()
|
||||
|
||||
this.update = function(dt) {
|
||||
var update = function(dt) {
|
||||
// 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('s')) p1.y -= p1.speed*dt
|
||||
@@ -69,7 +69,7 @@ this.update = function(dt) {
|
||||
if (l>config.width) { score1++; resetBall() }
|
||||
}
|
||||
|
||||
this.hud = function() {
|
||||
var hud = function() {
|
||||
// Clear screen black
|
||||
draw.rectangle({x:0, y:0, width:config.width, height:config.height}, [0,0,0,1])
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ function wrap(pos) {
|
||||
|
||||
resetGame()
|
||||
|
||||
this.update = function(dt) {
|
||||
var update = function(dt) {
|
||||
if (gameState != "playing") return
|
||||
moveTimer += dt
|
||||
if (moveTimer < moveInterval) return
|
||||
@@ -80,7 +80,7 @@ this.update = function(dt) {
|
||||
else pop(snake)
|
||||
}
|
||||
|
||||
this.hud = function() {
|
||||
var hud = function() {
|
||||
// Optional clear screen
|
||||
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
|
||||
// "Up" means y=1, so going physically up on screen
|
||||
this.inputs = {
|
||||
var inputs = {
|
||||
up: function() {
|
||||
if (direction.y != -1) nextDirection = {x:0,y:1}
|
||||
},
|
||||
@@ -122,4 +122,4 @@ this.inputs = {
|
||||
}
|
||||
}
|
||||
|
||||
input.player[0].control(this)
|
||||
//input.player[0].control()
|
||||
|
||||
@@ -166,7 +166,7 @@ function hardDrop() {
|
||||
|
||||
spawnPiece()
|
||||
|
||||
this.update = function(dt) {
|
||||
var update = function(dt) {
|
||||
if (gameOver) return
|
||||
|
||||
// ======= Horizontal Movement Gate =======
|
||||
@@ -243,7 +243,7 @@ this.update = function(dt) {
|
||||
}
|
||||
}
|
||||
|
||||
this.hud = function() {
|
||||
var hud = function() {
|
||||
// Clear screen
|
||||
draw.rectangle({x:0, y:0, width:config.width, height:config.height}, [0,0,0,1])
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ var io = use('cellfs')
|
||||
var time = use('time')
|
||||
var res = use('resources')
|
||||
var json = use('json')
|
||||
var os = use('os')
|
||||
var staef = use('staef')
|
||||
var qoi = use('image/qoi')
|
||||
var png = use('image/png')
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_render.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/backends/imgui_impl_sdlgpu3.h"
|
||||
#include "src/imgui/backends/imgui_impl_sdlgpu3.h"
|
||||
|
||||
// Forward declarations for the functions we need
|
||||
extern "C" {
|
||||
|
||||
2
layout.c
2
layout.c
@@ -17,7 +17,7 @@ lay_id VAR; \
|
||||
if (JS_ToUint32(js, &VAR, ARG)) return JS_EXCEPTION; \
|
||||
|
||||
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);
|
||||
JSValue obj = JS_NewObjectClass(js, js_layout_class_id);
|
||||
JS_SetOpaque(obj, lay);
|
||||
|
||||
@@ -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);
|
||||
|
||||
m_seedRand(mrand, seed);
|
||||
@@ -118,7 +118,7 @@ static JSValue js_mersenne_use_call(JSContext *js, JSValueConst new_target, int
|
||||
JS_FRAME(js);
|
||||
JS_ROOT(obj, JS_NewObjectClass(js, js_mersenne_class_id));
|
||||
if (JS_IsException(obj.val)) {
|
||||
js_free(js, mrand);
|
||||
js_free_rt(mrand);
|
||||
JS_RETURN_EX();
|
||||
}
|
||||
|
||||
|
||||
2
staef.c
2
staef.c
@@ -847,7 +847,7 @@ static JSValue js_msdf_font_constructor(JSContext *ctx, JSValueConst new_target,
|
||||
CELL_USE_INIT(
|
||||
// Initialize font class
|
||||
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_ROOT(proto, JS_NewObject(js));
|
||||
JS_SetPropertyFunctionList(js, proto.val, js_font_funcs, countof(js_font_funcs));
|
||||
|
||||
Reference in New Issue
Block a user