Beispiel #1
0
static void
reset_layout(css_node_t *node)
{
    node->layout.dimensions[CSS_WIDTH] = CSS_UNDEFINED;
    node->layout.dimensions[CSS_HEIGHT] = CSS_UNDEFINED;
    node->layout.position[CSS_LEFT] = 0;
    node->layout.position[CSS_TOP] = 0;
    for (int i = 0; i < node->children_count; i++) {
	reset_layout(node->get_child(node->context, i));
    }
}
Beispiel #2
0
static VALUE
node_update_layout(VALUE rcv, SEL sel, int argc, VALUE *argv)
{
    VALUE max_width = Qnil, max_height = Qnil;
    rb_scan_args(argc, argv, "02", &max_width, &max_height);

    struct ruby_css_node *node = NODE(rcv);
    reset_layout(node->node);
    layoutNode(node->node,
	    max_width == Qnil ? CSS_UNDEFINED : NUM2DBL(max_width),
	    max_height == Qnil ? CSS_UNDEFINED : NUM2DBL(max_height),
	    CSS_DIRECTION_INHERIT);
    return Qnil;
}
Beispiel #3
0
void TextureAtlas::set_tile_size(int unit_w, int unit_h) {
    this->unit_w = unit_w;
    this->unit_h = unit_h;
    reset_layout();
    init_texture();
}