Correct makefile

This commit is contained in:
John Alanbrook 2024-03-09 14:27:02 -06:00
parent 6897f09e59
commit 77b20ae9c2
12 changed files with 51 additions and 19 deletions

9
.gitignore vendored
View file

@ -10,4 +10,11 @@ Jenkinsfile
*.log *.log
*.gz *.gz
*.tar *.tar
.nova/
packer
primum
sokol-shdc
source/shaders/*.h
core.cdb
primum.exe
core.cdb.h

View file

@ -220,7 +220,7 @@ $(DISTDIR)/$(DIST): $(BIN)/$(NAME)
@mkdir -p $(DISTDIR) @mkdir -p $(DISTDIR)
@$(PKGCMD) @$(PKGCMD)
$(BIN)/libengine.a: source/engine/core.cdb.h $(OBJS) $(BIN)/libengine.a: $(OBJS)
@$(AR) rcs $@ $(OBJS) @$(AR) rcs $@ $(OBJS)
$(BIN)/libcdb.a: $(BIN)/libcdb.a:
@ -233,7 +233,6 @@ tools/libcdb.a:
make -C $(CDB) libcdb.a make -C $(CDB) libcdb.a
mv $(CDB)/libcdb.a tools mv $(CDB)/libcdb.a tools
DOCOS = Sound gameobject Game Window physics Profile Time Player Mouse IO Log ColorMap sprite SpriteAnim Render Geometry DOCOS = Sound gameobject Game Window physics Profile Time Player Mouse IO Log ColorMap sprite SpriteAnim Render Geometry
DOCHTML := $(addsuffix .api.html, $(DOCOS)) DOCHTML := $(addsuffix .api.html, $(DOCOS))
DOCMD := $(addsuffix .api.md, $(DOCOS)) DOCMD := $(addsuffix .api.md, $(DOCOS))
@ -263,7 +262,7 @@ $(BIN)/libquickjs.a: $(QUICKJS_O)
@mkdir -p $(BIN) @mkdir -p $(BIN)
cp -rf quickjs/libquickjs.* $(BIN) cp -rf quickjs/libquickjs.* $(BIN)
$(OBJDIR)/%.o: %.c $(OBJDIR)/%.o: %.c source/engine/core.cdb.h $(SHADERS)
@mkdir -p $(@D) @mkdir -p $(@D)
@echo Making C object $@ @echo Making C object $@
@$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@ @$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
@ -330,12 +329,16 @@ clean:
@echo Cleaning project @echo Cleaning project
@rm -rf bin dist @rm -rf bin dist
@rm -f shaders/*.sglsl.h shaders/*.metal core.cdb jso cdb packer TAGS @rm -f shaders/*.sglsl.h shaders/*.metal core.cdb jso cdb packer TAGS
@rm source/engine/core.cdb.h
@make -C quickjs clean @make -C quickjs clean
docs: doc/prosperon.org docs: doc/prosperon.org
make -C doc make -C doc
mv doc/html . mv doc/html .
test:
@echo No tests yet ...
TAGINC != find . -name "*.[chj]" TAGINC != find . -name "*.[chj]"
tags: $(TAGINC) tags: $(TAGINC)
@echo Making tags. @echo Making tags.

View file

@ -106,7 +106,7 @@ Run ~prosperon~. You will see "Hello world!" in the console, and it shuts down.
Using ~config.js~ and ~game.js~, you can write an entire game, without reaching any further. When you want to populate a world with independent actors, entities are what you will reach for. Using ~config.js~ and ~game.js~, you can write an entire game, without reaching any further. When you want to populate a world with independent actors, entities are what you will reach for.
** Actors ** Actors
The fundamental tool for building in Prosperon is the actor system. Actors run independently from each other. Actors are defined by a combination of code and data. All actors have a *master*[fn::I am aware of the ongoing controversy surrounding the use of this term. That is precisely why I have used it: there are a plethora of similar relationships in video games, and by using a term most teams would rather not used, I have saved left the field of avaialable ones wide open] which controls certain properties of the actor. The fundamental tool for building in Prosperon is the actor system. Actors run independently from each other. Actors are defined by a combination of code and data. All actors have a *master* which controls certain properties of the actor.
The most masterful actor is the *Empyrean*. The first actor you create will have the Empyrean as its master. Subsequent actors can use any other actor as its master. The most masterful actor is the *Empyrean*. The first actor you create will have the Empyrean as its master. Subsequent actors can use any other actor as its master.
@ -117,7 +117,7 @@ The most masterful actor is the *Empyrean*. The first actor you create will have
| delay(fn, seconds) | Calls 'fn' after 'seconds' with the context of the actor | | delay(fn, seconds) | Calls 'fn' after 'seconds' with the context of the actor |
*** Actor Lifetime *** Actor Lifetime
When an actor dies, all of the actors that have it as their master[fn::What a mouthful!] will die as well. When an actor dies, all of the actors that have it as their master will die as well.
*** Turns *** Turns
Actors get fragments of time called a *turn*. Actors which belong to different systems can have different lengths of turns. Actors get fragments of time called a *turn*. Actors which belong to different systems can have different lengths of turns.

View file

@ -527,6 +527,8 @@ component.edge2d = Object.copy(collider2d, {
sample() { sample() {
var spoints = this.spoints(); var spoints = this.spoints();
if (spoints.length === 0) return [];
if (this.type === -1) { if (this.type === -1) {
if (this.looped) spoints.push(spoints[0]); if (this.looped) spoints.push(spoints[0]);
return spoints; return spoints;

View file

@ -383,13 +383,15 @@ var Window = {
dimensions() { return cmd(265); }, dimensions() { return cmd(265); },
get width() { return this.dimensions().x; }, get width() { return this.dimensions().x; },
get height() { return this.dimensions().y; }, get height() { return this.dimensions().y; },
set width(x) { cmd(266, x); },
set height(x) { cmd(267,x); },
mode: { mode: {
stretch: 0, stretch: 0, // stretch to fill window
keep: 1, keep: 1, // keep exact dimensions
width: 2, width: 2, // keep width
height: 3, height: 3, // keep height
expand: 4, expand: 4, // expand width or height
full: 5 full: 5 // expand out beyond window
}, },
aspect(x) { cmd(264, x); }, aspect(x) { cmd(264, x); },
title(str) { cmd(134, str); }, title(str) { cmd(134, str); },

View file

@ -234,6 +234,7 @@ var gameobject = {
}, },
cry(file) { cry(file) {
return;
this.crying = audio.sound.play(file, audio.sound.bus.sfx); this.crying = audio.sound.play(file, audio.sound.bus.sfx);
var killfn = () => {this.crying = undefined; console.warn("killed"); } var killfn = () => {this.crying = undefined; console.warn("killed"); }
this.crying.hook = killfn; this.crying.hook = killfn;
@ -301,7 +302,8 @@ var gameobject = {
Object.mixin(ent,gameobject_impl); Object.mixin(ent,gameobject_impl);
ent.body = make_gameobject(); ent.body = make_gameobject();
ent.warp_layer = [true];
ent.phys = 2;
ent.components = {}; ent.components = {};
ent.objects = {}; ent.objects = {};
ent.timers = []; ent.timers = [];
@ -673,7 +675,7 @@ gameobject.doc = {
elasticity: `When two objects collide, their elasticities are multiplied together. Their velocities are then multiplied by this value to find their resultant velocities.`, elasticity: `When two objects collide, their elasticities are multiplied together. Their velocities are then multiplied by this value to find their resultant velocities.`,
friction: `When one object touches another, friction slows them down.`, friction: `When one object touches another, friction slows them down.`,
mass: `The higher the mass of the object, the less forces will affect it.`, mass: `The higher the mass of the object, the less forces will affect it.`,
phys: `Set to 0, 1, or 2, representing static, kinematic, and dynamic.`, phys: `Set to 0, 1, or 2, representing dynamic, kinematic, and static.`,
worldpos: `Function returns the world position of the object.`, worldpos: `Function returns the world position of the object.`,
set_worldpos: `Function to set the position of the object in world coordinates.`, set_worldpos: `Function to set the position of the object in world coordinates.`,
worldangle: `Function to get the angle of the entity in the world.`, worldangle: `Function to get the angle of the entity in the world.`,
@ -737,6 +739,7 @@ ur {
/* u is given as */ /* u is given as */
function apply_ur(u, e) function apply_ur(u, e)
{ {
say(`applying ur ${u}`);
if (typeof u !== 'string') { if (typeof u !== 'string') {
console.warn("Must give u as a string."); console.warn("Must give u as a string.");
return; return;

View file

@ -70,7 +70,10 @@ physics.warp.gravity = function() { return cmd(253); }
physics.warp.damp = function() { return cmd(254); } physics.warp.damp = function() { return cmd(254); }
physics.gravity = physics.warp.gravity(); physics.gravity = physics.warp.gravity();
physics.gravity.mask = [true];
physics.gravity.strength = 500;
physics.damp = physics.warp.damp(); physics.damp = physics.warp.damp();
physics.damp.mask = [true];
return { return {
physics physics

View file

@ -51,12 +51,15 @@ Spline.catmull_loop = function(cp)
Spline.catmull_caps = function(cp) Spline.catmull_caps = function(cp)
{ {
if (cp.length < 2) return;
cp = cp.slice(); cp = cp.slice();
cp.unshift(cp[0].sub(cp[1]).add(cp[0])); cp.unshift(cp[0].sub(cp[1]).add(cp[0]));
cp.push(cp.last().sub(cp.at(-2).add(cp.last()))); cp.push(cp.last().sub(cp.at(-2).add(cp.last())));
return cp; return cp;
} }
Spline.catmull_caps.doc = "Given a set of control points cp, return the necessary caps added to the spline.";
Spline.catmull2bezier.doc = "Given a set of control points C for a camtull-rom type curve, return a set of cubic bezier points to give the same curve." Spline.catmull2bezier.doc = "Given a set of control points C for a camtull-rom type curve, return a set of cubic bezier points to give the same curve."
Spline.type = { Spline.type = {

View file

@ -1458,10 +1458,17 @@ JSValue duk_cmd(JSContext *js, JSValueConst this, int argc, JSValueConst *argv)
break; break;
case 264: case 264:
aspect_mode = js2int(argv[1]); aspect_mode = js2int(argv[1]);
window_resize(0,0);
break; break;
case 265: case 265:
ret = vec2js((HMM_Vec2){mainwin.width, mainwin.height}); ret = vec2js((HMM_Vec2){mainwin.width, mainwin.height});
break; break;
case 266:
mainwin.width = js2number(argv[1]);
break;
case 267:
mainwin.height = js2number(argv[1]);
break;
} }
if (str) JS_FreeCString(js, str); if (str) JS_FreeCString(js, str);

View file

@ -434,9 +434,9 @@ void full_2d_pass(struct window *window)
sg_apply_viewportf(left,0,pwidth, window->height,1); // keep height sg_apply_viewportf(left,0,pwidth, window->height,1); // keep height
break; break;
case MODE_FULL: case MODE_FULL:
usewidth = window->width; usewidth = window->width;
useheight = window->height; useheight = window->height;
break; break;
} }
// 2D projection // 2D projection

View file

@ -23,6 +23,8 @@ struct Texture *icon = NULL;
void window_resize(int width, int height) void window_resize(int width, int height)
{ {
width = sapp_width();
height = sapp_height();
mainwin.dpi = sapp_dpi_scale(); mainwin.dpi = sapp_dpi_scale();
mainwin.width = sapp_width(); mainwin.width = sapp_width();
mainwin.height = sapp_height(); mainwin.height = sapp_height();