This commit is contained in:
John Alanbrook 2023-04-29 15:07:58 +00:00
parent 0bf7d419e0
commit bea5b326cf
5 changed files with 18 additions and 1 deletions

View file

@ -99,6 +99,8 @@ DEPENDS = $(objects:.o=.d)
ENGINE = $(BIN)libengine.a ENGINE = $(BIN)libengine.a
INCLUDE = $(BIN)include INCLUDE = $(BIN)include
SCRIPTS = $(shell ls source/scripts/*.js)
LINK = $(LIBPATH) $(LINKER_FLAGS) $(ELIBS) LINK = $(LIBPATH) $(LINKER_FLAGS) $(ELIBS)
MYTAG = $(VER)_$(PTYPE)_$(INFO) MYTAG = $(VER)_$(PTYPE)_$(INFO)
@ -114,7 +116,7 @@ $(BIN)$(NAME): $(objprefix)/source/engine/yugine.o $(ENGINE) $(BIN)libquickjs.a
$(CC) $< $(LINK) -o $(BIN)$(NAME) $(CC) $< $(LINK) -o $(BIN)$(NAME)
@echo Finished build @echo Finished build
$(BIN)$(DIST): $(BIN)$(NAME) source/shaders/* source/scripts/* assets/* $(BIN)$(DIST): $(BIN)$(NAME) source/shaders/* $(SCRIPTS) assets/*
@echo Creating distribution $(DIST) @echo Creating distribution $(DIST)
@mkdir -p $(BIN)dist @mkdir -p $(BIN)dist
@cp $(BIN)$(NAME) $(BIN)dist @cp $(BIN)$(NAME) $(BIN)dist

View file

@ -24,6 +24,12 @@ Object.defineProperty(Object.prototype, 'getOwnPropertyDescriptors', {
} }
}); });
Object.defineProperty(Object.prototype, 'obscure', {
value: function(name) {
Object.defineProperty(this, name, { enumerable: false });
}
});
Object.defineProperty(Object.prototype, 'hasOwn', { Object.defineProperty(Object.prototype, 'hasOwn', {
value: function(x) { return this.hasOwnProperty(x); } value: function(x) { return this.hasOwnProperty(x); }
}); });
@ -609,3 +615,4 @@ function sortpointsccw(points)
return ccw.map(function(x) { return x.add(cm); }); return ccw.map(function(x) { return x.add(cm); });
} }

View file

@ -136,10 +136,14 @@ var char2d = clone(sprite, {
make(go) { make(go) {
var char = clone(this); var char = clone(this);
char.curplaying = char.anims.array()[0]; char.curplaying = char.anims.array()[0];
char.obscure('curplaying');
Object.defineProperty(char, 'id', {value:make_sprite(go,char.curplaying.path,this.pos)}); Object.defineProperty(char, 'id', {value:make_sprite(go,char.curplaying.path,this.pos)});
char.obscure('id');
char.frame = 0; char.frame = 0;
char.timer = timer.make(char.advance.bind(char), 1/char.curplaying.fps); char.timer = timer.make(char.advance.bind(char), 1/char.curplaying.fps);
char.timer.loop = true; char.timer.loop = true;
char.obscure('timer');
char.obscure('rect');
char.setsprite(); char.setsprite();
return char; return char;
}, },

View file

@ -85,9 +85,11 @@ function deep_merge(target, source)
Log.warn("Doing a deep merge ..."); Log.warn("Doing a deep merge ...");
for (var key in source) { for (var key in source) {
if (typeof source[key] === 'object' && !Array.isArray(source[key])) { if (typeof source[key] === 'object' && !Array.isArray(source[key])) {
Log.warn(`Deeper merge on ${key}`);
deep_merge(target[key], source[key]); deep_merge(target[key], source[key]);
} }
else { else {
Log.warn(`Setting key ${key}`);
target[key] = source[key]; target[key] = source[key];
} }
} }

View file

@ -1761,3 +1761,5 @@ for (var key in prototypes) {
} }
function save_gameobjects_as_prototypes() { slurpwrite(JSON.stringify(gameobjects,null,2), "proto.json"); }; function save_gameobjects_as_prototypes() { slurpwrite(JSON.stringify(gameobjects,null,2), "proto.json"); };
Resources = {};