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

View file

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

View file

@ -234,6 +234,7 @@ var gameobject = {
},
cry(file) {
return;
this.crying = audio.sound.play(file, audio.sound.bus.sfx);
var killfn = () => {this.crying = undefined; console.warn("killed"); }
this.crying.hook = killfn;
@ -301,7 +302,8 @@ var gameobject = {
Object.mixin(ent,gameobject_impl);
ent.body = make_gameobject();
ent.warp_layer = [true];
ent.phys = 2;
ent.components = {};
ent.objects = {};
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.`,
friction: `When one object touches another, friction slows them down.`,
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.`,
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.`,
@ -737,6 +739,7 @@ ur {
/* u is given as */
function apply_ur(u, e)
{
say(`applying ur ${u}`);
if (typeof u !== 'string') {
console.warn("Must give u as a string.");
return;

View file

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

View file

@ -51,12 +51,15 @@ Spline.catmull_loop = function(cp)
Spline.catmull_caps = function(cp)
{
if (cp.length < 2) return;
cp = cp.slice();
cp.unshift(cp[0].sub(cp[1]).add(cp[0]));
cp.push(cp.last().sub(cp.at(-2).add(cp.last())));
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.type = {

View file

@ -430,9 +430,9 @@ struct phys2d_edge *Make2DEdge(gameobject *go) {
new->shape.go = go;
new->shape.data = new;
new->shape.debugdraw = phys2d_dbgdrawedge;
new->shape.moi = phys2d_edge_moi;
new->shape.moi = phys2d_edge_moi;
new->shape.shape = NULL;
new->shape.apply = NULL;
new->shape.apply = NULL;
new->shape.free = phys2d_edge_free;
new->draws = 0;
phys2d_applyedge(new);

View file

@ -1458,10 +1458,17 @@ JSValue duk_cmd(JSContext *js, JSValueConst this, int argc, JSValueConst *argv)
break;
case 264:
aspect_mode = js2int(argv[1]);
window_resize(0,0);
break;
case 265:
ret = vec2js((HMM_Vec2){mainwin.width, mainwin.height});
break;
case 266:
mainwin.width = js2number(argv[1]);
break;
case 267:
mainwin.height = js2number(argv[1]);
break;
}
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
break;
case MODE_FULL:
usewidth = window->width;
useheight = window->height;
break;
usewidth = window->width;
useheight = window->height;
break;
}
// 2D projection

View file

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