Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions animation-glib/wobbly/anchor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ G_DEFINE_TYPE_WITH_PRIVATE (AnimationWobblyAnchor,
*/
void
animation_wobbly_anchor_move_by (AnimationWobblyAnchor *anchor,
AnimationVector vector)
AnimationVector *vector)
{
AnimationWobblyAnchorPrivate *priv =
reinterpret_cast <AnimationWobblyAnchorPrivate *> (animation_wobbly_anchor_get_instance_private (anchor));

if (priv->anchor != nullptr)
priv->anchor->MoveBy (animation::Point (vector.x, vector.y));
priv->anchor->MoveBy (animation::Point (vector->x, vector->y));
}


Expand Down
2 changes: 1 addition & 1 deletion animation-glib/wobbly/anchor.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (AnimationWobblyAnchor, animation_wobbly_anchor, ANIMATION, WOBBLY_ANCHOR, GObject)

void animation_wobbly_anchor_move_by (AnimationWobblyAnchor *anchor,
AnimationVector vector);
AnimationVector *vector);

void animation_wobbly_anchor_release (AnimationWobblyAnchor *anchor);

Expand Down
48 changes: 24 additions & 24 deletions animation-glib/wobbly/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ namespace agd = animation::geometry::dimension;
*/
AnimationWobblyAnchor *
animation_wobbly_model_grab_anchor (AnimationWobblyModel *model,
AnimationVector position)
AnimationVector *position)
{
AnimationWobblyModelPrivate *priv =
reinterpret_cast <AnimationWobblyModelPrivate *> (animation_wobbly_model_get_instance_private (model));
wobbly::Anchor anchor (priv->model->GrabAnchor (animation::Point (position.x,
position.y)));
wobbly::Anchor anchor (priv->model->GrabAnchor (animation::Point (position->x,
position->y)));

return animation_wobbly_anchor_new_for_native_anchor_rvalue (std::move (anchor));
}
Expand All @@ -111,12 +111,12 @@ animation_wobbly_model_grab_anchor (AnimationWobblyModel *model,
*/
AnimationWobblyAnchor *
animation_wobbly_model_insert_anchor (AnimationWobblyModel *model,
AnimationVector position)
AnimationVector *position)
{
AnimationWobblyModelPrivate *priv =
reinterpret_cast <AnimationWobblyModelPrivate *> (animation_wobbly_model_get_instance_private (model));
wobbly::Anchor anchor (priv->model->InsertAnchor (animation::Point (position.x,
position.y)));
wobbly::Anchor anchor (priv->model->InsertAnchor (animation::Point (position->x,
position->y)));

return animation_wobbly_anchor_new_for_native_anchor_rvalue (std::move (anchor));
}
Expand Down Expand Up @@ -155,15 +155,15 @@ animation_wobbly_model_step (AnimationWobblyModel *model,
*/
void
animation_wobbly_model_deform_texcoords (AnimationWobblyModel *model,
AnimationVector uv,
AnimationVector *uv,
AnimationVector *deformed)
{
AnimationWobblyModelPrivate *priv =
reinterpret_cast <AnimationWobblyModelPrivate *> (animation_wobbly_model_get_instance_private (model));

g_return_if_fail (deformed != NULL);

animation::Point deformed_point (priv->model->DeformTexcoords (animation::Point (uv.x, uv.y)));
animation::Point deformed_point (priv->model->DeformTexcoords (animation::Point (uv->x, uv->y)));
*deformed = {
animation::geometry::dimension::get <0> (deformed_point),
animation::geometry::dimension::get <1> (deformed_point)
Expand Down Expand Up @@ -217,15 +217,15 @@ animation_wobbly_model_query_extremes (AnimationWobblyModel *model,
*/
void
animation_wobbly_model_move_to (AnimationWobblyModel *model,
AnimationVector position)
AnimationVector *position)
{
AnimationWobblyModelPrivate *priv =
reinterpret_cast <AnimationWobblyModelPrivate *> (animation_wobbly_model_get_instance_private (model));

priv->prop_position = position;
priv->prop_position = {position->x, position->y};

if (priv->model != nullptr)
priv->model->MoveModelTo (animation::Point (position.x, position.y));
priv->model->MoveModelTo (animation::Point (position->x, position->y));
}

/**
Expand All @@ -237,16 +237,16 @@ animation_wobbly_model_move_to (AnimationWobblyModel *model,
*/
void
animation_wobbly_model_move_by (AnimationWobblyModel *model,
AnimationVector delta)
AnimationVector *delta)
{
AnimationWobblyModelPrivate *priv =
reinterpret_cast <AnimationWobblyModelPrivate *> (animation_wobbly_model_get_instance_private (model));

priv->prop_position.x += delta.x;
priv->prop_position.y += delta.y;
priv->prop_position.x += delta->x;
priv->prop_position.y += delta->y;

if (priv->model != nullptr)
priv->model->MoveModelBy (animation::Point (delta.x, delta.y));
priv->model->MoveModelBy (animation::Point (delta->x, delta->y));
}

/**
Expand All @@ -258,15 +258,15 @@ animation_wobbly_model_move_by (AnimationWobblyModel *model,
*/
void
animation_wobbly_model_resize (AnimationWobblyModel *model,
AnimationVector size)
AnimationVector *size)
{
AnimationWobblyModelPrivate *priv =
reinterpret_cast <AnimationWobblyModelPrivate *> (animation_wobbly_model_get_instance_private (model));

priv->prop_size = size;
priv->prop_size = {size->x, size->y};

if (priv->model != nullptr)
priv->model->ResizeModel (size.x, size.y);
priv->model->ResizeModel (size->x, size->y);
}

void
Expand Down Expand Up @@ -319,10 +319,10 @@ animation_wobbly_model_set_property (GObject *object,
animation_wobbly_model_set_maximum_range (model, g_value_get_double (value));
break;
case PROP_POSITION:
animation_wobbly_model_move_to (model, *(reinterpret_cast <AnimationVector *> (g_value_get_boxed (value))));
animation_wobbly_model_move_to (model, (reinterpret_cast <AnimationVector *> (g_value_get_boxed (value))));
break;
case PROP_SIZE:
animation_wobbly_model_resize (model, *(reinterpret_cast <AnimationVector *> (g_value_get_boxed (value))));
animation_wobbly_model_resize (model, (reinterpret_cast <AnimationVector *> (g_value_get_boxed (value))));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
Expand Down Expand Up @@ -445,8 +445,8 @@ animation_wobbly_model_class_init (AnimationWobblyModelClass *klass)
}

AnimationWobblyModel *
animation_wobbly_model_new (AnimationVector position,
AnimationVector size,
animation_wobbly_model_new (AnimationVector *position,
AnimationVector *size,
double spring_constant,
double friction,
double maximum_range)
Expand All @@ -455,7 +455,7 @@ animation_wobbly_model_new (AnimationVector position,
"spring-k", spring_constant,
"friction", friction,
"movement-range", maximum_range,
"position", &position,
"size", &size,
"position", position,
"size", size,
nullptr));
}
16 changes: 8 additions & 8 deletions animation-glib/wobbly/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ G_BEGIN_DECLS
#define ANIMATION_WOBBLY_TYPE_MODEL animation_wobbly_model_get_type ()
G_DECLARE_FINAL_TYPE (AnimationWobblyModel, animation_wobbly_model, ANIMATION, WOBBLY_MODEL, GObject)

AnimationWobblyModel * animation_wobbly_model_new (AnimationVector position,
AnimationVector size,
AnimationWobblyModel * animation_wobbly_model_new (AnimationVector *position,
AnimationVector *size,
double spring_constant,
double friction,
double maximum_range);

AnimationWobblyAnchor * animation_wobbly_model_grab_anchor (AnimationWobblyModel *model,
AnimationVector position);
AnimationVector *position);

AnimationWobblyAnchor * animation_wobbly_model_insert_anchor (AnimationWobblyModel *model,
AnimationVector position);
AnimationVector *position);

gboolean animation_wobbly_model_step (AnimationWobblyModel *model,
unsigned int ms);

void animation_wobbly_model_deform_texcoords (AnimationWobblyModel *model,
AnimationVector uv,
AnimationVector *uv,
AnimationVector *deformed);

void animation_wobbly_model_query_extremes (AnimationWobblyModel *model,
Expand All @@ -57,12 +57,12 @@ void animation_wobbly_model_query_extremes (AnimationWobblyModel *model,
AnimationVector *bottom_right);

void animation_wobbly_model_move_to (AnimationWobblyModel *model,
AnimationVector position);
AnimationVector *position);
void animation_wobbly_model_move_by (AnimationWobblyModel *model,
AnimationVector delta);
AnimationVector *delta);

void animation_wobbly_model_resize (AnimationWobblyModel *model,
AnimationVector size);
AnimationVector *size);

void animation_wobbly_model_set_spring_k (AnimationWobblyModel *model, double spring_constant);

Expand Down
Loading