Fix gui texture rendering; add input post callback; editor bugs
This commit is contained in:
parent
681fb27ae4
commit
513a9ac618
|
@ -326,7 +326,7 @@ void gameobject_draw_debug(int go) {
|
||||||
.g = 255,
|
.g = 255,
|
||||||
.a = 255
|
.a = 255
|
||||||
};
|
};
|
||||||
draw_cppoint(pos, 3.f, color);
|
|
||||||
cpBodyEachShape(g->body, body_draw_shapes_dbg, NULL);
|
cpBodyEachShape(g->body, body_draw_shapes_dbg, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -329,7 +329,7 @@ const char *keyname_extd(int key) {
|
||||||
return "minus";
|
return "minus";
|
||||||
break;
|
break;
|
||||||
case SAPP_KEYCODE_GRAVE_ACCENT:
|
case SAPP_KEYCODE_GRAVE_ACCENT:
|
||||||
return "backtick";
|
return "`";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SAPP_KEYCODE_LEFT_BRACKET:
|
case SAPP_KEYCODE_LEFT_BRACKET:
|
||||||
|
|
|
@ -415,7 +415,6 @@ void full_2d_pass(struct window *window)
|
||||||
hudproj = HMM_Orthographic_RH_NO(0, window->width, 0, window->height, -1.f, 1.f);
|
hudproj = HMM_Orthographic_RH_NO(0, window->width, 0, window->height, -1.f, 1.f);
|
||||||
|
|
||||||
sprite_draw_all();
|
sprite_draw_all();
|
||||||
sprite_flush();
|
|
||||||
call_draw();
|
call_draw();
|
||||||
|
|
||||||
//// DEBUG
|
//// DEBUG
|
||||||
|
@ -436,6 +435,7 @@ void full_2d_pass(struct window *window)
|
||||||
call_gui();
|
call_gui();
|
||||||
debug_flush(&hudproj);
|
debug_flush(&hudproj);
|
||||||
text_flush(&hudproj);
|
text_flush(&hudproj);
|
||||||
|
sprite_flush();
|
||||||
|
|
||||||
#ifndef NO_EDITOR
|
#ifndef NO_EDITOR
|
||||||
call_nk_gui();
|
call_nk_gui();
|
||||||
|
|
|
@ -113,6 +113,10 @@ void sprite_io(struct sprite *sprite, FILE *f, int read) {
|
||||||
void sprite_draw_all() {
|
void sprite_draw_all() {
|
||||||
sg_apply_pipeline(pip_sprite);
|
sg_apply_pipeline(pip_sprite);
|
||||||
sg_apply_uniforms(SG_SHADERSTAGE_VS, 0, SG_RANGE_REF(projection));
|
sg_apply_uniforms(SG_SHADERSTAGE_VS, 0, SG_RANGE_REF(projection));
|
||||||
|
for (int i = 0; i < arrlen(sprites); i++)
|
||||||
|
sprite_draw(&sprites[i]);
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
static struct sprite **layers[5];
|
static struct sprite **layers[5];
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ var sprite = clone(component, {
|
||||||
pos: [0,0],
|
pos: [0,0],
|
||||||
get visible() { return this.enabled; },
|
get visible() { return this.enabled; },
|
||||||
set visible(x) { this.enabled = x; },
|
set visible(x) { this.enabled = x; },
|
||||||
set asset(str) { this.path = str; Log.warn(`SET ${str} ON THE SPRITE`); this.sync();},
|
set asset(str) { this.path = str; this.sync();},
|
||||||
angle: 0,
|
angle: 0,
|
||||||
rect: {s0:0, s1: 1, t0: 0, t1: 1},
|
rect: {s0:0, s1: 1, t0: 0, t1: 1},
|
||||||
|
|
||||||
|
@ -48,7 +48,6 @@ var sprite = clone(component, {
|
||||||
get pos() { return cmd(111, this.id); },
|
get pos() { return cmd(111, this.id); },
|
||||||
set pos(x) { cmd(37,this.id,x); },
|
set pos(x) { cmd(37,this.id,x); },
|
||||||
set layer(x) { cmd(60, this.id, x); },
|
set layer(x) { cmd(60, this.id, x); },
|
||||||
get layer() { return this.gameobject.draw_layer; },
|
|
||||||
|
|
||||||
get boundingbox() {
|
get boundingbox() {
|
||||||
var dim = this.dimensions;
|
var dim = this.dimensions;
|
||||||
|
@ -67,22 +66,25 @@ var sprite = clone(component, {
|
||||||
kill() { cmd(9,this.id); },
|
kill() { cmd(9,this.id); },
|
||||||
});
|
});
|
||||||
sprite.obscure('boundingbox');
|
sprite.obscure('boundingbox');
|
||||||
|
sprite.layer = 1;
|
||||||
return sprite;
|
return sprite;
|
||||||
},
|
},
|
||||||
|
|
||||||
input_kp9_pressed() { this.pos = [0,0]; },
|
|
||||||
input_kp8_pressed() { this.pos = [-0.5, 0]; },
|
|
||||||
input_kp7_pressed() { this.pos = [-1,0]; },
|
|
||||||
input_kp6_pressed() { this.pos = [0,-0.5]; },
|
|
||||||
input_kp5_pressed() { this.pos = [-0.5,-0.5]; },
|
|
||||||
input_kp4_pressed() { this.pos = [-1,-0.5]; },
|
|
||||||
input_kp3_pressed() { this.pos = [0, -1]; },
|
|
||||||
input_kp2_pressed() { this.pos = [-0.5,-1]; },
|
|
||||||
input_kp1_pressed() { this.pos = [-1,-1]; },
|
|
||||||
|
|
||||||
POS_MID: [-0.5, -0.5],
|
POS_MID: [-0.5, -0.5],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
sprite.inputs = {};
|
||||||
|
sprite.inputs.kp9 = function() { this.pos = [0,0]; };
|
||||||
|
sprite.inputs.kp8 = function() { this.pos = [-0.5, 0]; };
|
||||||
|
sprite.inputs.kp7 = function() { this.pos = [-1,0]; };
|
||||||
|
sprite.inputs.kp6 = function() { this.pos = [0,-0.5]; };
|
||||||
|
sprite.inputs.kp5 = function() { this.pos = [-0.5,-0.5]; };
|
||||||
|
sprite.inputs.kp4 = function() { this.pos = [-1,-0.5]; };
|
||||||
|
sprite.inputs.kp3 = function() { this.pos = [0, -1]; };
|
||||||
|
sprite.inputs.kp2 = function() { this.pos = [-0.5,-1]; };
|
||||||
|
sprite.inputs.kp1 = function() { this.pos = [-1,-1]; };
|
||||||
|
|
||||||
|
|
||||||
/* Container to play sprites and anim2ds */
|
/* Container to play sprites and anim2ds */
|
||||||
var char2d = clone(sprite, {
|
var char2d = clone(sprite, {
|
||||||
clone(anims) {
|
clone(anims) {
|
||||||
|
@ -335,6 +337,7 @@ var polygon2d = clone(collider2d, {
|
||||||
});
|
});
|
||||||
|
|
||||||
polygon2d.inputs = {};
|
polygon2d.inputs = {};
|
||||||
|
polygon2d.inputs.post = function() { this.sync(); };
|
||||||
polygon2d.inputs.f10 = function() {
|
polygon2d.inputs.f10 = function() {
|
||||||
this.points = sortpointsccw(this.points);
|
this.points = sortpointsccw(this.points);
|
||||||
};
|
};
|
||||||
|
@ -346,7 +349,7 @@ polygon2d.inputs['C-lm'] = function() {
|
||||||
polygon2d.inputs['C-lm'].doc = "Add a point to location of mouse.";
|
polygon2d.inputs['C-lm'].doc = "Add a point to location of mouse.";
|
||||||
|
|
||||||
polygon2d.inputs['S-lm'] = function() {
|
polygon2d.inputs['S-lm'] = function() {
|
||||||
var idx = grab_from_points(screen2world(Mouse.pos), this.points.map(this.gameobject.this2world,this.gameobject), 25);
|
var idx = grab_from_points(Mouse.worldpos, this.points.map(p => this.gameobject.this2world(p)), 25);
|
||||||
if (idx === -1) return;
|
if (idx === -1) return;
|
||||||
this.points.splice(idx, 1);
|
this.points.splice(idx, 1);
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,10 +4,6 @@
|
||||||
*/
|
*/
|
||||||
prototypes.generate_ur('.');
|
prototypes.generate_ur('.');
|
||||||
|
|
||||||
/* This is the editor level & camera - NOT the currently edited level, but a level to hold editor things */
|
|
||||||
var editor_level = Primum.spawn(ur.arena);
|
|
||||||
var editor_camera = Game.camera;
|
|
||||||
|
|
||||||
var editor_config = {
|
var editor_config = {
|
||||||
grid_size: 100,
|
grid_size: 100,
|
||||||
grid_color: [99, 255, 128, 100],
|
grid_color: [99, 255, 128, 100],
|
||||||
|
@ -28,8 +24,8 @@ var editor = {
|
||||||
moveoffset: [0,0],
|
moveoffset: [0,0],
|
||||||
startrot: 0,
|
startrot: 0,
|
||||||
rotoffset: 0,
|
rotoffset: 0,
|
||||||
camera: editor_camera,
|
camera: undefined,
|
||||||
edit_level: {}, /* The current level that is being edited */
|
edit_level: undefined, /* The current level that is being edited */
|
||||||
working_layer: 0,
|
working_layer: 0,
|
||||||
cursor: undefined,
|
cursor: undefined,
|
||||||
edit_mode: "basic",
|
edit_mode: "basic",
|
||||||
|
@ -535,7 +531,6 @@ var editor = {
|
||||||
}
|
}
|
||||||
|
|
||||||
GUI.text("0,0", world2screen([0,0]));
|
GUI.text("0,0", world2screen([0,0]));
|
||||||
Debug.point([0,0],3);
|
|
||||||
|
|
||||||
var clvl = this.edit_level;
|
var clvl = this.edit_level;
|
||||||
var ypos = 200;
|
var ypos = 200;
|
||||||
|
@ -597,12 +592,12 @@ var editor = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Game.objects.forEach(function(obj) {
|
editor.edit_level.objects.forEach(function(obj) {
|
||||||
if (!obj.selectable)
|
if (!obj.selectable)
|
||||||
gui_img("icons/icons8-lock-16.png", world2screen(obj.pos));
|
GUI.image("icons/icons8-lock-16.png", world2screen(obj.pos));
|
||||||
});
|
});
|
||||||
|
|
||||||
Debug.draw_grid(1, editor_config.grid_size/editor_camera.zoom, editor_config.grid_color);
|
Debug.draw_grid(1, editor_config.grid_size/editor.camera.zoom, editor_config.grid_color);
|
||||||
var startgrid = screen2world([-20,Window.height]).map(function(x) { return Math.snap(x, editor_config.grid_size); }, this);
|
var startgrid = screen2world([-20,Window.height]).map(function(x) { return Math.snap(x, editor_config.grid_size); }, this);
|
||||||
var endgrid = screen2world([Window.width, 0]);
|
var endgrid = screen2world([Window.width, 0]);
|
||||||
|
|
||||||
|
@ -650,11 +645,12 @@ var editor = {
|
||||||
var log = cmd(84);
|
var log = cmd(84);
|
||||||
var f = log.prev('\n', 0, 10);
|
var f = log.prev('\n', 0, 10);
|
||||||
Nuke.scrolltext(log.slice(f));
|
Nuke.scrolltext(log.slice(f));
|
||||||
|
this.replstr = Nuke.textbox(this.replstr);
|
||||||
Nuke.end();
|
Nuke.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
replstr: "",
|
||||||
|
|
||||||
ed_debug() {
|
ed_debug() {
|
||||||
if (!Debug.phys_drawing)
|
if (!Debug.phys_drawing)
|
||||||
|
@ -687,11 +683,12 @@ var editor = {
|
||||||
lvl_history: [],
|
lvl_history: [],
|
||||||
|
|
||||||
load(file) {
|
load(file) {
|
||||||
if (this.edit_level) this.lvl_history.push(this.edit_level.ur);
|
// if (this.edit_level) this.lvl_history.push(this.edit_level.ur);
|
||||||
// this.edit_level.kill();
|
// this.edit_level.kill();
|
||||||
// this.edit_level = Level.loadfile(file);
|
// this.edit_level = Level.loadfile(file);
|
||||||
// this.curlvl = this.edit_level.save();
|
// this.curlvl = this.edit_level.save();
|
||||||
Primum.spawn(prototypes.get_ur(file));
|
// Primum.spawn(prototypes.get_ur(file));
|
||||||
|
editor.edit_level.spawn(prototypes.get_ur(file));
|
||||||
|
|
||||||
this.unselect();
|
this.unselect();
|
||||||
},
|
},
|
||||||
|
@ -2035,7 +2032,7 @@ limited_editor.inputs['C-q'] = function()
|
||||||
// World.kill();
|
// World.kill();
|
||||||
World.clear_all();
|
World.clear_all();
|
||||||
editor.load_json(editor.stash);
|
editor.load_json(editor.stash);
|
||||||
Game.view_camera(editor_camera);
|
Game.view_camera(editor.camera);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is used for editing during a paused game */
|
/* This is used for editing during a paused game */
|
||||||
|
@ -2049,6 +2046,10 @@ Debug.register_call(editor.ed_debug, editor);
|
||||||
if (IO.exists("editor.config"))
|
if (IO.exists("editor.config"))
|
||||||
load_configs("editor.config");
|
load_configs("editor.config");
|
||||||
|
|
||||||
editor.edit_level = editor_level;
|
/* This is the editor level & camera - NOT the currently edited level, but a level to hold editor things */
|
||||||
|
editor.edit_level = Primum.spawn(ur.arena);
|
||||||
|
editor.edit_level.selectable = false;
|
||||||
|
editor.camera = Game.camera;
|
||||||
|
|
||||||
|
|
||||||
Game.stop();
|
Game.stop();
|
||||||
|
|
|
@ -39,6 +39,7 @@ Log.level = 1;
|
||||||
|
|
||||||
var Color = {
|
var Color = {
|
||||||
white: [255,255,255,255],
|
white: [255,255,255,255],
|
||||||
|
black: [0,0,0,255],
|
||||||
blue: [84,110,255,255],
|
blue: [84,110,255,255],
|
||||||
green: [120,255,10,255],
|
green: [120,255,10,255],
|
||||||
yellow: [251,255,43,255],
|
yellow: [251,255,43,255],
|
||||||
|
@ -552,27 +553,13 @@ load("scripts/entity.js");
|
||||||
|
|
||||||
var World = Object.create(gameobject);
|
var World = Object.create(gameobject);
|
||||||
var Primum = World;
|
var Primum = World;
|
||||||
|
gameobject.make_parentable(Primum);
|
||||||
Primum.tag = "PRIMUM";
|
Primum.tag = "PRIMUM";
|
||||||
Primum.selectable = false;
|
Primum.selectable = false;
|
||||||
Primum.ur = { tag: "Primum" };
|
Primum.ur = { tag: "Primum" };
|
||||||
Primum.objects = [];
|
|
||||||
|
|
||||||
World.remove_child = function(child) {
|
|
||||||
this.objects.remove(child);
|
|
||||||
}
|
|
||||||
|
|
||||||
World.add_child = function(child) {
|
|
||||||
child.unparent();
|
|
||||||
objects.push(child);
|
|
||||||
child.level = World;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Reparent this object to a new one */
|
/* Reparent this object to a new one */
|
||||||
World.reparent = function(parent) { }
|
World.reparent = function(parent) { Log.warn("Cannot reparent the Primum."); }
|
||||||
|
World.unparent = function() { Log.warn("The Primum has no parent, always."); }
|
||||||
World.unparent = function() { }
|
|
||||||
|
|
||||||
World.name = "World";
|
|
||||||
World.fullpath = function() { return World.name; };
|
World.fullpath = function() { return World.name; };
|
||||||
|
|
||||||
/* Load configs */
|
/* Load configs */
|
||||||
|
|
|
@ -18,6 +18,7 @@ var gameobject = {
|
||||||
spawn(ur) {
|
spawn(ur) {
|
||||||
if (typeof ur === 'string')
|
if (typeof ur === 'string')
|
||||||
ur = prototypes.get_ur(ur);
|
ur = prototypes.get_ur(ur);
|
||||||
|
|
||||||
return ur.type.make(this);
|
return ur.type.make(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -328,21 +329,11 @@ var gameobject = {
|
||||||
var obj = Object.create(this);
|
var obj = Object.create(this);
|
||||||
this.instances.push(obj);
|
this.instances.push(obj);
|
||||||
obj.toString = function() {
|
obj.toString = function() {
|
||||||
var props = obj.prop_obj();
|
if (obj.ur)
|
||||||
for (var key in props)
|
return obj.ur.tag;
|
||||||
if (typeof props[key] === 'object' && !props[key] === null && props[key].empty)
|
|
||||||
delete props[key];
|
return "NO UR"};
|
||||||
|
|
||||||
var edited = !props.empty;
|
|
||||||
// return (edited ? "#" : "") + obj.name + " object " + obj.body + ", layer " + obj.draw_layer + ", phys " + obj.layer;
|
|
||||||
return obj.ur.tag;
|
|
||||||
};
|
|
||||||
|
|
||||||
obj.fullpath = function() {
|
|
||||||
return obj.ur.tag;
|
|
||||||
};
|
|
||||||
obj.deflock('toString');
|
|
||||||
obj.defc('from', this.name);
|
|
||||||
obj.defn('body', make_gameobject(this.scale,
|
obj.defn('body', make_gameobject(this.scale,
|
||||||
this.phys,
|
this.phys,
|
||||||
this.mass,
|
this.mass,
|
||||||
|
@ -350,34 +341,9 @@ var gameobject = {
|
||||||
this.elasticity) );
|
this.elasticity) );
|
||||||
obj.sync();
|
obj.sync();
|
||||||
obj.defn('components', {});
|
obj.defn('components', {});
|
||||||
|
|
||||||
Game.register_obj(obj);
|
Game.register_obj(obj);
|
||||||
|
|
||||||
var objects = [];
|
|
||||||
obj.objects = objects;
|
|
||||||
|
|
||||||
obj.remove_child = function(child) {
|
|
||||||
objects.remove(child);
|
|
||||||
}
|
|
||||||
|
|
||||||
obj.add_child = function(child) {
|
|
||||||
child.unparent();
|
|
||||||
objects.push(child);
|
|
||||||
child.level = obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Reparent this object to a new one */
|
|
||||||
obj.reparent = function(parent) {
|
|
||||||
if (parent === obj.level)
|
|
||||||
return;
|
|
||||||
|
|
||||||
parent.add_child(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
obj.unparent = function() {
|
|
||||||
if (!obj.level) return;
|
|
||||||
obj.level.remove_child(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd(113, obj.body, obj);
|
cmd(113, obj.body, obj);
|
||||||
|
|
||||||
/* Now that it's concrete in the engine, these functions update to return engine data */
|
/* Now that it's concrete in the engine, these functions update to return engine data */
|
||||||
|
@ -394,7 +360,7 @@ var gameobject = {
|
||||||
|
|
||||||
set pos(x) {
|
set pos(x) {
|
||||||
var diff = x.sub(this.pos);
|
var diff = x.sub(this.pos);
|
||||||
objects.forEach(function(x) { x.pos = x.pos.add(diff); });
|
this.objects.forEach(function(x) { x.pos = x.pos.add(diff); });
|
||||||
set_body(2,obj.body,x); },
|
set_body(2,obj.body,x); },
|
||||||
get pos() { return q_body(1,obj.body); },
|
get pos() { return q_body(1,obj.body); },
|
||||||
|
|
||||||
|
@ -413,7 +379,6 @@ var gameobject = {
|
||||||
|
|
||||||
for (var prop in obj) {
|
for (var prop in obj) {
|
||||||
if (typeof obj[prop] === 'object' && 'make' in obj[prop]) {
|
if (typeof obj[prop] === 'object' && 'make' in obj[prop]) {
|
||||||
if (prop === 'flipper') return;
|
|
||||||
obj[prop] = obj[prop].make(obj.body);
|
obj[prop] = obj[prop].make(obj.body);
|
||||||
obj[prop].defn('gameobject', obj);
|
obj[prop].defn('gameobject', obj);
|
||||||
obj.components[prop] = obj[prop];
|
obj.components[prop] = obj[prop];
|
||||||
|
@ -421,6 +386,8 @@ var gameobject = {
|
||||||
};
|
};
|
||||||
|
|
||||||
obj.check_registers(obj);
|
obj.check_registers(obj);
|
||||||
|
|
||||||
|
gameobject.make_parentable(obj);
|
||||||
|
|
||||||
/* Spawn subobjects defined */
|
/* Spawn subobjects defined */
|
||||||
if (obj.$) {
|
if (obj.$) {
|
||||||
|
@ -430,6 +397,8 @@ var gameobject = {
|
||||||
|
|
||||||
if (typeof obj.start === 'function') obj.start();
|
if (typeof obj.start === 'function') obj.start();
|
||||||
|
|
||||||
|
level.add_child(obj);
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -448,6 +417,33 @@ var gameobject = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gameobject.make_parentable = function(obj) {
|
||||||
|
var objects = [];
|
||||||
|
|
||||||
|
obj.remove_child = function(child) {
|
||||||
|
objects.remove(child);
|
||||||
|
}
|
||||||
|
|
||||||
|
obj.add_child = function(child) {
|
||||||
|
child.unparent();
|
||||||
|
objects.push(child);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Reparent this object to a new one */
|
||||||
|
obj.reparent = function(parent) {
|
||||||
|
if (parent === obj.level)
|
||||||
|
return;
|
||||||
|
|
||||||
|
parent.add_child(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
obj.unparent = function() {
|
||||||
|
if (!obj.level) return;
|
||||||
|
obj.level.remove_child(obj);
|
||||||
|
}
|
||||||
|
obj.objects = objects;
|
||||||
|
}
|
||||||
|
|
||||||
var locks = ['height', 'width', 'visible', 'body', 'controlled', 'selectable', 'save', 'velocity', 'angularvelocity', 'alive', 'boundingbox', 'name', 'scale', 'angle', 'properties', 'moi', 'relpos', 'relangle', 'up', 'down', 'right', 'left', 'bodytype', 'gizmo', 'pos'];
|
var locks = ['height', 'width', 'visible', 'body', 'controlled', 'selectable', 'save', 'velocity', 'angularvelocity', 'alive', 'boundingbox', 'name', 'scale', 'angle', 'properties', 'moi', 'relpos', 'relangle', 'up', 'down', 'right', 'left', 'bodytype', 'gizmo', 'pos'];
|
||||||
locks.forEach(x => gameobject.obscure(x));
|
locks.forEach(x => gameobject.obscure(x));
|
||||||
|
|
||||||
|
@ -529,6 +525,7 @@ prototypes.from_obj = function(name, obj)
|
||||||
tag: name,
|
tag: name,
|
||||||
type: newobj
|
type: newobj
|
||||||
};
|
};
|
||||||
|
newobj.ur = prototypes.ur[name];
|
||||||
return prototypes.ur[name];
|
return prototypes.ur[name];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@ var GUI = {
|
||||||
},
|
},
|
||||||
|
|
||||||
image(path,pos) {
|
image(path,pos) {
|
||||||
let wh = cmd(64,path);
|
var wh = cmd(64,path);
|
||||||
gui_img(path,pos.slice().sub(wh), 1.0, 0.0);
|
gui_img(path,pos, [1.0,1.0], 0.0, 0.0, [0.0,0.0], 0.0, Color.black);
|
||||||
return cwh2bb([0,0], wh);
|
return cwh2bb([0,0], wh);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -112,6 +112,7 @@ var Player = {
|
||||||
for (var pawn of this.pawns.reverse()) {
|
for (var pawn of this.pawns.reverse()) {
|
||||||
if (typeof pawn.inputs?.mouse?.[type] === 'function') {
|
if (typeof pawn.inputs?.mouse?.[type] === 'function') {
|
||||||
pawn.inputs.mouse[type].call(pawn,...args);
|
pawn.inputs.mouse[type].call(pawn,...args);
|
||||||
|
pawn.inputs.post?.call(pawn);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,8 +142,10 @@ var Player = {
|
||||||
fn = pawn.inputs[cmd].down;
|
fn = pawn.inputs[cmd].down;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof fn === 'function')
|
if (typeof fn === 'function') {
|
||||||
fn.call(pawn, ... args);
|
fn.call(pawn, ... args);
|
||||||
|
pawn.inputs.post?.call(pawn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue