-
Notifications
You must be signed in to change notification settings - Fork 8
T23534: Rename project to libanimation #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0c3f272
54202d9
7a2c556
4ba6295
e453fa1
8860bae
7dae498
a49efa1
6344ca4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +0,0 @@ | ||
| [submodule "wobbly/third_party/allow_move_optional"] | ||
| path = wobbly/third_party/allow_move_optional | ||
| url = git://github.com/smspillaz/CopyMoveConstrainedOptional | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| # /animation-glib/meson.build | ||
| # | ||
| # Build the libanimation-glib library. | ||
| # | ||
| # Copyright (C) 2017, 2018 Endless Mobile, Inc. | ||
| # | ||
| # This program is free software; you can redistribute it and/or modify | ||
| # it under the terms of the GNU General Public License as published by | ||
| # the Free Software Foundation; either version 2 of the License, or | ||
| # (at your option) any later version. | ||
| # | ||
| # This program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License along | ||
| # with this program; if not, write to the Free Software Foundation, Inc., | ||
| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
|
|
||
| api_version = '0' | ||
|
|
||
| animation_glib_toplevel_headers = ['vector.h'] | ||
| animation_glib_toplevel_introspectable_sources = ['vector.cpp'] | ||
|
|
||
| animation_glib_introspectable_sources = [] | ||
| animation_glib_private_sources = [] | ||
| animation_glib_headers = [] | ||
| animation_glib_headers_subdir = 'animation-glib' | ||
|
|
||
| subdir('wobbly') | ||
|
|
||
| animation_glib_introspectable_sources += files(animation_glib_toplevel_introspectable_sources) | ||
| animation_glib_headers += files(animation_glib_toplevel_headers) | ||
|
|
||
| install_headers(animation_glib_toplevel_headers, subdir: animation_glib_headers_subdir) | ||
|
|
||
| animation_glib_sources = animation_glib_introspectable_sources + animation_glib_private_sources | ||
|
|
||
| glib = dependency('glib-2.0') | ||
| gobject = dependency('gobject-2.0') | ||
|
|
||
| animation_glib_lib = shared_library( | ||
| 'animation-glib', | ||
| animation_glib_sources, | ||
| soversion: api_version, | ||
| install: true, | ||
| include_directories: [ animation_inc ], | ||
| dependencies: [ glib, gobject, animation_dep ] | ||
| ) | ||
|
|
||
| animation_glib_dep = declare_dependency( | ||
| link_with: animation_glib_lib, | ||
| include_directories: [ animation_inc ], | ||
| ) | ||
|
|
||
| introspection_sources = [ animation_glib_introspectable_sources, animation_glib_headers ] | ||
|
|
||
| gnome = import('gnome') | ||
| gnome.generate_gir( | ||
| animation_glib_lib, | ||
| extra_args: ['--warn-all', '--warn-error'], | ||
| identifier_prefix: 'Animation', | ||
| include_directories: animation_inc, | ||
| includes: ['GLib-2.0', 'GObject-2.0'], | ||
| install: true, | ||
| namespace: 'Animation', | ||
| nsversion: api_version, | ||
| sources: introspection_sources, | ||
| symbol_prefix: 'animation' | ||
| ) | ||
|
|
||
| pkg = import('pkgconfig') | ||
| pkg.generate( | ||
| description: 'Library to provide 2D surface animations (GObject Binding)', | ||
| name: 'libanimation-glib', | ||
| filebase: 'libanimation-glib-' + api_version, | ||
| version: meson.project_version(), | ||
| libraries: animation_glib_lib, | ||
| install_dir: join_paths(get_option('libdir'), 'pkgconfig') | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| /* | ||
| * animation-glib/vector.h | ||
| * | ||
| * Copyright 2018 Endless Mobile, Inc. | ||
| * | ||
| * libanimation is free software: you can redistribute it and/or | ||
| * modify it under the terms of the GNU Lesser General Public License as | ||
| * published by the Free Software Foundation, either version 2.1 of the | ||
| * License, or (at your option) any later version. | ||
| * | ||
| * libanimation is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Lesser General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Lesser General Public | ||
| * License along with eos-companion-app-service. If not, see | ||
| * <http://www.gnu.org/licenses/>. | ||
| * | ||
| * GObject Interface for "wobbly" textures, 2D vector type. | ||
| */ | ||
| #pragma once | ||
|
|
||
| #include <glib-object.h> | ||
|
|
||
| G_BEGIN_DECLS | ||
|
|
||
| typedef struct { | ||
| double x; | ||
| double y; | ||
| } AnimationVector; | ||
|
|
||
| #define ANIMATION_TYPE_VECTOR animation_vector_get_type () | ||
|
|
||
| GType animation_vector_get_type (void); | ||
|
|
||
| G_END_DECLS |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| /* | ||
| * animation-glib/wobbly/anchor.cpp | ||
| * | ||
| * Copyright 2018 Endless Mobile, Inc. | ||
| * | ||
| * libanimation is free software: you can redistribute it and/or | ||
| * modify it under the terms of the GNU Lesser General Public License as | ||
| * published by the Free Software Foundation, either version 2.1 of the | ||
| * License, or (at your option) any later version. | ||
| * | ||
| * libanimation is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Lesser General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Lesser General Public | ||
| * License along with eos-companion-app-service. If not, see | ||
| * <http://www.gnu.org/licenses/>. | ||
| * | ||
| * GObject Interface for "wobbly" textures, Anchor | ||
| * type implementation. | ||
| */ | ||
|
|
||
| #include <animation-glib/wobbly/anchor.h> | ||
|
|
||
| #include <animation/wobbly/wobbly.h> | ||
|
|
||
| #include "wobbly-anchor-private.h" | ||
|
|
||
| struct _AnimationWobblyAnchor | ||
| { | ||
| GObject parent_instance; | ||
| }; | ||
|
|
||
| typedef struct _AnimationWobblyAnchorPrivate | ||
| { | ||
| wobbly::Anchor *anchor; | ||
| } AnimationWobblyAnchorPrivate; | ||
|
|
||
| G_DEFINE_TYPE_WITH_PRIVATE (AnimationWobblyAnchor, | ||
| animation_wobbly_anchor, | ||
| G_TYPE_OBJECT); | ||
|
|
||
| /** | ||
| * animation_wobbly_anchor_move_by: | ||
| * @anchor: A #AnimationWobblyAnchor | ||
| * @vector: A #AnimationVector to move the anchor by | ||
| * | ||
| * Move the anchor by @vector, causing force to be exerted | ||
| * on the underlying anchor's model. | ||
| */ | ||
| void | ||
| animation_wobbly_anchor_move_by (AnimationWobblyAnchor *anchor, | ||
| 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)); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * animation_wobbly_anchor_release: | ||
| * @anchor: A #AnimationWobblyAnchor | ||
| * | ||
| * Release the anchor, allowing the relevant control points | ||
| * to move freely and have force exerted on them. Attempting | ||
| * to move the anchor past this point is inert. | ||
| */ | ||
| void | ||
| animation_wobbly_anchor_release (AnimationWobblyAnchor *anchor) | ||
| { | ||
| AnimationWobblyAnchorPrivate *priv = | ||
| reinterpret_cast <AnimationWobblyAnchorPrivate *> (animation_wobbly_anchor_get_instance_private (anchor)); | ||
|
|
||
| if (priv->anchor != nullptr) | ||
| { | ||
| delete priv->anchor; | ||
| priv->anchor = nullptr; | ||
| } | ||
| } | ||
|
|
||
| static void | ||
| animation_wobbly_anchor_finalize (GObject *object) | ||
| { | ||
| AnimationWobblyAnchor *anchor = ANIMATION_WOBBLY_ANCHOR (object); | ||
|
|
||
| animation_wobbly_anchor_release (anchor); | ||
| } | ||
|
|
||
| static void | ||
| animation_wobbly_anchor_init (AnimationWobblyAnchor *store) | ||
| { | ||
| } | ||
|
|
||
|
|
||
| static void | ||
| animation_wobbly_anchor_class_init (AnimationWobblyAnchorClass *klass) | ||
| { | ||
| GObjectClass *object_class = G_OBJECT_CLASS (klass); | ||
|
|
||
| object_class->finalize = animation_wobbly_anchor_finalize; | ||
| } | ||
|
|
||
| AnimationWobblyAnchor * | ||
| animation_wobbly_anchor_new_for_native_anchor_rvalue (wobbly::Anchor &&anchor) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you really need to specify the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably not, though I guess I just wanted to make it clear that it wants an rvalue reference in case anyone was wondering why things might not compile when they pass it an lvalue :)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I left this as is for now |
||
| { | ||
| AnimationWobblyAnchor *anchor_object = | ||
| ANIMATION_WOBBLY_ANCHOR (g_object_new (ANIMATION_TYPE_WOBBLY_ANCHOR, NULL)); | ||
| AnimationWobblyAnchorPrivate *priv = | ||
| reinterpret_cast <AnimationWobblyAnchorPrivate *> (animation_wobbly_anchor_get_instance_private (anchor_object)); | ||
|
|
||
| priv->anchor = new wobbly::Anchor (std::move (anchor)); | ||
|
|
||
| return anchor_object; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /* | ||
| * animation-glib/wobbly/anchor.h | ||
| * | ||
| * Copyright 2018 Endless Mobile, Inc. | ||
| * | ||
| * libanimation is free software: you can redistribute it and/or | ||
| * modify it under the terms of the GNU Lesser General Public License as | ||
| * published by the Free Software Foundation, either version 2.1 of the | ||
| * License, or (at your option) any later version. | ||
| * | ||
| * libanimation is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Lesser General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Lesser General Public | ||
| * License along with eos-companion-app-service. If not, see | ||
| * <http://www.gnu.org/licenses/>. | ||
| * | ||
| * GObject Interface for "wobbly" textures, Anchor type. | ||
| * | ||
| * An anchor is an object type privately holding an | ||
| * anchor. The owner can release the anchor, which happens | ||
| * implicitly when its ref-count drops to zero or when | ||
| * the release() method is called. | ||
| */ | ||
| #pragma once | ||
|
|
||
| #include <glib-object.h> | ||
|
|
||
| #include <animation-glib/vector.h> | ||
|
|
||
| G_BEGIN_DECLS | ||
|
|
||
| #define ANIMATION_TYPE_WOBBLY_ANCHOR animation_wobbly_anchor_get_type () | ||
| G_DECLARE_FINAL_TYPE (AnimationWobblyAnchor, animation_wobbly_anchor, ANIMATION, WOBBLY_ANCHOR, GObject) | ||
|
|
||
| void animation_wobbly_anchor_move_by (AnimationWobblyAnchor *anchor, | ||
| AnimationVector vector); | ||
|
|
||
| void animation_wobbly_anchor_release (AnimationWobblyAnchor *anchor); | ||
|
|
||
| G_END_DECLS |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # /animation-glib/wobbly/meson.build | ||
| # | ||
| # Build the libanimation-glib library, wobbly component. | ||
| # | ||
| # See /LICENCE.md for Copyright information. | ||
|
|
||
| wobbly_introspectable_sources = [ | ||
| 'anchor.cpp', | ||
| 'model.cpp' | ||
| ] | ||
| wobbly_private_sources = ['wobbly-anchor-private.h'] | ||
| wobbly_headers = [ | ||
| 'anchor.h', | ||
| 'model.h' | ||
| ] | ||
|
|
||
| animation_glib_introspectable_sources += files(wobbly_introspectable_sources) | ||
| animation_glib_private_sources += files(wobbly_private_sources) | ||
| animation_glib_headers += files(wobbly_headers) | ||
|
|
||
| install_headers(wobbly_headers, subdir: join_paths(animation_glib_headers_subdir, 'wobbly')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should probably split out this change into a separate commit