S7 header config & prototyping support

This commit is contained in:
John Alanbrook 2023-01-05 00:09:42 +00:00
parent 740077fae3
commit 1521593269
9 changed files with 36 additions and 10 deletions

View file

@ -13,7 +13,14 @@
#define MSAA_SAMPLES 2
/* S7 Scheme defines */
#define INITIAL_HEAP_SIZE 4096
#define INITIAL_STACK_SIZE 4096
#define DEFAULT_BIGNUM_PRECISION 128
#define WITH_PURE_S7 1
#define WITH_SYSTEM_EXTRAS 0
#define WITH_C_LOADER 0
#define WITH_NUMBER_SEPARATOR 1
#endif

View file

@ -10,9 +10,13 @@
#define STBI_FAILURE_USERMSG
#include "stb_image.h"
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"
#define PL_MPEG_IMPLEMENTATION
#include <pl_mpeg.h>
#ifdef EDITOR
#include "editor.h"
#endif

View file

@ -14,7 +14,6 @@
#include "stb_truetype.h"
#include "stb_rect_pack.h"
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"
static uint32_t VBO = 0;

View file

@ -33,6 +33,14 @@ int id_from_gameobject(struct gameobject *go) {
return -1;
}
void gameobject_apply(struct gameobject *go)
{
cpBodySetType(go->body, go->bodytype);
if (go->bodytype == CP_BODY_TYPE_DYNAMIC)
cpBodySetMass(go->body, go->mass);
}
static void gameobject_setpickcolor(struct gameobject *go)
{
float r = ((go->editor.id & 0x000000FF) >> 0) / 255.f;
@ -144,6 +152,8 @@ void gameobject_init(struct gameobject *go, FILE * fprefab)
cpBodySetType(go->body, go->bodytype);
cpBodySetUserData(go->body, go);
int comp_n;
fread(&comp_n, sizeof(int), 1, fprefab);
arrfree(go->components);

View file

@ -43,6 +43,7 @@ struct gameobject {
extern struct gameobject *gameobjects;
int MakeGameobject();
void gameobject_apply(struct gameobject *go);
void init_gameobjects();
void gameobject_delete(int id);
void clear_gameobjects();

View file

@ -251,6 +251,10 @@ s7_pointer s7_sys_cmd(s7_scheme *sc, s7_pointer args) {
case 8:
return s7_make_integer(sc, frame_fps());
case 9: /* Clear the level out */
new_level();
break;
}
return args;
@ -496,6 +500,10 @@ s7_pointer s7_make_gameobject(s7_scheme *sc, s7_pointer args) {
go->f = s7_real(s7_cadddr(args));
go->e = s7_real(s7_list_ref(sc, args, 4));
YughInfo("static %d, dynamic %d, kinematic %d", CP_BODY_TYPE_STATIC, CP_BODY_TYPE_DYNAMIC, CP_BODY_TYPE_KINEMATIC);
gameobject_apply(go);
return s7_make_integer(sc, g);
}

View file

@ -62,13 +62,7 @@
* ---------------- compile time switches ----------------
*/
#if defined __has_include
# if __has_include ("mus-config.h")
# include "mus-config.h"
# endif
#else
#include "mus-config.h"
#endif
#include "config.h"
/*
* Your config file goes here, or just replace that #include line with the defines you need.

View file

@ -1,3 +1,5 @@
#include "yugine.h"
#include "render.h"
#include "camera.h"
#include "window.h"
@ -11,7 +13,7 @@
#include <stdlib.h>
#include "yugine.h"
#include "2dphysics.h"
#if ED

View file

@ -49,6 +49,7 @@
(define (load_level s) (gen_cmd 0 s))
(define (load_prefab s) (gen_cmd 1 s))
(define (newobject) (sys_cmd 7))
(define (clear_level) (sys_cmd 9))
(define (fps) (sys_cmd 8))
(define (quit) (sys_cmd 0))
(define (exit) (quit))