clay
This commit is contained in:
@@ -10,7 +10,7 @@ src = []
|
||||
|
||||
fs = import('fs')
|
||||
|
||||
add_project_arguments('-pedantic', language: ['c'])
|
||||
add_project_arguments('-Wno-gnu-label-as-value', language: ['c'])
|
||||
|
||||
git_tag_cmd = run_command('git', 'describe', '--tags', '--abbrev=0', check: false)
|
||||
cell_version = 'unknown'
|
||||
|
||||
@@ -303,19 +303,25 @@ clay.draw_commands = function draw_commands(tree_root, pos = {x:0,y:0})
|
||||
draw.rectangle(boundingbox, null, {color:config.background_color})
|
||||
|
||||
if (config.text) {
|
||||
var baseline_y = content.y //+ config.font.ascent
|
||||
var baseline_y = content.y + content.height - config.font.ascent
|
||||
draw.text(config.text, {x: content.x, y: baseline_y}, config.font, config.color, content.width)
|
||||
}
|
||||
|
||||
if (config.image)
|
||||
draw.image(config.image, content, 0, config.color)
|
||||
|
||||
if (config.clipped) {
|
||||
draw.scissor(content)
|
||||
}
|
||||
|
||||
// Recursively draw children
|
||||
if (node[CHILDREN]) {
|
||||
for (var child of node[CHILDREN]) {
|
||||
draw_node(child);
|
||||
}
|
||||
}
|
||||
if (config.clipped)
|
||||
draw.scissor(null)
|
||||
}
|
||||
|
||||
draw_node(tree_root);
|
||||
|
||||
@@ -72,6 +72,10 @@ clay_input.hit = function hit(tree_root, pos, prev_state = {}) {
|
||||
deepest.state.hovered = true
|
||||
new_hover_chain.push(deepest)
|
||||
}
|
||||
// Call hovered callback if it exists
|
||||
if (typeof deepest.hovered == 'function') {
|
||||
deepest.hovered(true)
|
||||
}
|
||||
|
||||
for (var i = path.length - 2; i >= 0; i--) {
|
||||
var anc = path[i]
|
||||
@@ -80,6 +84,10 @@ clay_input.hit = function hit(tree_root, pos, prev_state = {}) {
|
||||
anc.state.hovered = true
|
||||
new_hover_chain.push(anc)
|
||||
}
|
||||
// Call hovered callback if it exists
|
||||
if (typeof anc.hovered == 'function') {
|
||||
anc.hovered(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,6 +98,10 @@ clay_input.hit = function hit(tree_root, pos, prev_state = {}) {
|
||||
if (new_hover_chain.indexOf(n) == -1) {
|
||||
n.state = n.state || {}
|
||||
n.state.hovered = false
|
||||
// Call hovered callback if it exists
|
||||
if (typeof n.hovered == 'function') {
|
||||
n.hovered(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,6 +110,7 @@ clay_input.hit = function hit(tree_root, pos, prev_state = {}) {
|
||||
path: path,
|
||||
deepest: deepest,
|
||||
action_target: action_target,
|
||||
hovered: deepest,
|
||||
hover_chain: new_hover_chain
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,6 +231,10 @@ draw.scissor = function(rect)
|
||||
width: Math.round(screen_right - screen_left),
|
||||
height: Math.round(screen_bottom - screen_top)
|
||||
}
|
||||
|
||||
// TODO: must be a better way than manually inverting here. Some camera specific function.
|
||||
var sensor = gamestate.camera.sensor()
|
||||
screen_rect.y = sensor.height - screen_rect.y - screen_rect.height
|
||||
}
|
||||
|
||||
current_list.push({
|
||||
|
||||
@@ -891,10 +891,9 @@ prosperon.create_batch = function create_batch(draw_cmds, done) {
|
||||
if (cmd.cmd == "scissor") {
|
||||
if (!cmd.rect)
|
||||
render_pass.scissor({x:0,y:0,width:win_size.width,height:win_size.height})
|
||||
else {
|
||||
else
|
||||
render_pass.scissor(cmd.rect)
|
||||
log.console(json.encode(cmd.rect))
|
||||
}
|
||||
|
||||
continue
|
||||
}
|
||||
if (cmd.camera) {
|
||||
|
||||
@@ -256,6 +256,8 @@ static int globfs_cb(struct globdata *data, char *dir, char *file)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// arg0: glob patterns (array of strings)
|
||||
// arg1: directory (string)
|
||||
JSC_CCALL(io_globfs,
|
||||
ret = JS_NewArray(js);
|
||||
struct globdata data;
|
||||
|
||||
@@ -1455,7 +1455,9 @@ void JS_FreeRuntime(JSRuntime *rt)
|
||||
printf("Secondary object leaks: %d\n", count);
|
||||
}
|
||||
#endif
|
||||
assert(list_empty(&rt->gc_obj_list));
|
||||
if (!list_empty(&rt->gc_obj_list))
|
||||
printf("Object leaks!\n");
|
||||
// assert(list_empty(&rt->gc_obj_list));
|
||||
|
||||
/* free the classes */
|
||||
for(i = 0; i < rt->class_count; i++) {
|
||||
|
||||
Reference in New Issue
Block a user