static void create_dummy_control_points (EntityState *entity_state) { RigSelectionTool *tool = entity_state->tool; CoglTexture *tex = rut_load_texture_from_data_file (tool->ctx, "dot.png", NULL); ControlPoint *point; point = g_slice_new0 (ControlPoint); point->entity_state = entity_state; point->x = 0; point->y = 0; point->z = 0; point->transform = rut_transform_new (tool->ctx); rut_graphable_add_child (tool->tool_overlay, point->transform); rut_refable_unref (point->transform); point->marker = rut_nine_slice_new (tool->ctx, tex, 0, 0, 0, 0, 10, 10); rut_graphable_add_child (point->transform, point->marker); rut_refable_unref (point->marker); point->input_region = rut_input_region_new_circle (0, 0, 5, control_point_input_cb, point); rut_graphable_add_child (tool->tool_overlay, point->input_region); rut_refable_unref (point->input_region); entity_state->control_points = g_list_prepend (entity_state->control_points, point); point = g_slice_new0 (ControlPoint); point->entity_state = entity_state; point->x = 100; point->y = 0; point->z = 0; point->transform = rut_transform_new (tool->ctx); rut_graphable_add_child (tool->tool_overlay, point->transform); rut_refable_unref (point->transform); point->marker = rut_nine_slice_new (tool->ctx, tex, 0, 0, 0, 0, 10, 10); rut_graphable_add_child (point->transform, point->marker); rut_refable_unref (point->marker); point->input_region = rut_input_region_new_circle (0, 0, 5, control_point_input_cb, point); rut_graphable_add_child (tool->tool_overlay, point->input_region); rut_refable_unref (point->input_region); entity_state->control_points = g_list_prepend (entity_state->control_points, point); cogl_object_unref (tex); }
static void create_dummy_control_points(entity_state_t *entity_state) { rig_selection_tool_t *tool = entity_state->tool; cg_texture_t *tex = rut_load_texture_from_data_file(tool->shell, "dot.png", NULL); control_point_t *point; point = c_slice_new0(control_point_t); point->entity_state = entity_state; point->x = 0; point->y = 0; point->z = 0; point->transform = rut_transform_new(tool->shell); rut_graphable_add_child(tool->tool_overlay, point->transform); rut_object_unref(point->transform); point->marker = rut_nine_slice_new(tool->shell, tex, 0, 0, 0, 0, 10, 10); rut_graphable_add_child(point->transform, point->marker); rut_object_unref(point->marker); point->input_region = rut_input_region_new_circle(0, 0, 5, control_point_input_cb, point); rut_graphable_add_child(tool->tool_overlay, point->input_region); rut_object_unref(point->input_region); entity_state->control_points = c_llist_prepend(entity_state->control_points, point); point = c_slice_new0(control_point_t); point->entity_state = entity_state; point->x = 100; point->y = 0; point->z = 0; point->transform = rut_transform_new(tool->shell); rut_graphable_add_child(tool->tool_overlay, point->transform); rut_object_unref(point->transform); point->marker = rut_nine_slice_new(tool->shell, tex, 0, 0, 0, 0, 10, 10); rut_graphable_add_child(point->transform, point->marker); rut_object_unref(point->marker); point->input_region = rut_input_region_new_circle(0, 0, 5, control_point_input_cb, point); rut_graphable_add_child(tool->tool_overlay, point->input_region); rut_object_unref(point->input_region); entity_state->control_points = c_llist_prepend(entity_state->control_points, point); cg_object_unref(tex); }
RutBin * rut_bin_new (RutContext *ctx) { RutBin *bin = g_slice_new0 (RutBin); static CoglBool initialized = FALSE; if (initialized == FALSE) { _rut_bin_init_type (); initialized = TRUE; } bin->ref_count = 1; bin->context = rut_refable_ref (ctx); bin->x_position = RUT_BIN_POSITION_EXPAND; bin->y_position = RUT_BIN_POSITION_EXPAND; rut_list_init (&bin->preferred_size_cb_list); rut_object_init (&bin->_parent, &rut_bin_type); rut_graphable_init (RUT_OBJECT (bin)); bin->child_transform = rut_transform_new (ctx); rut_graphable_add_child (bin, bin->child_transform); return bin; }
RutBin * rut_bin_new (RutContext *ctx) { RutBin *bin = rut_object_alloc0 (RutBin, &rut_bin_type, _rut_bin_init_type); bin->ref_count = 1; bin->context = ctx; bin->x_position = RUT_BIN_POSITION_EXPAND; bin->y_position = RUT_BIN_POSITION_EXPAND; rut_list_init (&bin->preferred_size_cb_list); rut_graphable_init (RUT_OBJECT (bin)); bin->child_transform = rut_transform_new (ctx); rut_graphable_add_child (bin, bin->child_transform); rut_refable_unref (bin->child_transform); return bin; }
RutButton * rut_button_new (RutContext *ctx, const char *label) { RutButton *button = g_slice_new0 (RutButton); GError *error = NULL; float text_width, text_height; static CoglBool initialized = FALSE; if (initialized == FALSE) { _rut_button_init_type (); initialized = TRUE; } rut_object_init (RUT_OBJECT (button), &rut_button_type); button->ref_count = 1; rut_list_init (&button->on_click_cb_list); rut_graphable_init (RUT_OBJECT (button)); rut_paintable_init (RUT_OBJECT (button)); button->ctx = ctx; button->state = BUTTON_STATE_NORMAL; button->normal_texture = rut_load_texture_from_data_file (ctx, "button.png", &error); if (button->normal_texture) { button->background_normal = rut_nine_slice_new (ctx, button->normal_texture, 11, 5, 13, 5, button->width, button->height); } else { g_warning ("Failed to load button texture: %s", error->message); g_error_free (error); } button->hover_texture = rut_load_texture_from_data_file (ctx, "button-hover.png", &error); if (button->hover_texture) { button->background_hover = rut_nine_slice_new (ctx, button->hover_texture, 11, 5, 13, 5, button->width, button->height); } else { g_warning ("Failed to load button-hover texture: %s", error->message); g_error_free (error); } button->active_texture = rut_load_texture_from_data_file (ctx, "button-active.png", &error); if (button->active_texture) { button->background_active = rut_nine_slice_new (ctx, button->active_texture, 11, 5, 13, 5, button->width, button->height); } else { g_warning ("Failed to load button-active texture: %s", error->message); g_error_free (error); } button->disabled_texture = rut_load_texture_from_data_file (ctx, "button-disabled.png", &error); if (button->disabled_texture) { button->background_disabled = rut_nine_slice_new (ctx, button->disabled_texture, 11, 5, 13, 5, button->width, button->height); } else { g_warning ("Failed to load button-disabled texture: %s", error->message); g_error_free (error); } button->text = rut_text_new_with_text (ctx, NULL, label); button->text_transform = rut_transform_new (ctx); rut_graphable_add_child (button, button->text_transform); rut_graphable_add_child (button->text_transform, button->text); rut_sizable_get_size (button->text, &text_width, &text_height); button->width = text_width + BUTTON_HPAD; button->height = text_height + BUTTON_VPAD; cogl_color_init_from_4f (&button->text_color, 0, 0, 0, 1); button->input_region = rut_input_region_new_rectangle (0, 0, button->width, button->height, _rut_button_input_cb, button); //rut_input_region_set_graphable (button->input_region, button); rut_graphable_add_child (button, button->input_region); queue_allocation (button); return button; }