mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 07:30:42 -05:00
clutter: remove deprecated ClutterStage/ClutterAnimator
Removing one without the other was quite the headache, so just remove both of them together instead.
This commit is contained in:
parent
156aa3dd99
commit
5f1410f968
@ -257,7 +257,6 @@ deprecated_h = \
|
||||
deprecated/clutter-alpha.h \
|
||||
deprecated/clutter-animatable.h \
|
||||
deprecated/clutter-animation.h \
|
||||
deprecated/clutter-animator.h \
|
||||
deprecated/clutter-backend.h \
|
||||
deprecated/clutter-behaviour.h \
|
||||
deprecated/clutter-behaviour-depth.h \
|
||||
@ -275,7 +274,6 @@ deprecated_h = \
|
||||
deprecated/clutter-rectangle.h \
|
||||
deprecated/clutter-stage-manager.h \
|
||||
deprecated/clutter-stage.h \
|
||||
deprecated/clutter-state.h \
|
||||
deprecated/clutter-texture.h \
|
||||
deprecated/clutter-timeline.h \
|
||||
deprecated/clutter-util.h \
|
||||
@ -286,7 +284,6 @@ deprecated_c = \
|
||||
deprecated/clutter-actor-deprecated.c \
|
||||
deprecated/clutter-alpha.c \
|
||||
deprecated/clutter-animation.c \
|
||||
deprecated/clutter-animator.c \
|
||||
deprecated/clutter-behaviour.c \
|
||||
deprecated/clutter-behaviour-depth.c \
|
||||
deprecated/clutter-behaviour-ellipse.c \
|
||||
@ -298,7 +295,6 @@ deprecated_c = \
|
||||
deprecated/clutter-input-device-deprecated.c \
|
||||
deprecated/clutter-layout-manager-deprecated.c \
|
||||
deprecated/clutter-rectangle.c \
|
||||
deprecated/clutter-state.c \
|
||||
deprecated/clutter-texture.c \
|
||||
$(NULL)
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include "deprecated/clutter-alpha.h"
|
||||
#include "deprecated/clutter-animatable.h"
|
||||
#include "deprecated/clutter-animation.h"
|
||||
#include "deprecated/clutter-animator.h"
|
||||
#include "deprecated/clutter-backend.h"
|
||||
#include "deprecated/clutter-behaviour.h"
|
||||
#include "deprecated/clutter-behaviour-depth.h"
|
||||
@ -25,7 +24,6 @@
|
||||
#include "deprecated/clutter-rectangle.h"
|
||||
#include "deprecated/clutter-stage-manager.h"
|
||||
#include "deprecated/clutter-stage.h"
|
||||
#include "deprecated/clutter-state.h"
|
||||
#include "deprecated/clutter-texture.h"
|
||||
#include "deprecated/clutter-timeline.h"
|
||||
#include "deprecated/clutter-util.h"
|
||||
|
@ -157,49 +157,6 @@
|
||||
* respectively) and the "object" string member for calling
|
||||
* g_signal_connect_object() instead of g_signal_connect().
|
||||
*
|
||||
* Signals can also be directly attached to a specific state defined
|
||||
* inside a #ClutterState instance, for instance:
|
||||
*
|
||||
* |[
|
||||
* ...
|
||||
* "signals" : [
|
||||
* {
|
||||
* "name" : "enter-event",
|
||||
* "states" : "button-states",
|
||||
* "target-state" : "hover"
|
||||
* },
|
||||
* {
|
||||
* "name" : "leave-event",
|
||||
* "states" : "button-states",
|
||||
* "target-state" : "base"
|
||||
* },
|
||||
* {
|
||||
* "name" : "button-press-event",
|
||||
* "states" : "button-states",
|
||||
* "target-state" : "active",
|
||||
* },
|
||||
* {
|
||||
* "name" : "key-press-event",
|
||||
* "states" : "button-states",
|
||||
* "target-state" : "key-focus",
|
||||
* "warp" : true
|
||||
* }
|
||||
* ],
|
||||
* ...
|
||||
* ]|
|
||||
*
|
||||
* The "states" key defines the #ClutterState instance to be used to
|
||||
* resolve the "target-state" key; it can be either a script id for a
|
||||
* #ClutterState built by the same #ClutterScript instance, or to a
|
||||
* #ClutterState built in code and associated to the #ClutterScript
|
||||
* instance through the clutter_script_add_states() function. If no
|
||||
* "states" key is present, then the default #ClutterState associated to
|
||||
* the #ClutterScript instance will be used; the default #ClutterState
|
||||
* can be set using clutter_script_add_states() using a %NULL name. The
|
||||
* "warp" key can be used to warp to a specific state instead of
|
||||
* animating to it. State changes on signal emission will not affect
|
||||
* the signal emission chain.
|
||||
*
|
||||
* Clutter reserves the following names, so classes defining properties
|
||||
* through the usual GObject registration process should avoid using these
|
||||
* names to avoid collisions:
|
||||
@ -248,7 +205,6 @@
|
||||
#include "deprecated/clutter-alpha.h"
|
||||
#include "deprecated/clutter-behaviour.h"
|
||||
#include "deprecated/clutter-container.h"
|
||||
#include "deprecated/clutter-state.h"
|
||||
|
||||
enum
|
||||
{
|
||||
@ -274,8 +230,6 @@ struct _ClutterScriptPrivate
|
||||
|
||||
ClutterScriptParser *parser;
|
||||
|
||||
GHashTable *states;
|
||||
|
||||
gchar **search_paths;
|
||||
|
||||
gchar *translation_domain;
|
||||
@ -328,7 +282,6 @@ signal_info_free (gpointer data)
|
||||
g_free (sinfo->name);
|
||||
g_free (sinfo->handler);
|
||||
g_free (sinfo->object);
|
||||
g_free (sinfo->state);
|
||||
g_free (sinfo->target);
|
||||
|
||||
g_slice_free (SignalInfo, sinfo);
|
||||
@ -386,7 +339,6 @@ clutter_script_finalize (GObject *gobject)
|
||||
g_hash_table_destroy (priv->objects);
|
||||
g_strfreev (priv->search_paths);
|
||||
g_free (priv->filename);
|
||||
g_hash_table_destroy (priv->states);
|
||||
g_free (priv->translation_domain);
|
||||
|
||||
G_OBJECT_CLASS (clutter_script_parent_class)->finalize (gobject);
|
||||
@ -521,9 +473,6 @@ clutter_script_init (ClutterScript *script)
|
||||
priv->objects = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
NULL,
|
||||
object_info_free);
|
||||
priv->states = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
g_free,
|
||||
(GDestroyNotify) g_object_unref);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1043,65 +992,12 @@ clutter_script_connect_signals (ClutterScript *script,
|
||||
g_free (cd);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
ClutterState *state;
|
||||
GObject *emitter;
|
||||
gchar *target;
|
||||
gulong signal_id;
|
||||
gulong hook_id;
|
||||
gboolean warp_to;
|
||||
} HookData;
|
||||
|
||||
typedef struct {
|
||||
ClutterScript *script;
|
||||
ClutterScriptConnectFunc func;
|
||||
gpointer user_data;
|
||||
} SignalConnectData;
|
||||
|
||||
static void
|
||||
hook_data_free (gpointer data)
|
||||
{
|
||||
if (G_LIKELY (data != NULL))
|
||||
{
|
||||
HookData *hook_data = data;
|
||||
|
||||
g_free (hook_data->target);
|
||||
g_slice_free (HookData, hook_data);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_script_state_change_hook (GSignalInvocationHint *ihint,
|
||||
guint n_params,
|
||||
const GValue *params,
|
||||
gpointer user_data)
|
||||
{
|
||||
HookData *hook_data = user_data;
|
||||
GObject *emitter;
|
||||
|
||||
emitter = g_value_get_object (¶ms[0]);
|
||||
|
||||
if (emitter == hook_data->emitter)
|
||||
{
|
||||
if (hook_data->warp_to)
|
||||
clutter_state_warp_to_state (hook_data->state, hook_data->target);
|
||||
else
|
||||
clutter_state_set_state (hook_data->state, hook_data->target);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_script_remove_state_change_hook (gpointer user_data,
|
||||
GObject *object_p)
|
||||
{
|
||||
HookData *hook_data = user_data;
|
||||
|
||||
g_signal_remove_emission_hook (hook_data->signal_id,
|
||||
hook_data->hook_id);
|
||||
}
|
||||
|
||||
static void
|
||||
connect_each_object (gpointer key,
|
||||
gpointer value,
|
||||
@ -1139,67 +1035,6 @@ connect_each_object (gpointer key,
|
||||
connect_data->user_data);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GObject *state_object = NULL;
|
||||
const gchar *signal_name, *signal_detail;
|
||||
gchar **components;
|
||||
GQuark signal_quark;
|
||||
guint signal_id;
|
||||
HookData *hook_data;
|
||||
|
||||
if (sinfo->state == NULL)
|
||||
state_object = (GObject *) clutter_script_get_states (script, NULL);
|
||||
else
|
||||
{
|
||||
state_object = clutter_script_get_object (script, sinfo->state);
|
||||
if (state_object == NULL)
|
||||
state_object = (GObject *) clutter_script_get_states (script, sinfo->state);
|
||||
}
|
||||
|
||||
if (state_object == NULL)
|
||||
continue;
|
||||
|
||||
components = g_strsplit (sinfo->name, "::", 2);
|
||||
if (g_strv_length (components) == 2)
|
||||
{
|
||||
signal_name = components[0];
|
||||
signal_detail = components[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
signal_name = components[0];
|
||||
signal_detail = NULL;
|
||||
}
|
||||
|
||||
signal_id = g_signal_lookup (signal_name, G_OBJECT_TYPE (object));
|
||||
if (signal_id == 0)
|
||||
{
|
||||
g_strfreev (components);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (signal_detail != NULL)
|
||||
signal_quark = g_quark_from_string (signal_detail);
|
||||
else
|
||||
signal_quark = 0;
|
||||
|
||||
hook_data = g_slice_new (HookData);
|
||||
hook_data->emitter = object;
|
||||
hook_data->state = CLUTTER_STATE (state_object);
|
||||
hook_data->target = g_strdup (sinfo->target);
|
||||
hook_data->warp_to = sinfo->warp_to;
|
||||
hook_data->signal_id = signal_id;
|
||||
hook_data->hook_id =
|
||||
g_signal_add_emission_hook (signal_id, signal_quark,
|
||||
clutter_script_state_change_hook,
|
||||
hook_data,
|
||||
hook_data_free);
|
||||
|
||||
g_object_weak_ref (hook_data->emitter,
|
||||
clutter_script_remove_state_change_hook,
|
||||
hook_data);
|
||||
}
|
||||
|
||||
signal_info_free (sinfo);
|
||||
}
|
||||
@ -1423,72 +1258,6 @@ clutter_script_list_objects (ClutterScript *script)
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_script_add_states:
|
||||
* @script: a #ClutterScript
|
||||
* @name: (allow-none): a name for the @state, or %NULL to
|
||||
* set the default #ClutterState
|
||||
* @state: a #ClutterState
|
||||
*
|
||||
* Associates a #ClutterState to the #ClutterScript instance using the given
|
||||
* name.
|
||||
*
|
||||
* The #ClutterScript instance will use @state to resolve target states when
|
||||
* connecting signal handlers.
|
||||
*
|
||||
* The #ClutterScript instance will take a reference on the #ClutterState
|
||||
* passed to this function.
|
||||
*
|
||||
* Since: 1.8
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
void
|
||||
clutter_script_add_states (ClutterScript *script,
|
||||
const gchar *name,
|
||||
ClutterState *state)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_SCRIPT (script));
|
||||
g_return_if_fail (CLUTTER_IS_STATE (state));
|
||||
|
||||
if (name == NULL || *name == '\0')
|
||||
name = "__clutter_script_default_state";
|
||||
|
||||
g_hash_table_replace (script->priv->states,
|
||||
g_strdup (name),
|
||||
g_object_ref (state));
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_script_get_states:
|
||||
* @script: a #ClutterScript
|
||||
* @name: (allow-none): the name of the #ClutterState, or %NULL
|
||||
*
|
||||
* Retrieves the #ClutterState for the given @state_name.
|
||||
*
|
||||
* If @name is %NULL, this function will return the default
|
||||
* #ClutterState instance.
|
||||
*
|
||||
* Return value: (transfer none): a pointer to the #ClutterState for the
|
||||
* given name. The #ClutterState is owned by the #ClutterScript instance
|
||||
* and it should not be unreferenced
|
||||
*
|
||||
* Since: 1.8
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
ClutterState *
|
||||
clutter_script_get_states (ClutterScript *script,
|
||||
const gchar *name)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), NULL);
|
||||
|
||||
if (name == NULL || *name == '\0')
|
||||
name = "__clutter_script_default_state";
|
||||
|
||||
return g_hash_table_lookup (script->priv->states, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_script_set_translation_domain:
|
||||
* @script: a #ClutterScript
|
||||
|
@ -178,15 +178,6 @@ void clutter_script_unmerge_objects (ClutterScript
|
||||
CLUTTER_EXPORT
|
||||
void clutter_script_ensure_objects (ClutterScript *script);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_script_add_states (ClutterScript *script,
|
||||
const gchar *name,
|
||||
ClutterState *state);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterState * clutter_script_get_states (ClutterScript *script,
|
||||
const gchar *name);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_script_connect_signals (ClutterScript *script,
|
||||
gpointer user_data);
|
||||
|
@ -24,7 +24,7 @@
|
||||
/**
|
||||
* SECTION:clutter-timeline
|
||||
* @short_description: A class for time-based events
|
||||
* @see_also: #ClutterAnimation, #ClutterAnimator, #ClutterState
|
||||
* @see_also: #ClutterAnimation
|
||||
*
|
||||
* #ClutterTimeline is a base class for managing time-based event that cause
|
||||
* Clutter to redraw a stage, such as animations.
|
||||
@ -71,7 +71,7 @@
|
||||
* when reaching completion by using the #ClutterTimeline:auto-reverse property.
|
||||
*
|
||||
* Timelines are used in the Clutter animation framework by classes like
|
||||
* #ClutterAnimation, #ClutterAnimator, and #ClutterState.
|
||||
* #ClutterAnimation.
|
||||
*
|
||||
* ## Defining Timelines in ClutterScript
|
||||
*
|
||||
|
@ -90,8 +90,6 @@ typedef struct _ClutterVertex ClutterVertex;
|
||||
|
||||
typedef struct _ClutterAlpha ClutterAlpha;
|
||||
typedef struct _ClutterAnimation ClutterAnimation;
|
||||
typedef struct _ClutterAnimator ClutterAnimator;
|
||||
typedef struct _ClutterState ClutterState;
|
||||
|
||||
typedef struct _ClutterInputDeviceTool ClutterInputDeviceTool;
|
||||
typedef struct _ClutterInputDevice ClutterInputDevice;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,188 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2010 Intel Corporation
|
||||
*
|
||||
* This library 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 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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 this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author:
|
||||
* Øyvind Kolås <pippin@linux.intel.com>
|
||||
*/
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __CLUTTER_ANIMATOR_H__
|
||||
#define __CLUTTER_ANIMATOR_H__
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
#include <clutter/clutter-timeline.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_ANIMATOR (clutter_animator_get_type ())
|
||||
#define CLUTTER_TYPE_ANIMATOR_KEY (clutter_animator_key_get_type ())
|
||||
|
||||
#define CLUTTER_ANIMATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ANIMATOR, ClutterAnimator))
|
||||
#define CLUTTER_ANIMATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ANIMATOR, ClutterAnimatorClass))
|
||||
#define CLUTTER_IS_ANIMATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ANIMATOR))
|
||||
#define CLUTTER_IS_ANIMATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ANIMATOR))
|
||||
#define CLUTTER_ANIMATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ANIMATOR, ClutterAnimatorClass))
|
||||
|
||||
/* ClutterAnimator is typedef in clutter-types.h */
|
||||
|
||||
typedef struct _ClutterAnimatorClass ClutterAnimatorClass;
|
||||
typedef struct _ClutterAnimatorPrivate ClutterAnimatorPrivate;
|
||||
|
||||
/**
|
||||
* ClutterAnimatorKey:
|
||||
*
|
||||
* A key frame inside a #ClutterAnimator
|
||||
*
|
||||
* Since: 1.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
typedef struct _ClutterAnimatorKey ClutterAnimatorKey;
|
||||
|
||||
/**
|
||||
* ClutterAnimator:
|
||||
*
|
||||
* The #ClutterAnimator structure contains only private data and
|
||||
* should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
struct _ClutterAnimator
|
||||
{
|
||||
/*< private >*/
|
||||
GObject parent_instance;
|
||||
|
||||
ClutterAnimatorPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterAnimatorClass:
|
||||
*
|
||||
* The #ClutterAnimatorClass structure contains only private data
|
||||
*
|
||||
* Since: 1.2
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
struct _ClutterAnimatorClass
|
||||
{
|
||||
/*< private >*/
|
||||
GObjectClass parent_class;
|
||||
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[16];
|
||||
};
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
GType clutter_animator_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterAnimator * clutter_animator_new (void);
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterAnimator * clutter_animator_set_key (ClutterAnimator *animator,
|
||||
GObject *object,
|
||||
const gchar *property_name,
|
||||
guint mode,
|
||||
gdouble progress,
|
||||
const GValue *value);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_animator_set (ClutterAnimator *animator,
|
||||
gpointer first_object,
|
||||
const gchar *first_property_name,
|
||||
guint first_mode,
|
||||
gdouble first_progress,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
CLUTTER_DEPRECATED
|
||||
GList * clutter_animator_get_keys (ClutterAnimator *animator,
|
||||
GObject *object,
|
||||
const gchar *property_name,
|
||||
gdouble progress);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_animator_remove_key (ClutterAnimator *animator,
|
||||
GObject *object,
|
||||
const gchar *property_name,
|
||||
gdouble progress);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterTimeline * clutter_animator_start (ClutterAnimator *animator);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
gboolean clutter_animator_compute_value (ClutterAnimator *animator,
|
||||
GObject *object,
|
||||
const gchar *property_name,
|
||||
gdouble progress,
|
||||
GValue *value);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterTimeline * clutter_animator_get_timeline (ClutterAnimator *animator);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_animator_set_timeline (ClutterAnimator *animator,
|
||||
ClutterTimeline *timeline);
|
||||
CLUTTER_DEPRECATED
|
||||
guint clutter_animator_get_duration (ClutterAnimator *animator);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_animator_set_duration (ClutterAnimator *animator,
|
||||
guint duration);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
gboolean clutter_animator_property_get_ease_in (ClutterAnimator *animator,
|
||||
GObject *object,
|
||||
const gchar *property_name);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_animator_property_set_ease_in (ClutterAnimator *animator,
|
||||
GObject *object,
|
||||
const gchar *property_name,
|
||||
gboolean ease_in);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterInterpolation clutter_animator_property_get_interpolation (ClutterAnimator *animator,
|
||||
GObject *object,
|
||||
const gchar *property_name);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_animator_property_set_interpolation (ClutterAnimator *animator,
|
||||
GObject *object,
|
||||
const gchar *property_name,
|
||||
ClutterInterpolation interpolation);
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
GType clutter_animator_key_get_type (void) G_GNUC_CONST;
|
||||
CLUTTER_DEPRECATED
|
||||
GObject * clutter_animator_key_get_object (const ClutterAnimatorKey *key);
|
||||
CLUTTER_DEPRECATED
|
||||
const gchar * clutter_animator_key_get_property_name (const ClutterAnimatorKey *key);
|
||||
CLUTTER_DEPRECATED
|
||||
GType clutter_animator_key_get_property_type (const ClutterAnimatorKey *key);
|
||||
CLUTTER_DEPRECATED
|
||||
gulong clutter_animator_key_get_mode (const ClutterAnimatorKey *key);
|
||||
CLUTTER_DEPRECATED
|
||||
gdouble clutter_animator_key_get_progress (const ClutterAnimatorKey *key);
|
||||
CLUTTER_DEPRECATED
|
||||
gboolean clutter_animator_key_get_value (const ClutterAnimatorKey *key,
|
||||
GValue *value);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_ANIMATOR_H__ */
|
@ -48,8 +48,7 @@
|
||||
* #ClutterBehaviourDepth is available since Clutter 0.4.
|
||||
*
|
||||
* Deprecated: 1.6: Use the #ClutterActor:depth property and
|
||||
* clutter_actor_animate(), or #ClutterAnimator, or #ClutterState
|
||||
* instead.
|
||||
* clutter_actor_animate() instead.
|
||||
*/
|
||||
|
||||
struct _ClutterBehaviourDepthPrivate
|
||||
|
@ -32,8 +32,7 @@
|
||||
* Since: 0.2
|
||||
*
|
||||
* Deprecated: 1.6: Use the #ClutterActor:opacity property and
|
||||
* clutter_actor_animate(), or #ClutterAnimator, or #ClutterState
|
||||
* instead.
|
||||
* clutter_actor_animate().
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
@ -31,8 +31,7 @@
|
||||
* The #ClutterBehaviourRotate is available since version 0.4.
|
||||
*
|
||||
* Deprecated: 1.6: Use the #ClutterActor rotation properties and
|
||||
* clutter_actor_animate(), or #ClutterAnimator, or #ClutterState
|
||||
* instead.
|
||||
* clutter_actor_animate() instead.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
@ -31,8 +31,7 @@
|
||||
* A #ClutterBehaviourScale interpolates actors size between two values.
|
||||
*
|
||||
* Deprecated: 1.6: Use the #ClutterActor:scale-x and #ClutterActor:scale-y
|
||||
* properties, and clutter_actor_animate(), or #ClutterAnimator or
|
||||
* #ClutterState instead.
|
||||
* properties, and clutter_actor_animate() instead.
|
||||
*/
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
@ -25,8 +25,7 @@
|
||||
* SECTION:clutter-behaviour
|
||||
* @Title: ClutterBehaviour
|
||||
* @short_description: Class for providing behaviours to actors
|
||||
* @Deprecated: 1.6: Use clutter_actor_animate(), #ClutterAnimator or
|
||||
* #ClutterState instead
|
||||
* @Deprecated: 1.6: Use clutter_actor_animate() instead
|
||||
*
|
||||
* #ClutterBehaviour is the base class for implementing behaviours. A
|
||||
* behaviour is a controller object for #ClutterActor<!-- -->s; you can
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,187 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Authored By Øyvind Kolås <pippin@linux.intel.com>
|
||||
*
|
||||
* Copyright (C) 2009 Intel Corporation
|
||||
*
|
||||
* This library 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 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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 this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __CLUTTER_STATE_H__
|
||||
#define __CLUTTER_STATE_H__
|
||||
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CLUTTER_TYPE_STATE_KEY (clutter_state_key_get_type ())
|
||||
#define CLUTTER_TYPE_STATE (clutter_state_get_type ())
|
||||
#define CLUTTER_STATE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_STATE, ClutterState))
|
||||
#define CLUTTER_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_STATE, ClutterStateClass))
|
||||
#define CLUTTER_IS_STATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_STATE))
|
||||
#define CLUTTER_IS_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_STATE))
|
||||
#define CLUTTER_STATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_STATE, ClutterStateClass))
|
||||
|
||||
typedef struct _ClutterStatePrivate ClutterStatePrivate;
|
||||
typedef struct _ClutterStateClass ClutterStateClass;
|
||||
|
||||
/**
|
||||
* ClutterStateKey:
|
||||
*
|
||||
* #ClutterStateKey is an opaque structure whose
|
||||
* members cannot be accessed directly
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
typedef struct _ClutterStateKey ClutterStateKey;
|
||||
|
||||
/**
|
||||
* ClutterState:
|
||||
*
|
||||
* The #ClutterState structure contains only
|
||||
* private data and should be accessed using the provided API
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
struct _ClutterState
|
||||
{
|
||||
/*< private >*/
|
||||
GObject parent;
|
||||
ClutterStatePrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* ClutterStateClass:
|
||||
* @completed: class handler for the #ClutterState::completed signal
|
||||
*
|
||||
* The #ClutterStateClass structure contains
|
||||
* only private data
|
||||
*
|
||||
* Since: 1.4
|
||||
*
|
||||
* Deprecated: 1.12
|
||||
*/
|
||||
struct _ClutterStateClass
|
||||
{
|
||||
/*< private >*/
|
||||
GObjectClass parent_class;
|
||||
|
||||
/*< public >*/
|
||||
void (* completed) (ClutterState *state);
|
||||
|
||||
/*< private >*/
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[8];
|
||||
};
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
GType clutter_state_get_type (void) G_GNUC_CONST;
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterState *clutter_state_new (void);
|
||||
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterTimeline * clutter_state_set_state (ClutterState *state,
|
||||
const gchar *target_state_name);
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterTimeline * clutter_state_warp_to_state (ClutterState *state,
|
||||
const gchar *target_state_name);
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterState * clutter_state_set_key (ClutterState *state,
|
||||
const gchar *source_state_name,
|
||||
const gchar *target_state_name,
|
||||
GObject *object,
|
||||
const gchar *property_name,
|
||||
guint mode,
|
||||
const GValue *value,
|
||||
gdouble pre_delay,
|
||||
gdouble post_delay);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_state_set_duration (ClutterState *state,
|
||||
const gchar *source_state_name,
|
||||
const gchar *target_state_name,
|
||||
guint duration);
|
||||
CLUTTER_DEPRECATED
|
||||
guint clutter_state_get_duration (ClutterState *state,
|
||||
const gchar *source_state_name,
|
||||
const gchar *target_state_name);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_state_set (ClutterState *state,
|
||||
const gchar *source_state_name,
|
||||
const gchar *target_state_name,
|
||||
gpointer first_object,
|
||||
const gchar *first_property_name,
|
||||
gulong first_mode,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
CLUTTER_DEPRECATED
|
||||
GList * clutter_state_get_states (ClutterState *state);
|
||||
CLUTTER_DEPRECATED
|
||||
GList * clutter_state_get_keys (ClutterState *state,
|
||||
const gchar *source_state_name,
|
||||
const gchar *target_state_name,
|
||||
GObject *object,
|
||||
const gchar *property_name);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_state_remove_key (ClutterState *state,
|
||||
const gchar *source_state_name,
|
||||
const gchar *target_state_name,
|
||||
GObject *object,
|
||||
const gchar *property_name);
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterTimeline * clutter_state_get_timeline (ClutterState *state);
|
||||
CLUTTER_DEPRECATED
|
||||
void clutter_state_set_animator (ClutterState *state,
|
||||
const gchar *source_state_name,
|
||||
const gchar *target_state_name,
|
||||
ClutterAnimator *animator);
|
||||
CLUTTER_DEPRECATED
|
||||
ClutterAnimator * clutter_state_get_animator (ClutterState *state,
|
||||
const gchar *source_state_name,
|
||||
const gchar *target_state_name);
|
||||
CLUTTER_DEPRECATED
|
||||
const gchar * clutter_state_get_state (ClutterState *state);
|
||||
|
||||
/*
|
||||
* ClutterStateKey
|
||||
*/
|
||||
|
||||
CLUTTER_DEPRECATED
|
||||
GType clutter_state_key_get_type (void) G_GNUC_CONST;
|
||||
CLUTTER_DEPRECATED
|
||||
gdouble clutter_state_key_get_pre_delay (const ClutterStateKey *state_key);
|
||||
CLUTTER_DEPRECATED
|
||||
gdouble clutter_state_key_get_post_delay (const ClutterStateKey *state_key);
|
||||
CLUTTER_DEPRECATED
|
||||
gulong clutter_state_key_get_mode (const ClutterStateKey *state_key);
|
||||
CLUTTER_DEPRECATED
|
||||
gboolean clutter_state_key_get_value (const ClutterStateKey *state_key,
|
||||
GValue *value);
|
||||
CLUTTER_DEPRECATED
|
||||
GType clutter_state_key_get_property_type (const ClutterStateKey *key);
|
||||
CLUTTER_DEPRECATED
|
||||
GObject * clutter_state_key_get_object (const ClutterStateKey *state_key);
|
||||
CLUTTER_DEPRECATED
|
||||
const gchar * clutter_state_key_get_property_name (const ClutterStateKey *state_key);
|
||||
CLUTTER_DEPRECATED
|
||||
const gchar * clutter_state_key_get_source_state_name (const ClutterStateKey *state_key);
|
||||
CLUTTER_DEPRECATED
|
||||
const gchar * clutter_state_key_get_target_state_name (const ClutterStateKey *state_key);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_STATE_H__ */
|
@ -217,7 +217,6 @@ clutter_deprecated_headers = [
|
||||
'deprecated/clutter-alpha.h',
|
||||
'deprecated/clutter-animatable.h',
|
||||
'deprecated/clutter-animation.h',
|
||||
'deprecated/clutter-animator.h',
|
||||
'deprecated/clutter-backend.h',
|
||||
'deprecated/clutter-behaviour.h',
|
||||
'deprecated/clutter-behaviour-depth.h',
|
||||
@ -235,7 +234,6 @@ clutter_deprecated_headers = [
|
||||
'deprecated/clutter-rectangle.h',
|
||||
'deprecated/clutter-stage-manager.h',
|
||||
'deprecated/clutter-stage.h',
|
||||
'deprecated/clutter-state.h',
|
||||
'deprecated/clutter-texture.h',
|
||||
'deprecated/clutter-timeline.h',
|
||||
'deprecated/clutter-util.h',
|
||||
@ -245,7 +243,6 @@ clutter_deprecated_sources = [
|
||||
'deprecated/clutter-actor-deprecated.c',
|
||||
'deprecated/clutter-alpha.c',
|
||||
'deprecated/clutter-animation.c',
|
||||
'deprecated/clutter-animator.c',
|
||||
'deprecated/clutter-behaviour.c',
|
||||
'deprecated/clutter-behaviour-depth.c',
|
||||
'deprecated/clutter-behaviour-ellipse.c',
|
||||
@ -257,7 +254,6 @@ clutter_deprecated_sources = [
|
||||
'deprecated/clutter-input-device-deprecated.c',
|
||||
'deprecated/clutter-layout-manager-deprecated.c',
|
||||
'deprecated/clutter-rectangle.c',
|
||||
'deprecated/clutter-state.c',
|
||||
'deprecated/clutter-texture.c',
|
||||
]
|
||||
|
||||
|
@ -49,7 +49,6 @@ general_tests = \
|
||||
|
||||
# Test for deprecated functionality
|
||||
deprecated_tests = \
|
||||
animator \
|
||||
behaviours \
|
||||
group \
|
||||
rectangle \
|
||||
@ -61,9 +60,6 @@ test_programs = $(actor_tests) $(general_tests) $(classes_tests) $(deprecated_te
|
||||
dist_test_data = $(script_ui_files)
|
||||
script_ui_files = $(addprefix scripts/,$(script_tests))
|
||||
script_tests = \
|
||||
test-animator-1.json \
|
||||
test-animator-2.json \
|
||||
test-animator-3.json \
|
||||
test-script-animation.json \
|
||||
test-script-child.json \
|
||||
test-script-implicit-alpha.json \
|
||||
@ -74,8 +70,7 @@ script_tests = \
|
||||
test-script-named-object.json \
|
||||
test-script-object-property.json \
|
||||
test-script-single.json \
|
||||
test-script-timeline-markers.json \
|
||||
test-state-1.json
|
||||
test-script-timeline-markers.json
|
||||
|
||||
TESTS_ENVIRONMENT += G_ENABLE_DIAGNOSTIC=0 CLUTTER_ENABLE_DIAGNOSTIC=0 CLUTTER_SCALE=1
|
||||
|
||||
|
@ -1,199 +0,0 @@
|
||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
static void
|
||||
animator_multi_properties (void)
|
||||
{
|
||||
ClutterScript *script = clutter_script_new ();
|
||||
GObject *animator = NULL, *foo = NULL;
|
||||
GError *error = NULL;
|
||||
gchar *test_file;
|
||||
GList *keys;
|
||||
ClutterAnimatorKey *key;
|
||||
GValue value = { 0, };
|
||||
|
||||
test_file = g_test_build_filename (G_TEST_DIST,
|
||||
"scripts",
|
||||
"test-animator-3.json",
|
||||
NULL);
|
||||
clutter_script_load_from_file (script, test_file, &error);
|
||||
if (g_test_verbose () && error)
|
||||
g_print ("Error: %s", error->message);
|
||||
|
||||
g_assert_no_error (error);
|
||||
|
||||
foo = clutter_script_get_object (script, "foo");
|
||||
g_assert (G_IS_OBJECT (foo));
|
||||
|
||||
animator = clutter_script_get_object (script, "animator");
|
||||
g_assert (CLUTTER_IS_ANIMATOR (animator));
|
||||
|
||||
/* get all the keys for foo:x */
|
||||
keys = clutter_animator_get_keys (CLUTTER_ANIMATOR (animator),
|
||||
foo, "x",
|
||||
-1.0);
|
||||
g_assert_cmpint (g_list_length (keys), ==, 3);
|
||||
|
||||
key = g_list_nth_data (keys, 1);
|
||||
g_assert (key != NULL);
|
||||
|
||||
if (g_test_verbose ())
|
||||
{
|
||||
g_print ("(foo, x).keys[1] = \n"
|
||||
".object = %s\n"
|
||||
".progress = %.2f\n"
|
||||
".name = '%s'\n"
|
||||
".type = '%s'\n",
|
||||
clutter_get_script_id (clutter_animator_key_get_object (key)),
|
||||
clutter_animator_key_get_progress (key),
|
||||
clutter_animator_key_get_property_name (key),
|
||||
g_type_name (clutter_animator_key_get_property_type (key)));
|
||||
}
|
||||
|
||||
g_assert (clutter_animator_key_get_object (key) != NULL);
|
||||
g_assert_cmpfloat (clutter_animator_key_get_progress (key), ==, 0.2);
|
||||
g_assert_cmpstr (clutter_animator_key_get_property_name (key), ==, "x");
|
||||
|
||||
g_assert (clutter_animator_key_get_property_type (key) == G_TYPE_FLOAT);
|
||||
|
||||
g_value_init (&value, G_TYPE_FLOAT);
|
||||
g_assert (clutter_animator_key_get_value (key, &value));
|
||||
g_assert_cmpfloat (g_value_get_float (&value), ==, 150.0);
|
||||
g_value_unset (&value);
|
||||
|
||||
g_list_free (keys);
|
||||
|
||||
/* get all the keys for foo:y */
|
||||
keys = clutter_animator_get_keys (CLUTTER_ANIMATOR (animator),
|
||||
foo, "y",
|
||||
-1.0);
|
||||
g_assert_cmpint (g_list_length (keys), ==, 3);
|
||||
|
||||
key = g_list_nth_data (keys, 2);
|
||||
g_assert (key != NULL);
|
||||
|
||||
if (g_test_verbose ())
|
||||
{
|
||||
g_print ("(foo, y).keys[2] = \n"
|
||||
".object = %s\n"
|
||||
".progress = %.2f\n"
|
||||
".name = '%s'\n"
|
||||
".type = '%s'\n",
|
||||
clutter_get_script_id (clutter_animator_key_get_object (key)),
|
||||
clutter_animator_key_get_progress (key),
|
||||
clutter_animator_key_get_property_name (key),
|
||||
g_type_name (clutter_animator_key_get_property_type (key)));
|
||||
}
|
||||
|
||||
g_assert (clutter_animator_key_get_object (key) != NULL);
|
||||
g_assert_cmpfloat (clutter_animator_key_get_progress (key), ==, 0.8);
|
||||
g_assert_cmpstr (clutter_animator_key_get_property_name (key), ==, "y");
|
||||
|
||||
g_assert (clutter_animator_key_get_property_type (key) == G_TYPE_FLOAT);
|
||||
|
||||
g_value_init (&value, G_TYPE_FLOAT);
|
||||
g_assert (clutter_animator_key_get_value (key, &value));
|
||||
g_assert_cmpfloat (g_value_get_float (&value), ==, 200.0);
|
||||
g_value_unset (&value);
|
||||
|
||||
g_list_free (keys);
|
||||
|
||||
g_object_unref (script);
|
||||
g_free (test_file);
|
||||
}
|
||||
|
||||
static void
|
||||
animator_properties (void)
|
||||
{
|
||||
ClutterScript *script = clutter_script_new ();
|
||||
GObject *animator = NULL;
|
||||
GError *error = NULL;
|
||||
gchar *test_file;
|
||||
GList *keys;
|
||||
ClutterAnimatorKey *key;
|
||||
GValue value = { 0, };
|
||||
|
||||
test_file = g_test_build_filename (G_TEST_DIST,
|
||||
"scripts",
|
||||
"test-animator-2.json",
|
||||
NULL);
|
||||
clutter_script_load_from_file (script, test_file, &error);
|
||||
if (g_test_verbose () && error)
|
||||
g_print ("Error: %s", error->message);
|
||||
|
||||
g_assert_no_error (error);
|
||||
|
||||
animator = clutter_script_get_object (script, "animator");
|
||||
g_assert (CLUTTER_IS_ANIMATOR (animator));
|
||||
|
||||
/* get all the keys */
|
||||
keys = clutter_animator_get_keys (CLUTTER_ANIMATOR (animator),
|
||||
NULL, NULL, -1.0);
|
||||
g_assert_cmpint (g_list_length (keys), ==, 3);
|
||||
|
||||
key = g_list_nth_data (keys, 1);
|
||||
g_assert (key != NULL);
|
||||
|
||||
if (g_test_verbose ())
|
||||
{
|
||||
g_print ("keys[1] = \n"
|
||||
".object = %s\n"
|
||||
".progress = %.2f\n"
|
||||
".name = '%s'\n"
|
||||
".type = '%s'\n",
|
||||
clutter_get_script_id (clutter_animator_key_get_object (key)),
|
||||
clutter_animator_key_get_progress (key),
|
||||
clutter_animator_key_get_property_name (key),
|
||||
g_type_name (clutter_animator_key_get_property_type (key)));
|
||||
}
|
||||
|
||||
g_assert (clutter_animator_key_get_object (key) != NULL);
|
||||
g_assert_cmpfloat (clutter_animator_key_get_progress (key), ==, 0.2);
|
||||
g_assert_cmpstr (clutter_animator_key_get_property_name (key), ==, "x");
|
||||
|
||||
g_assert (clutter_animator_key_get_property_type (key) == G_TYPE_FLOAT);
|
||||
|
||||
g_value_init (&value, G_TYPE_FLOAT);
|
||||
g_assert (clutter_animator_key_get_value (key, &value));
|
||||
g_assert_cmpfloat (g_value_get_float (&value), ==, 150.0);
|
||||
g_value_unset (&value);
|
||||
|
||||
g_list_free (keys);
|
||||
g_object_unref (script);
|
||||
g_free (test_file);
|
||||
}
|
||||
|
||||
static void
|
||||
animator_base (void)
|
||||
{
|
||||
ClutterScript *script = clutter_script_new ();
|
||||
GObject *animator = NULL;
|
||||
GError *error = NULL;
|
||||
guint duration = 0;
|
||||
gchar *test_file;
|
||||
|
||||
test_file = g_test_build_filename (G_TEST_DIST,
|
||||
"scripts",
|
||||
"test-animator-1.json",
|
||||
NULL);
|
||||
clutter_script_load_from_file (script, test_file, &error);
|
||||
if (g_test_verbose () && error)
|
||||
g_print ("Error: %s", error->message);
|
||||
|
||||
g_assert_no_error (error);
|
||||
|
||||
animator = clutter_script_get_object (script, "animator");
|
||||
g_assert (CLUTTER_IS_ANIMATOR (animator));
|
||||
|
||||
duration = clutter_animator_get_duration (CLUTTER_ANIMATOR (animator));
|
||||
g_assert_cmpint (duration, ==, 1000);
|
||||
|
||||
g_object_unref (script);
|
||||
g_free (test_file);
|
||||
}
|
||||
|
||||
CLUTTER_TEST_SUITE (
|
||||
CLUTTER_TEST_UNIT ("/script/animator/base", animator_base)
|
||||
CLUTTER_TEST_UNIT ("/script/animator/properties", animator_properties)
|
||||
CLUTTER_TEST_UNIT ("/script/animator/multi-properties", animator_multi_properties)
|
||||
)
|
@ -40,7 +40,6 @@ clutter_conform_tests_general_tests = [
|
||||
]
|
||||
|
||||
clutter_conform_tests_deprecated_tests = [
|
||||
'animator',
|
||||
'behaviours',
|
||||
'rectangle',
|
||||
'texture',
|
||||
|
@ -1,5 +0,0 @@
|
||||
{
|
||||
"type" : "ClutterAnimator",
|
||||
"id" : "animator",
|
||||
"duration" : 1000
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
[
|
||||
{
|
||||
"type" : "ClutterRectangle",
|
||||
"id" : "foo",
|
||||
"x" : 0,
|
||||
"y" : 0,
|
||||
"width" : 100,
|
||||
"height" : 100
|
||||
},
|
||||
{
|
||||
"type" : "ClutterAnimator",
|
||||
"id" : "animator",
|
||||
"duration" : 1000,
|
||||
|
||||
"properties" : [
|
||||
{
|
||||
"object" : "foo",
|
||||
"name" : "x",
|
||||
"ease-in" : true,
|
||||
"interpolation" : "linear",
|
||||
"keys" : [
|
||||
[ 0.0, "easeInCubic", 100.0 ],
|
||||
[ 0.2, "easeOutCubic", 150.0 ],
|
||||
[ 0.8, "linear", 200.0 ]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
@ -1,40 +0,0 @@
|
||||
[
|
||||
{
|
||||
"type" : "ClutterRectangle",
|
||||
"id" : "foo",
|
||||
"x" : 0,
|
||||
"y" : 0,
|
||||
"width" : 100,
|
||||
"height" : 100
|
||||
},
|
||||
{
|
||||
"type" : "ClutterAnimator",
|
||||
"id" : "animator",
|
||||
"duration" : 1000,
|
||||
|
||||
"properties" : [
|
||||
{
|
||||
"object" : "foo",
|
||||
"name" : "x",
|
||||
"ease-in" : true,
|
||||
"interpolation" : "linear",
|
||||
"keys" : [
|
||||
[ 0.0, "easeInCubic", 100.0 ],
|
||||
[ 0.2, "easeOutCubic", 150.0 ],
|
||||
[ 0.8, "linear", 200.0 ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"object" : "foo",
|
||||
"name" : "y",
|
||||
"ease-in" : true,
|
||||
"interpolation" : "linear",
|
||||
"keys" : [
|
||||
[ 0.0, "easeInCubic", 100.0 ],
|
||||
[ 0.2, "easeOutCubic", 150.0 ],
|
||||
[ 0.8, "linear", 200.0 ]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
@ -1,33 +0,0 @@
|
||||
[
|
||||
{
|
||||
"type" : "ClutterRectangle",
|
||||
"id" : "rect",
|
||||
"width" : 100,
|
||||
"height" : 100
|
||||
},
|
||||
{
|
||||
"type" : "ClutterState",
|
||||
"id" : "state",
|
||||
|
||||
"transitions" : [
|
||||
{
|
||||
"source" : "base",
|
||||
"target" : "clicked",
|
||||
"duration" : 250,
|
||||
|
||||
"keys" : [
|
||||
[ "rect", "opacity", "linear", 128 ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"source" : "clicked",
|
||||
"target" : "base",
|
||||
"duration" : 150,
|
||||
|
||||
"keys" : [
|
||||
[ "rect", "opacity", "linear", 255 ]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
@ -1,87 +0,0 @@
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#include "test-conform-common.h"
|
||||
|
||||
void
|
||||
state_base (TestConformSimpleFixture *fixture G_GNUC_UNUSED,
|
||||
gconstpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterScript *script = clutter_script_new ();
|
||||
GObject *state = NULL;
|
||||
GError *error = NULL;
|
||||
gchar *test_file;
|
||||
GList *states, *keys;
|
||||
ClutterStateKey *state_key;
|
||||
guint duration;
|
||||
|
||||
test_file = clutter_test_get_data_file ("test-state-1.json");
|
||||
clutter_script_load_from_file (script, test_file, &error);
|
||||
if (g_test_verbose () && error)
|
||||
g_print ("Error: %s\n", error->message);
|
||||
|
||||
g_free (test_file);
|
||||
|
||||
#if GLIB_CHECK_VERSION (2, 20, 0)
|
||||
g_assert_no_error (error);
|
||||
#else
|
||||
g_assert (error == NULL);
|
||||
#endif
|
||||
|
||||
state = clutter_script_get_object (script, "state");
|
||||
g_assert (CLUTTER_IS_STATE (state));
|
||||
|
||||
states = clutter_state_get_states (CLUTTER_STATE (state));
|
||||
g_assert (states != NULL);
|
||||
|
||||
g_assert (g_list_find (states, g_intern_static_string ("clicked")));
|
||||
g_list_free (states);
|
||||
|
||||
duration = clutter_state_get_duration (CLUTTER_STATE (state), "base", "clicked");
|
||||
g_assert_cmpint (duration, ==, 250);
|
||||
|
||||
duration = clutter_state_get_duration (CLUTTER_STATE (state), "clicked", "base");
|
||||
g_assert_cmpint (duration, ==, 150);
|
||||
|
||||
keys = clutter_state_get_keys (CLUTTER_STATE (state), "base", "clicked",
|
||||
clutter_script_get_object (script, "rect"),
|
||||
"opacity");
|
||||
|
||||
g_assert (keys != NULL);
|
||||
g_assert_cmpint (g_list_length (keys), ==, 1);
|
||||
|
||||
state_key = keys->data;
|
||||
g_assert (clutter_state_key_get_object (state_key) == clutter_script_get_object (script, "rect"));
|
||||
g_assert (clutter_state_key_get_mode (state_key) == CLUTTER_LINEAR);
|
||||
g_assert_cmpstr (clutter_state_key_get_property_name (state_key), ==, "opacity");
|
||||
|
||||
g_list_free (keys);
|
||||
keys = clutter_state_get_keys (CLUTTER_STATE (state), NULL, NULL, NULL, NULL);
|
||||
g_assert_cmpint (g_list_length (keys), ==, 2);
|
||||
g_list_free (keys);
|
||||
|
||||
|
||||
|
||||
clutter_state_set (CLUTTER_STATE (state), "base", "clicked", state, "state", CLUTTER_LINEAR, "foo", NULL);
|
||||
|
||||
keys = clutter_state_get_keys (CLUTTER_STATE (state), "base", "clicked",
|
||||
NULL, NULL);
|
||||
|
||||
g_assert (keys != NULL);
|
||||
g_assert_cmpint (g_list_length (keys), ==, 2);
|
||||
g_list_free (keys);
|
||||
|
||||
states = clutter_state_get_states (CLUTTER_STATE (state));
|
||||
g_assert_cmpint (g_list_length (states), ==, 2);
|
||||
g_list_free (states);
|
||||
|
||||
clutter_state_remove_key (CLUTTER_STATE (state), NULL, "clicked", NULL, NULL);
|
||||
states = clutter_state_get_states (CLUTTER_STATE (state));
|
||||
|
||||
/* removing the "clicked" state, will also cause the "base" state to be removed
|
||||
* since in the .json there is no default source state
|
||||
*/
|
||||
g_assert_cmpint (g_list_length (states), ==, 0);
|
||||
g_list_free (states);
|
||||
|
||||
g_object_unref (script);
|
||||
}
|
@ -9,9 +9,6 @@ UNIT_TESTS = \
|
||||
test-script.c \
|
||||
test-grab.c \
|
||||
test-cogl-shader-glsl.c \
|
||||
test-animator.c \
|
||||
test-state.c \
|
||||
test-state-animator.c \
|
||||
test-fbo.c \
|
||||
test-multistage.c \
|
||||
test-cogl-tex-tile.c \
|
||||
@ -37,7 +34,6 @@ UNIT_TESTS = \
|
||||
test-swipe-action.c \
|
||||
test-cogl-point-sprites.c \
|
||||
test-path-constraint.c \
|
||||
test-state-script.c \
|
||||
test-devices.c \
|
||||
test-content.c \
|
||||
test-keyframe-transition.c \
|
||||
|
@ -27,9 +27,6 @@ clutter_tests_interactive_test_sources = [
|
||||
'test-script.c',
|
||||
'test-grab.c',
|
||||
'test-cogl-shader-glsl.c',
|
||||
'test-animator.c',
|
||||
'test-state.c',
|
||||
'test-state-animator.c',
|
||||
'test-fbo.c',
|
||||
'test-multistage.c',
|
||||
'test-cogl-tex-tile.c',
|
||||
@ -55,7 +52,6 @@ clutter_tests_interactive_test_sources = [
|
||||
'test-swipe-action.c',
|
||||
'test-cogl-point-sprites.c',
|
||||
'test-path-constraint.c',
|
||||
'test-state-script.c',
|
||||
'test-devices.c',
|
||||
'test-content.c',
|
||||
'test-keyframe-transition.c',
|
||||
|
@ -1,138 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <gmodule.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
static ClutterAnimator *animator;
|
||||
|
||||
static ClutterActor *new_rect (gint r,
|
||||
gint g,
|
||||
gint b,
|
||||
gint a)
|
||||
{
|
||||
GError *error = NULL;
|
||||
ClutterColor *color = clutter_color_new (r, g, b, a);
|
||||
ClutterActor *rectangle;
|
||||
|
||||
gchar *file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
|
||||
rectangle = clutter_texture_new_from_file (file, &error);
|
||||
if (rectangle == NULL)
|
||||
g_error ("image load failed: %s", error->message);
|
||||
g_free (file);
|
||||
|
||||
clutter_actor_set_size (rectangle, 128, 128);
|
||||
clutter_color_free (color);
|
||||
return rectangle;
|
||||
}
|
||||
|
||||
static gboolean nuke_one (gpointer actor)
|
||||
{
|
||||
clutter_actor_destroy (actor);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#define COUNT 4
|
||||
|
||||
static void reverse_timeline (ClutterTimeline *timeline,
|
||||
gpointer data)
|
||||
{
|
||||
ClutterTimelineDirection direction = clutter_timeline_get_direction (timeline);
|
||||
if (direction == CLUTTER_TIMELINE_FORWARD)
|
||||
clutter_timeline_set_direction (timeline, CLUTTER_TIMELINE_BACKWARD);
|
||||
else
|
||||
clutter_timeline_set_direction (timeline, CLUTTER_TIMELINE_FORWARD);
|
||||
clutter_timeline_start (timeline);
|
||||
}
|
||||
|
||||
|
||||
G_MODULE_EXPORT gint
|
||||
test_animator_main (gint argc,
|
||||
gchar **argv)
|
||||
{
|
||||
ClutterActor *stage;
|
||||
ClutterActor *rects[COUNT];
|
||||
gint i;
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "Animator");
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
for (i = 0; i < COUNT; i++)
|
||||
{
|
||||
rects[i] = new_rect (255 * (i * 1.0 / COUNT), 50, 160, 255);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rects[i]);
|
||||
clutter_actor_set_anchor_point (rects[i], 64, 64);
|
||||
clutter_actor_set_position (rects[i], 320.0, 240.0);
|
||||
clutter_actor_set_opacity (rects[i], 0x70);
|
||||
}
|
||||
|
||||
clutter_threads_add_timeout (10000, nuke_one, rects[2]);
|
||||
|
||||
animator = clutter_animator_new ();
|
||||
|
||||
/* Note: when both animations are active for the same actor at the same
|
||||
* time there is a race, such races should be handled by avoiding
|
||||
* controlling the same properties from multiple animations. This is
|
||||
* an intentional design flaw of this test for testing the corner case.
|
||||
*/
|
||||
|
||||
clutter_animator_set (animator,
|
||||
rects[0], "x", 1, 0.0, 180.0,
|
||||
rects[0], "x", CLUTTER_LINEAR, 0.25, 450.0,
|
||||
rects[0], "x", CLUTTER_LINEAR, 0.5, 450.0,
|
||||
rects[0], "x", CLUTTER_LINEAR, 0.75, 180.0,
|
||||
rects[0], "x", CLUTTER_LINEAR, 1.0, 180.0,
|
||||
|
||||
rects[0], "y", -1, 0.0, 100.0,
|
||||
rects[0], "y", CLUTTER_LINEAR, 0.25, 100.0,
|
||||
rects[0], "y", CLUTTER_LINEAR, 0.5, 380.0,
|
||||
rects[0], "y", CLUTTER_LINEAR, 0.75, 380.0,
|
||||
rects[0], "y", CLUTTER_LINEAR, 1.0, 100.0,
|
||||
|
||||
rects[3], "x", 0, 0.0, 180.0,
|
||||
rects[3], "x", CLUTTER_LINEAR, 0.25, 180.0,
|
||||
rects[3], "x", CLUTTER_LINEAR, 0.5, 450.0,
|
||||
rects[3], "x", CLUTTER_LINEAR, 0.75, 450.0,
|
||||
rects[3], "x", CLUTTER_LINEAR, 1.0, 180.0,
|
||||
|
||||
rects[3], "y", 0, 0.0, 100.0,
|
||||
rects[3], "y", CLUTTER_LINEAR, 0.25, 380.0,
|
||||
rects[3], "y", CLUTTER_LINEAR, 0.5, 380.0,
|
||||
rects[3], "y", CLUTTER_LINEAR, 0.75, 100.0,
|
||||
rects[3], "y", CLUTTER_LINEAR, 1.0, 100.0,
|
||||
|
||||
|
||||
rects[2], "rotation-angle-y", 0, 0.0, 0.0,
|
||||
rects[2], "rotation-angle-y", CLUTTER_LINEAR, 1.0, 360.0,
|
||||
|
||||
rects[1], "scale-x", 0, 0.0, 1.0,
|
||||
rects[1], "scale-x", CLUTTER_LINEAR, 1.0, 2.0,
|
||||
rects[1], "scale-y", 0, 0.0, 1.0,
|
||||
rects[1], "scale-y", CLUTTER_LINEAR, 1.0, 2.0,
|
||||
NULL);
|
||||
|
||||
|
||||
clutter_actor_set_scale (rects[0], 1.4, 1.4);
|
||||
clutter_animator_property_set_ease_in (animator, G_OBJECT (rects[0]), "x",
|
||||
TRUE);
|
||||
clutter_animator_property_set_ease_in (animator, G_OBJECT (rects[0]), "y",
|
||||
TRUE);
|
||||
clutter_animator_property_set_interpolation (animator, G_OBJECT (rects[0]),
|
||||
"x", CLUTTER_INTERPOLATION_CUBIC);
|
||||
clutter_animator_property_set_interpolation (animator, G_OBJECT (rects[0]),
|
||||
"y", CLUTTER_INTERPOLATION_CUBIC);
|
||||
|
||||
clutter_stage_hide_cursor(CLUTTER_STAGE (stage));
|
||||
clutter_actor_show (stage);
|
||||
clutter_animator_set_duration (animator, 5000);
|
||||
|
||||
g_signal_connect (clutter_animator_start (animator),
|
||||
"completed", G_CALLBACK (reverse_timeline), NULL);
|
||||
clutter_main ();
|
||||
|
||||
g_object_unref (animator);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
[
|
||||
{
|
||||
"id" : "button",
|
||||
"type" : "ClutterRectangle",
|
||||
|
||||
"width" : "16 em",
|
||||
"height" : "6 em",
|
||||
|
||||
"color" : "rgb(255, 0, 0)",
|
||||
"opacity" : 128,
|
||||
|
||||
"scale-gravity" : "center",
|
||||
|
||||
"reactive" : true,
|
||||
|
||||
"signals" : [
|
||||
{
|
||||
"name" : "button-press-event",
|
||||
"handler" : "on_button_press"
|
||||
},
|
||||
{ "name" : "enter-event", "states" : "button-states", "target-state" : "hover" },
|
||||
{ "name" : "leave-event", "states" : "button-states", "target-state" : "base" },
|
||||
{ "name" : "button-press-event", "states" : "button-states", "target-state" : "active" },
|
||||
{ "name" : "button-release-event", "states" : "button-states", "target-state" : "hover" }
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"id" : "button-states",
|
||||
"type" : "ClutterState",
|
||||
|
||||
"duration" : 250,
|
||||
|
||||
"transitions" : [
|
||||
{
|
||||
"source" : null,
|
||||
"target" : "base",
|
||||
|
||||
"keys" : [
|
||||
[ "button", "opacity", "linear", 128 ],
|
||||
[ "button", "scale-x", "ease-in-cubic", 1.0 ],
|
||||
[ "button", "scale-y", "ease-in-cubic", 1.0 ],
|
||||
[ "button", "color", "linear", "rgb(255, 0, 0)" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"source" : null,
|
||||
"target" : "hover",
|
||||
|
||||
"keys" : [
|
||||
[ "button", "opacity", "linear", 255 ],
|
||||
[ "button", "scale-x", "ease-out-bounce", 1.4 ],
|
||||
[ "button", "scale-y", "ease-out-bounce", 1.4 ],
|
||||
[ "button", "color", "linear", "rgb(0, 255, 0)" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"source" : null,
|
||||
"target" : "active",
|
||||
|
||||
"keys" : [
|
||||
[ "button", "opacity", "linear", 255 ],
|
||||
[ "button", "color", "linear", "rgb(0, 0, 255)" ]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
@ -1,144 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <gmodule.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
static ClutterState *state;
|
||||
static ClutterAnimator *animator;
|
||||
|
||||
static gboolean press_event (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
clutter_grab_pointer (actor);
|
||||
clutter_state_set_state (state, "end");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean release_event (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
clutter_state_set_state (state, "start");
|
||||
clutter_ungrab_pointer ();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static ClutterActor *new_rect (gint r,
|
||||
gint g,
|
||||
gint b,
|
||||
gint a)
|
||||
{
|
||||
GError *error = NULL;
|
||||
ClutterColor *color = clutter_color_new (r, g, b, a);
|
||||
ClutterActor *rectangle;
|
||||
|
||||
gchar *file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
|
||||
rectangle = clutter_texture_new_from_file (file, &error);
|
||||
if (rectangle == NULL)
|
||||
g_error ("image load failed: %s", error->message);
|
||||
g_free (file);
|
||||
|
||||
clutter_actor_set_size (rectangle, 128, 128);
|
||||
clutter_color_free (color);
|
||||
return rectangle;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT gint
|
||||
test_state_animator_main (gint argc,
|
||||
gchar **argv)
|
||||
{
|
||||
ClutterActor *stage;
|
||||
ClutterActor *rects[40];
|
||||
gint i;
|
||||
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "State and Animator");
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
rects[i] = new_rect (255 * (i * 1.0 / 40), 50, 160, 255);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), rects[i]);
|
||||
clutter_actor_set_anchor_point (rects[i], 64, 64);
|
||||
clutter_actor_set_position (rects[i], 320.0, 240.0);
|
||||
clutter_actor_set_opacity (rects[i], 0x70);
|
||||
|
||||
clutter_actor_set_reactive (rects[i], TRUE);
|
||||
g_signal_connect (rects[i], "button-press-event", G_CALLBACK (press_event), NULL);
|
||||
g_signal_connect (rects[i], "button-release-event", G_CALLBACK (release_event), NULL);
|
||||
}
|
||||
|
||||
state = clutter_state_new ();
|
||||
clutter_state_set (state, NULL, "start",
|
||||
rects[0], "depth", CLUTTER_LINEAR, 0.0,
|
||||
rects[0], "x", CLUTTER_LINEAR, 100.0,
|
||||
rects[0], "y", CLUTTER_LINEAR, 300.0,
|
||||
rects[1], "opacity", CLUTTER_LINEAR, 0x20,
|
||||
rects[1], "scale-x", CLUTTER_LINEAR, 1.0,
|
||||
rects[1], "scale-y", CLUTTER_LINEAR, 1.0,
|
||||
NULL);
|
||||
clutter_state_set (state, NULL, "end",
|
||||
rects[0], "depth", CLUTTER_LINEAR, 200.0,
|
||||
rects[0], "x", CLUTTER_LINEAR, 320.0,
|
||||
rects[0], "y", CLUTTER_LINEAR, 240.0,
|
||||
rects[1], "opacity", CLUTTER_LINEAR, 0xff,
|
||||
rects[1], "scale-x", CLUTTER_LINEAR, 2.0,
|
||||
rects[1], "scale-y", CLUTTER_LINEAR, 2.0,
|
||||
NULL);
|
||||
|
||||
animator = clutter_animator_new ();
|
||||
clutter_animator_set (animator,
|
||||
rects[0], "depth", -1, 0.0, 0.0,
|
||||
rects[0], "depth", CLUTTER_LINEAR, 1.0, 275.0,
|
||||
rects[0], "x", -1, 0.0, 0.0,
|
||||
rects[0], "x", CLUTTER_LINEAR, 0.5, 200.0,
|
||||
rects[0], "x", CLUTTER_LINEAR, 1.0, 320.0,
|
||||
|
||||
rects[0], "y", -1, 0.0, 0.0,
|
||||
rects[0], "y", CLUTTER_LINEAR, 0.3, 100.0,
|
||||
rects[0], "y", CLUTTER_LINEAR, 1.0, 240.0,
|
||||
|
||||
rects[1], "opacity", -1, 0.0, 0x20,
|
||||
rects[1], "opacity", CLUTTER_LINEAR, 1.0, 0xff,
|
||||
rects[1], "scale-x", -1, 0.0, 1.0,
|
||||
rects[1], "scale-x", CLUTTER_LINEAR, 0.5, 2.0,
|
||||
rects[1], "scale-x", CLUTTER_LINEAR, 1.0, 2.0,
|
||||
rects[1], "scale-y", -1, 0.0, 1.0,
|
||||
rects[1], "scale-y", CLUTTER_LINEAR, 0.5, 2.0,
|
||||
rects[1], "scale-y", CLUTTER_LINEAR, 1.0, 2.0,
|
||||
NULL);
|
||||
|
||||
clutter_animator_property_set_ease_in (animator, G_OBJECT (rects[0]), "depth", TRUE);
|
||||
clutter_animator_property_set_ease_in (animator, G_OBJECT (rects[0]), "x", TRUE);
|
||||
clutter_animator_property_set_ease_in (animator, G_OBJECT (rects[0]), "y", TRUE);
|
||||
clutter_animator_property_set_ease_in (animator, G_OBJECT (rects[1]), "opacity", TRUE);
|
||||
clutter_animator_property_set_ease_in (animator, G_OBJECT (rects[1]), "scale-x", TRUE);
|
||||
clutter_animator_property_set_ease_in (animator, G_OBJECT (rects[1]), "scale-y", TRUE);
|
||||
|
||||
clutter_animator_property_set_interpolation (animator, G_OBJECT (rects[0]), "x",
|
||||
CLUTTER_INTERPOLATION_CUBIC);
|
||||
clutter_animator_property_set_interpolation (animator, G_OBJECT (rects[0]), "y",
|
||||
CLUTTER_INTERPOLATION_CUBIC);
|
||||
|
||||
clutter_state_set_animator (state, "start", "end", animator);
|
||||
g_object_unref (animator);
|
||||
|
||||
clutter_actor_show (stage);
|
||||
clutter_state_set_state (state, "start");
|
||||
|
||||
clutter_main ();
|
||||
g_object_unref (state);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_state_animator_describe (void)
|
||||
{
|
||||
return "Animate using the State and Animator classes.";
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <gmodule.h>
|
||||
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#define TEST_STATE_SCRIPT_FILE "test-script-signals.json"
|
||||
|
||||
gboolean
|
||||
on_button_press (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
g_print ("Button pressed!\n");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT int
|
||||
test_state_script_main (int argc, char *argv[])
|
||||
{
|
||||
ClutterActor *stage, *button;
|
||||
ClutterScript *script;
|
||||
GError *error = NULL;
|
||||
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
script = clutter_script_new ();
|
||||
clutter_script_load_from_file (script, TEST_STATE_SCRIPT_FILE, &error);
|
||||
if (error != NULL)
|
||||
g_error ("Unable to load '%s': %s\n",
|
||||
TEST_STATE_SCRIPT_FILE,
|
||||
error->message);
|
||||
|
||||
stage = clutter_stage_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "State Script");
|
||||
clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
clutter_actor_show (stage);
|
||||
|
||||
button = CLUTTER_ACTOR (clutter_script_get_object (script, "button"));
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), button);
|
||||
clutter_actor_add_constraint (button, clutter_align_constraint_new (stage, CLUTTER_ALIGN_BOTH, 0.5));
|
||||
|
||||
clutter_script_connect_signals (script, NULL);
|
||||
|
||||
clutter_main ();
|
||||
|
||||
g_object_unref (script);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@ -1,206 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <gmodule.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#define STAGE_WIDTH 1024
|
||||
#define STAGE_HEIGHT 768
|
||||
|
||||
#define ACTOR_WIDTH 128
|
||||
#define ACTOR_HEIGHT 128
|
||||
|
||||
#define COLS (STAGE_WIDTH/ACTOR_WIDTH)
|
||||
#define ROWS (STAGE_HEIGHT/ACTOR_HEIGHT)
|
||||
#define TOTAL (ROWS*COLS)
|
||||
|
||||
|
||||
static gboolean press_event (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
ClutterState *state = CLUTTER_STATE (user_data);
|
||||
clutter_state_set_state (state, "right");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean release_event (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
ClutterState *state = CLUTTER_STATE (user_data);
|
||||
clutter_state_set_state (state, "active");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean enter_event (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
ClutterState *state = CLUTTER_STATE (user_data);
|
||||
clutter_state_set_state (state, "hover");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean leave_event (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
ClutterState *state = CLUTTER_STATE (user_data);
|
||||
clutter_state_set_state (state, "normal");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void completed (ClutterState *state,
|
||||
gpointer data)
|
||||
{
|
||||
g_print ("Completed transitioning to state: %s\n",
|
||||
clutter_state_get_state (state));
|
||||
|
||||
if (g_str_equal (clutter_state_get_state (state), "right"))
|
||||
{
|
||||
/* skip straight to left state when reaching right */
|
||||
clutter_state_warp_to_state (state, "left");
|
||||
}
|
||||
}
|
||||
|
||||
static ClutterActor *new_rect (gint r,
|
||||
gint g,
|
||||
gint b,
|
||||
gint a)
|
||||
{
|
||||
GError *error = NULL;
|
||||
ClutterColor *color = clutter_color_new (r, g, b, a);
|
||||
ClutterActor *group = clutter_actor_new ();
|
||||
ClutterActor *rectangle = clutter_actor_new ();
|
||||
ClutterActor *hand = NULL;
|
||||
|
||||
gchar *file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
|
||||
|
||||
hand = clutter_texture_new_from_file (file, &error);
|
||||
if (rectangle == NULL)
|
||||
g_error ("image load failed: %s", error->message);
|
||||
g_free (file);
|
||||
clutter_actor_set_size (hand, ACTOR_WIDTH,ACTOR_HEIGHT);
|
||||
|
||||
clutter_actor_set_background_color (rectangle, color);
|
||||
clutter_actor_set_size (rectangle, ACTOR_WIDTH,ACTOR_HEIGHT);
|
||||
clutter_color_free (color);
|
||||
|
||||
clutter_actor_add_child (group, rectangle);
|
||||
clutter_actor_add_child (group, hand);
|
||||
|
||||
return group;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT gint
|
||||
test_state_main (gint argc,
|
||||
gchar **argv)
|
||||
{
|
||||
ClutterActor *stage;
|
||||
ClutterState *layout_state;
|
||||
gint i;
|
||||
|
||||
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
||||
return 1;
|
||||
|
||||
layout_state = clutter_state_new ();
|
||||
|
||||
stage = clutter_stage_new ();
|
||||
clutter_actor_set_background_color (stage, CLUTTER_COLOR_Black);
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "State Machine");
|
||||
clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
g_signal_connect (stage, "button-press-event",
|
||||
G_CALLBACK (press_event), layout_state);
|
||||
g_signal_connect (stage, "button-release-event",
|
||||
G_CALLBACK (release_event), layout_state);
|
||||
|
||||
for (i = 0; i < TOTAL; i++)
|
||||
{
|
||||
ClutterActor *actor;
|
||||
ClutterState *a_state;
|
||||
|
||||
int row = i/COLS;
|
||||
int col = i%COLS;
|
||||
|
||||
actor = new_rect (255 * (1.0 * col / COLS), 50,
|
||||
255 * (1.0 * row / ROWS), 255);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor);
|
||||
clutter_actor_set_position (actor, 320.0, 240.0);
|
||||
clutter_actor_set_reactive (actor, TRUE);
|
||||
clutter_actor_add_effect_with_name (actor, "fade",
|
||||
clutter_desaturate_effect_new (0.0));
|
||||
|
||||
|
||||
clutter_state_set (layout_state, NULL, "active",
|
||||
actor, "delayed::x", CLUTTER_LINEAR,
|
||||
ACTOR_WIDTH * 1.0 * ((TOTAL-1-i) % COLS),
|
||||
((row*1.0/ROWS))/2, (1.0-(row*1.0/ROWS))/2,
|
||||
actor, "delayed::y", CLUTTER_LINEAR,
|
||||
ACTOR_HEIGHT * 1.0 * ((TOTAL-1-i) / COLS),
|
||||
((row*1.0/ROWS))/2, 0.0,
|
||||
actor, "rotation-angle-x", CLUTTER_LINEAR, 0.0,
|
||||
actor, "rotation-angle-y", CLUTTER_LINEAR, 0.0,
|
||||
NULL);
|
||||
|
||||
clutter_state_set (layout_state, NULL, "right",
|
||||
actor, "delayed::x", CLUTTER_LINEAR, STAGE_WIDTH * 1.0,
|
||||
((row*1.0/ROWS))/2,
|
||||
(1.0-(row*1.0/ROWS))/2,
|
||||
actor, "delayed::y", CLUTTER_LINEAR, STAGE_HEIGHT * 1.0,
|
||||
((row*1.0/ROWS))/2,
|
||||
0.0,
|
||||
NULL);
|
||||
|
||||
clutter_state_set (layout_state, NULL, "left",
|
||||
actor, "rotation-angle-x", CLUTTER_LINEAR, 45.0,
|
||||
actor, "rotation-angle-y", CLUTTER_LINEAR, 5.0,
|
||||
actor, "x", CLUTTER_LINEAR, 0-64.0,
|
||||
actor, "y", CLUTTER_LINEAR, 0-64.0,
|
||||
NULL);
|
||||
|
||||
a_state = clutter_state_new ();
|
||||
g_object_set_data_full (G_OBJECT (actor), "hover-state-machine",
|
||||
a_state, g_object_unref);
|
||||
g_signal_connect (actor, "enter-event",
|
||||
G_CALLBACK (enter_event), a_state);
|
||||
g_signal_connect (actor, "leave-event",
|
||||
G_CALLBACK (leave_event), a_state);
|
||||
|
||||
clutter_state_set (a_state, NULL, "normal",
|
||||
actor, "opacity", CLUTTER_LINEAR, 0x77,
|
||||
actor, "rotation-angle-z", CLUTTER_LINEAR, 0.0,
|
||||
actor, "@effects.fade.factor", CLUTTER_LINEAR, 0.0,
|
||||
NULL);
|
||||
clutter_state_set (a_state, NULL, "hover",
|
||||
actor, "opacity", CLUTTER_LINEAR, 0xff,
|
||||
actor, "rotation-angle-z", CLUTTER_LINEAR, 10.0,
|
||||
actor, "@effects.fade.factor", CLUTTER_LINEAR, 1.0,
|
||||
NULL);
|
||||
clutter_actor_set_opacity (actor, 0x77);
|
||||
|
||||
clutter_state_set_duration (a_state, NULL, NULL, 500);
|
||||
}
|
||||
|
||||
clutter_state_set_duration (layout_state, NULL, NULL, 1000);
|
||||
clutter_state_set_duration (layout_state, "active", "left", 1400);
|
||||
|
||||
g_signal_connect (layout_state, "completed", G_CALLBACK (completed), NULL);
|
||||
|
||||
clutter_actor_show (stage);
|
||||
|
||||
clutter_state_warp_to_state (layout_state, "left");
|
||||
clutter_state_set_state (layout_state, "active");
|
||||
|
||||
clutter_main ();
|
||||
|
||||
g_object_unref (layout_state);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT const char *
|
||||
test_state_describe (void)
|
||||
{
|
||||
return "Animating using the State class.";
|
||||
}
|
@ -1,11 +1,6 @@
|
||||
check_PROGRAMS = \
|
||||
test-picking \
|
||||
test-text-perf \
|
||||
test-state \
|
||||
test-state-interactive \
|
||||
test-state-hidden \
|
||||
test-state-mini \
|
||||
test-state-pick
|
||||
test-text-perf
|
||||
|
||||
common_ldadd = $(top_builddir)/clutter/libmutter-clutter-@LIBMUTTER_API_VERSION@.la
|
||||
|
||||
|
@ -11,11 +11,6 @@ clutter_tests_performance_c_args += clutter_debug_c_args
|
||||
clutter_tests_performance_tests = [
|
||||
'test-picking',
|
||||
'test-text-perf',
|
||||
'test-state',
|
||||
'test-state-interactive',
|
||||
'test-state-hidden',
|
||||
'test-state-mini',
|
||||
'test-state-pick',
|
||||
]
|
||||
|
||||
foreach test : clutter_tests_performance_tests
|
||||
|
@ -1,150 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <gmodule.h>
|
||||
#include <clutter/clutter.h>
|
||||
#include "test-common.h"
|
||||
|
||||
#define STAGE_WIDTH 160
|
||||
#define STAGE_HEIGHT 120
|
||||
|
||||
#define ACTOR_WIDTH 8
|
||||
#define ACTOR_HEIGHT 8
|
||||
|
||||
#define COLS (STAGE_WIDTH/ACTOR_WIDTH)
|
||||
#define ROWS (STAGE_HEIGHT/ACTOR_HEIGHT)
|
||||
#define TOTAL (ROWS*COLS)
|
||||
|
||||
|
||||
static void completed (ClutterState *state,
|
||||
gpointer data)
|
||||
{
|
||||
if (g_str_equal (clutter_state_get_state (state), "right"))
|
||||
{
|
||||
/* skip straight to left state when reaching right */
|
||||
clutter_state_warp_to_state (state, "left");
|
||||
}
|
||||
else if (g_str_equal (clutter_state_get_state (state), "active"))
|
||||
clutter_state_set_state (state, "right");
|
||||
else
|
||||
{
|
||||
clutter_state_set_state (state, "active");
|
||||
}
|
||||
}
|
||||
|
||||
static ClutterActor *new_rect (gint r,
|
||||
gint g,
|
||||
gint b,
|
||||
gint a)
|
||||
{
|
||||
ClutterColor *color = clutter_color_new (r, g, b, a);
|
||||
ClutterActor *group = clutter_actor_new ();
|
||||
ClutterActor *rectangle = clutter_rectangle_new_with_color (color);
|
||||
|
||||
gchar *file = g_build_filename (TESTS_DATA_DIR, "redhand.png", NULL);
|
||||
|
||||
g_free (file);
|
||||
clutter_actor_set_size (rectangle, ACTOR_WIDTH,ACTOR_HEIGHT);
|
||||
clutter_color_free (color);
|
||||
clutter_container_add (CLUTTER_CONTAINER (group), rectangle, NULL);
|
||||
return group;
|
||||
}
|
||||
|
||||
gint
|
||||
main (gint argc,
|
||||
gchar **argv)
|
||||
{
|
||||
ClutterActor *stage;
|
||||
ClutterActor *group;
|
||||
ClutterState *layout_state;
|
||||
gint i;
|
||||
|
||||
clutter_perf_fps_init ();
|
||||
if (CLUTTER_INIT_SUCCESS != clutter_init (&argc, &argv))
|
||||
g_error ("Failed to initialize Clutter");
|
||||
|
||||
stage = clutter_stage_new ();
|
||||
group = clutter_actor_new ();
|
||||
layout_state = clutter_state_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "State Performance [hidden]");
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black);
|
||||
clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
for (i=0; i<TOTAL; i++)
|
||||
{
|
||||
ClutterActor *actor;
|
||||
ClutterState *a_state;
|
||||
|
||||
int row = i/COLS;
|
||||
int col = i%COLS;
|
||||
|
||||
actor = new_rect (255 * ( 1.0*col/COLS), 50,
|
||||
255 * ( 1.0*row/ROWS), 255);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (group), actor);
|
||||
clutter_actor_set_position (actor, 320.0, 240.0);
|
||||
clutter_actor_set_reactive (actor, TRUE);
|
||||
|
||||
|
||||
clutter_state_set (layout_state, NULL, "active",
|
||||
actor, "delayed::x", CLUTTER_LINEAR,
|
||||
ACTOR_WIDTH * 1.0 * ((TOTAL-1-i) % COLS),
|
||||
((row*1.0/ROWS))/2, (1.0-(row*1.0/ROWS))/2,
|
||||
actor, "delayed::y", CLUTTER_LINEAR,
|
||||
ACTOR_HEIGHT * 1.0 * ((TOTAL-1-i) / COLS),
|
||||
((row*1.0/ROWS))/2, 0.0,
|
||||
actor, "rotation-angle-x", CLUTTER_LINEAR, 0.0,
|
||||
actor, "rotation-angle-y", CLUTTER_LINEAR, 0.0,
|
||||
NULL);
|
||||
|
||||
clutter_state_set (layout_state, NULL, "right",
|
||||
actor, "delayed::x", CLUTTER_LINEAR, STAGE_WIDTH * 1.0,
|
||||
((row*1.0/ROWS))/2,
|
||||
(1.0-(row*1.0/ROWS))/2,
|
||||
actor, "delayed::y", CLUTTER_LINEAR, STAGE_HEIGHT * 1.0,
|
||||
((row*1.0/ROWS))/2,
|
||||
0.0,
|
||||
NULL);
|
||||
|
||||
clutter_state_set (layout_state, NULL, "left",
|
||||
actor, "rotation-angle-x", CLUTTER_LINEAR, 45.0,
|
||||
actor, "rotation-angle-y", CLUTTER_LINEAR, 5.0,
|
||||
actor, "x", CLUTTER_LINEAR, 0-64.0,
|
||||
actor, "y", CLUTTER_LINEAR, 0-64.0,
|
||||
NULL);
|
||||
|
||||
a_state = clutter_state_new ();
|
||||
g_object_set_data_full (G_OBJECT (actor), "hover-state-machine",
|
||||
a_state, g_object_unref);
|
||||
|
||||
clutter_state_set (a_state, NULL, "normal",
|
||||
actor, "opacity", CLUTTER_LINEAR, 0x77,
|
||||
actor, "rotation-angle-z", CLUTTER_LINEAR, 0.0,
|
||||
NULL);
|
||||
clutter_state_set (a_state, NULL, "hover",
|
||||
actor, "opacity", CLUTTER_LINEAR, 0xff,
|
||||
actor, "rotation-angle-z", CLUTTER_LINEAR, 10.0,
|
||||
NULL);
|
||||
clutter_actor_set_opacity (actor, 0x77);
|
||||
|
||||
clutter_state_set_duration (a_state, NULL, NULL, 500);
|
||||
}
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
|
||||
clutter_actor_set_opacity (group, 0);
|
||||
|
||||
clutter_state_set_duration (layout_state, NULL, NULL, 1000);
|
||||
clutter_state_set_duration (layout_state, "active", "left", 1400);
|
||||
|
||||
g_signal_connect (layout_state, "completed", G_CALLBACK (completed), NULL);
|
||||
|
||||
clutter_actor_show (stage);
|
||||
|
||||
clutter_state_warp_to_state (layout_state, "left");
|
||||
clutter_state_set_state (layout_state, "active");
|
||||
|
||||
clutter_perf_fps_start (CLUTTER_STAGE (stage));
|
||||
clutter_main ();
|
||||
clutter_perf_fps_report ("test-state-hidden");
|
||||
g_object_unref (layout_state);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@ -1,194 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <gmodule.h>
|
||||
#include <clutter/clutter.h>
|
||||
#include "test-common.h"
|
||||
|
||||
#define STAGE_WIDTH 800
|
||||
#define STAGE_HEIGHT 600
|
||||
|
||||
#define ACTOR_WIDTH 64
|
||||
#define ACTOR_HEIGHT 64
|
||||
|
||||
#define COLS (STAGE_WIDTH/ACTOR_WIDTH)
|
||||
#define ROWS (STAGE_HEIGHT/ACTOR_HEIGHT)
|
||||
#define TOTAL (ROWS*COLS)
|
||||
|
||||
|
||||
static gboolean press_event (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
ClutterState *state = CLUTTER_STATE (user_data);
|
||||
clutter_state_set_state (state, "right");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean release_event (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
ClutterState *state = CLUTTER_STATE (user_data);
|
||||
clutter_state_set_state (state, "active");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean enter_event (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
ClutterState *state = CLUTTER_STATE (user_data);
|
||||
clutter_state_set_state (state, "hover");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean leave_event (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
ClutterState *state = CLUTTER_STATE (user_data);
|
||||
clutter_state_set_state (state, "normal");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void completed (ClutterState *state,
|
||||
gpointer data)
|
||||
{
|
||||
g_print ("Completed transitioning to state: %s\n",
|
||||
clutter_state_get_state (state));
|
||||
|
||||
if (g_str_equal (clutter_state_get_state (state), "right"))
|
||||
{
|
||||
/* skip straight to left state when reaching right */
|
||||
clutter_state_warp_to_state (state, "left");
|
||||
}
|
||||
}
|
||||
|
||||
static ClutterActor *new_rect (gint r,
|
||||
gint g,
|
||||
gint b,
|
||||
gint a)
|
||||
{
|
||||
GError *error = NULL;
|
||||
ClutterColor *color = clutter_color_new (r, g, b, a);
|
||||
ClutterActor *group = clutter_actor_new ();
|
||||
ClutterActor *rectangle = clutter_rectangle_new_with_color (color);
|
||||
ClutterActor *hand = NULL;
|
||||
|
||||
gchar *file = g_build_filename (TESTS_DATA_DIR, "redhand.png", NULL);
|
||||
|
||||
hand = clutter_texture_new_from_file (file, &error);
|
||||
if (rectangle == NULL)
|
||||
g_error ("image load failed: %s", error->message);
|
||||
g_free (file);
|
||||
clutter_actor_set_size (hand, ACTOR_WIDTH,ACTOR_HEIGHT);
|
||||
|
||||
clutter_actor_set_size (rectangle, ACTOR_WIDTH,ACTOR_HEIGHT);
|
||||
clutter_color_free (color);
|
||||
clutter_container_add (CLUTTER_CONTAINER (group), rectangle, hand, NULL);
|
||||
return group;
|
||||
}
|
||||
|
||||
gint
|
||||
main (gint argc,
|
||||
gchar **argv)
|
||||
{
|
||||
ClutterActor *stage;
|
||||
ClutterState *layout_state;
|
||||
gint i;
|
||||
clutter_perf_fps_init ();
|
||||
if (CLUTTER_INIT_SUCCESS != clutter_init (&argc, &argv))
|
||||
g_error ("Failed to initialize Clutter");
|
||||
|
||||
stage = clutter_stage_new ();
|
||||
layout_state = clutter_state_new ();
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black);
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "State Performance [interactive]");
|
||||
clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);
|
||||
|
||||
g_signal_connect (stage, "button-press-event",
|
||||
G_CALLBACK (press_event), layout_state);
|
||||
g_signal_connect (stage, "button-release-event",
|
||||
G_CALLBACK (release_event), layout_state);
|
||||
|
||||
for (i=0; i<TOTAL; i++)
|
||||
{
|
||||
ClutterActor *actor;
|
||||
ClutterState *a_state;
|
||||
|
||||
int row = i/COLS;
|
||||
int col = i%COLS;
|
||||
|
||||
actor = new_rect (255 * ( 1.0*col/COLS), 50,
|
||||
255 * ( 1.0*row/ROWS), 255);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor);
|
||||
clutter_actor_set_position (actor, 320.0, 240.0);
|
||||
clutter_actor_set_reactive (actor, TRUE);
|
||||
|
||||
|
||||
clutter_state_set (layout_state, NULL, "active",
|
||||
actor, "delayed::x", CLUTTER_LINEAR,
|
||||
ACTOR_WIDTH * 1.0 * ((TOTAL-1-i) % COLS),
|
||||
((row*1.0/ROWS))/2, (1.0-(row*1.0/ROWS))/2,
|
||||
actor, "delayed::y", CLUTTER_LINEAR,
|
||||
ACTOR_HEIGHT * 1.0 * ((TOTAL-1-i) / COLS),
|
||||
((row*1.0/ROWS))/2, 0.0,
|
||||
actor, "rotation-angle-x", CLUTTER_LINEAR, 0.0,
|
||||
actor, "rotation-angle-y", CLUTTER_LINEAR, 0.0,
|
||||
NULL);
|
||||
|
||||
clutter_state_set (layout_state, NULL, "right",
|
||||
actor, "delayed::x", CLUTTER_LINEAR, STAGE_WIDTH * 1.0,
|
||||
((row*1.0/ROWS))/2,
|
||||
(1.0-(row*1.0/ROWS))/2,
|
||||
actor, "delayed::y", CLUTTER_LINEAR, STAGE_HEIGHT * 1.0,
|
||||
((row*1.0/ROWS))/2,
|
||||
0.0,
|
||||
NULL);
|
||||
|
||||
clutter_state_set (layout_state, NULL, "left",
|
||||
actor, "rotation-angle-x", CLUTTER_LINEAR, 45.0,
|
||||
actor, "rotation-angle-y", CLUTTER_LINEAR, 5.0,
|
||||
actor, "x", CLUTTER_LINEAR, 0-64.0,
|
||||
actor, "y", CLUTTER_LINEAR, 0-64.0,
|
||||
NULL);
|
||||
|
||||
a_state = clutter_state_new ();
|
||||
g_object_set_data_full (G_OBJECT (actor), "hover-state-machine",
|
||||
a_state, g_object_unref);
|
||||
g_signal_connect (actor, "enter-event",
|
||||
G_CALLBACK (enter_event), a_state);
|
||||
g_signal_connect (actor, "leave-event",
|
||||
G_CALLBACK (leave_event), a_state);
|
||||
|
||||
clutter_state_set (a_state, NULL, "normal",
|
||||
actor, "opacity", CLUTTER_LINEAR, 0x77,
|
||||
actor, "rotation-angle-z", CLUTTER_LINEAR, 0.0,
|
||||
NULL);
|
||||
clutter_state_set (a_state, NULL, "hover",
|
||||
actor, "opacity", CLUTTER_LINEAR, 0xff,
|
||||
actor, "rotation-angle-z", CLUTTER_LINEAR, 10.0,
|
||||
NULL);
|
||||
clutter_actor_set_opacity (actor, 0x77);
|
||||
|
||||
clutter_state_set_duration (a_state, NULL, NULL, 500);
|
||||
}
|
||||
|
||||
clutter_state_set_duration (layout_state, NULL, NULL, 1000);
|
||||
clutter_state_set_duration (layout_state, "active", "left", 1400);
|
||||
|
||||
g_signal_connect (layout_state, "completed", G_CALLBACK (completed), NULL);
|
||||
|
||||
clutter_actor_show (stage);
|
||||
|
||||
clutter_state_warp_to_state (layout_state, "left");
|
||||
clutter_state_set_state (layout_state, "active");
|
||||
|
||||
clutter_perf_fake_mouse (CLUTTER_STAGE (stage));
|
||||
clutter_perf_fps_start (CLUTTER_STAGE (stage));
|
||||
clutter_main ();
|
||||
clutter_perf_fps_report ("test-state-interactive");
|
||||
g_object_unref (layout_state);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@ -1,153 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <gmodule.h>
|
||||
#include <clutter/clutter.h>
|
||||
#include "test-common.h"
|
||||
|
||||
#define STAGE_WIDTH 160
|
||||
#define STAGE_HEIGHT 120
|
||||
|
||||
#define ACTOR_WIDTH 8
|
||||
#define ACTOR_HEIGHT 8
|
||||
|
||||
#define COLS (STAGE_WIDTH/ACTOR_WIDTH)
|
||||
#define ROWS (STAGE_HEIGHT/ACTOR_HEIGHT)
|
||||
#define TOTAL (ROWS*COLS)
|
||||
|
||||
|
||||
static void completed (ClutterState *state,
|
||||
gpointer data)
|
||||
{
|
||||
if (g_str_equal (clutter_state_get_state (state), "right"))
|
||||
{
|
||||
/* skip straight to left state when reaching right */
|
||||
clutter_state_warp_to_state (state, "left");
|
||||
}
|
||||
else if (g_str_equal (clutter_state_get_state (state), "active"))
|
||||
clutter_state_set_state (state, "right");
|
||||
else
|
||||
{
|
||||
clutter_state_set_state (state, "active");
|
||||
}
|
||||
}
|
||||
|
||||
static ClutterActor *new_rect (gint r,
|
||||
gint g,
|
||||
gint b,
|
||||
gint a)
|
||||
{
|
||||
GError *error = NULL;
|
||||
ClutterColor *color = clutter_color_new (r, g, b, a);
|
||||
ClutterActor *group = clutter_actor_new ();
|
||||
ClutterActor *rectangle = clutter_rectangle_new_with_color (color);
|
||||
ClutterActor *hand = NULL;
|
||||
|
||||
gchar *file = g_build_filename (TESTS_DATA_DIR, "redhand.png", NULL);
|
||||
|
||||
hand = clutter_texture_new_from_file (file, &error);
|
||||
if (rectangle == NULL)
|
||||
g_error ("image load failed: %s", error->message);
|
||||
g_free (file);
|
||||
clutter_actor_set_size (hand, ACTOR_WIDTH,ACTOR_HEIGHT);
|
||||
|
||||
clutter_actor_set_size (rectangle, ACTOR_WIDTH,ACTOR_HEIGHT);
|
||||
clutter_color_free (color);
|
||||
clutter_container_add (CLUTTER_CONTAINER (group), rectangle, hand, NULL);
|
||||
return group;
|
||||
}
|
||||
|
||||
gint
|
||||
main (gint argc,
|
||||
gchar **argv)
|
||||
{
|
||||
ClutterActor *stage;
|
||||
ClutterState *layout_state;
|
||||
gint i;
|
||||
|
||||
clutter_perf_fps_init ();
|
||||
if (CLUTTER_INIT_SUCCESS != clutter_init (&argc, &argv))
|
||||
g_error ("Failed to initialize Clutter");
|
||||
|
||||
stage = clutter_stage_new ();
|
||||
layout_state = clutter_state_new ();
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "State Performance [mini]");
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black);
|
||||
clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
for (i=0; i<TOTAL; i++)
|
||||
{
|
||||
ClutterActor *actor;
|
||||
ClutterState *a_state;
|
||||
|
||||
int row = i/COLS;
|
||||
int col = i%COLS;
|
||||
|
||||
actor = new_rect (255 * ( 1.0*col/COLS), 50,
|
||||
255 * ( 1.0*row/ROWS), 255);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor);
|
||||
clutter_actor_set_position (actor, 320.0, 240.0);
|
||||
clutter_actor_set_reactive (actor, TRUE);
|
||||
|
||||
|
||||
clutter_state_set (layout_state, NULL, "active",
|
||||
actor, "delayed::x", CLUTTER_LINEAR,
|
||||
ACTOR_WIDTH * 1.0 * ((TOTAL-1-i) % COLS),
|
||||
((row*1.0/ROWS))/2, (1.0-(row*1.0/ROWS))/2,
|
||||
actor, "delayed::y", CLUTTER_LINEAR,
|
||||
ACTOR_HEIGHT * 1.0 * ((TOTAL-1-i) / COLS),
|
||||
((row*1.0/ROWS))/2, 0.0,
|
||||
actor, "rotation-angle-x", CLUTTER_LINEAR, 0.0,
|
||||
actor, "rotation-angle-y", CLUTTER_LINEAR, 0.0,
|
||||
NULL);
|
||||
|
||||
clutter_state_set (layout_state, NULL, "right",
|
||||
actor, "delayed::x", CLUTTER_LINEAR, STAGE_WIDTH * 1.0,
|
||||
((row*1.0/ROWS))/2,
|
||||
(1.0-(row*1.0/ROWS))/2,
|
||||
actor, "delayed::y", CLUTTER_LINEAR, STAGE_HEIGHT * 1.0,
|
||||
((row*1.0/ROWS))/2,
|
||||
0.0,
|
||||
NULL);
|
||||
|
||||
clutter_state_set (layout_state, NULL, "left",
|
||||
actor, "rotation-angle-x", CLUTTER_LINEAR, 45.0,
|
||||
actor, "rotation-angle-y", CLUTTER_LINEAR, 5.0,
|
||||
actor, "x", CLUTTER_LINEAR, 0-64.0,
|
||||
actor, "y", CLUTTER_LINEAR, 0-64.0,
|
||||
NULL);
|
||||
|
||||
a_state = clutter_state_new ();
|
||||
g_object_set_data_full (G_OBJECT (actor), "hover-state-machine",
|
||||
a_state, g_object_unref);
|
||||
|
||||
clutter_state_set (a_state, NULL, "normal",
|
||||
actor, "opacity", CLUTTER_LINEAR, 0x77,
|
||||
actor, "rotation-angle-z", CLUTTER_LINEAR, 0.0,
|
||||
NULL);
|
||||
clutter_state_set (a_state, NULL, "hover",
|
||||
actor, "opacity", CLUTTER_LINEAR, 0xff,
|
||||
actor, "rotation-angle-z", CLUTTER_LINEAR, 10.0,
|
||||
NULL);
|
||||
clutter_actor_set_opacity (actor, 0x77);
|
||||
|
||||
clutter_state_set_duration (a_state, NULL, NULL, 500);
|
||||
}
|
||||
|
||||
clutter_state_set_duration (layout_state, NULL, NULL, 1000);
|
||||
clutter_state_set_duration (layout_state, "active", "left", 1400);
|
||||
|
||||
g_signal_connect (layout_state, "completed", G_CALLBACK (completed), NULL);
|
||||
|
||||
clutter_actor_show (stage);
|
||||
|
||||
clutter_state_warp_to_state (layout_state, "left");
|
||||
clutter_state_set_state (layout_state, "active");
|
||||
|
||||
clutter_perf_fps_start (CLUTTER_STAGE (stage));
|
||||
clutter_main ();
|
||||
clutter_perf_fps_report ("test-state-mini");
|
||||
g_object_unref (layout_state);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@ -1,159 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <gmodule.h>
|
||||
#include <clutter/clutter.h>
|
||||
#include "test-common.h"
|
||||
|
||||
static gint times = 16;
|
||||
|
||||
#define STAGE_WIDTH 800
|
||||
#define STAGE_HEIGHT 600
|
||||
|
||||
#define ACTOR_WIDTH 64
|
||||
#define ACTOR_HEIGHT 64
|
||||
|
||||
#define COLS (STAGE_WIDTH/ACTOR_WIDTH)
|
||||
#define ROWS (STAGE_HEIGHT/ACTOR_HEIGHT)
|
||||
#define TOTAL (ROWS*COLS)
|
||||
|
||||
|
||||
static void completed (ClutterState *state,
|
||||
gpointer data)
|
||||
{
|
||||
if (g_str_equal (clutter_state_get_state (state), "right"))
|
||||
{
|
||||
/* skip straight to left state when reaching right */
|
||||
clutter_state_warp_to_state (state, "left");
|
||||
}
|
||||
else if (g_str_equal (clutter_state_get_state (state), "active"))
|
||||
clutter_state_set_state (state, "right");
|
||||
else
|
||||
{
|
||||
clutter_state_set_state (state, "active");
|
||||
}
|
||||
times --;
|
||||
if (times <=0)
|
||||
clutter_main_quit ();
|
||||
}
|
||||
|
||||
static ClutterActor *new_rect (gint r,
|
||||
gint g,
|
||||
gint b,
|
||||
gint a)
|
||||
{
|
||||
GError *error = NULL;
|
||||
ClutterColor *color = clutter_color_new (r, g, b, a);
|
||||
ClutterActor *group = clutter_actor_new ();
|
||||
ClutterActor *rectangle = clutter_rectangle_new_with_color (color);
|
||||
ClutterActor *hand = NULL;
|
||||
|
||||
gchar *file = g_build_filename (TESTS_DATA_DIR, "redhand.png", NULL);
|
||||
|
||||
hand = clutter_texture_new_from_file (file, &error);
|
||||
if (rectangle == NULL)
|
||||
g_error ("image load failed: %s", error->message);
|
||||
g_free (file);
|
||||
clutter_actor_set_size (hand, ACTOR_WIDTH,ACTOR_HEIGHT);
|
||||
|
||||
clutter_actor_set_size (rectangle, ACTOR_WIDTH,ACTOR_HEIGHT);
|
||||
clutter_color_free (color);
|
||||
clutter_container_add (CLUTTER_CONTAINER (group), rectangle, hand, NULL);
|
||||
return group;
|
||||
}
|
||||
|
||||
gint
|
||||
main (gint argc,
|
||||
gchar **argv)
|
||||
{
|
||||
ClutterActor *stage;
|
||||
ClutterState *layout_state;
|
||||
gint i;
|
||||
|
||||
clutter_perf_fps_init ();
|
||||
if (CLUTTER_INIT_SUCCESS != clutter_init (&argc, &argv))
|
||||
g_error ("Failed to initialize Clutter");
|
||||
|
||||
stage = clutter_stage_new ();
|
||||
layout_state = clutter_state_new ();
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black);
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "State Performance [pick]");
|
||||
clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
for (i=0; i<TOTAL; i++)
|
||||
{
|
||||
ClutterActor *actor;
|
||||
ClutterState *a_state;
|
||||
|
||||
int row = i/COLS;
|
||||
int col = i%COLS;
|
||||
|
||||
actor = new_rect (255 * ( 1.0*col/COLS), 50,
|
||||
255 * ( 1.0*row/ROWS), 255);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor);
|
||||
clutter_actor_set_position (actor, 320.0, 240.0);
|
||||
clutter_actor_set_reactive (actor, TRUE);
|
||||
|
||||
|
||||
clutter_state_set (layout_state, NULL, "active",
|
||||
actor, "delayed::x", CLUTTER_LINEAR,
|
||||
ACTOR_WIDTH * 1.0 * ((TOTAL-1-i) % COLS),
|
||||
((row*1.0/ROWS))/2, (1.0-(row*1.0/ROWS))/2,
|
||||
actor, "delayed::y", CLUTTER_LINEAR,
|
||||
ACTOR_HEIGHT * 1.0 * ((TOTAL-1-i) / COLS),
|
||||
((row*1.0/ROWS))/2, 0.0,
|
||||
actor, "rotation-angle-x", CLUTTER_LINEAR, 0.0,
|
||||
actor, "rotation-angle-y", CLUTTER_LINEAR, 0.0,
|
||||
NULL);
|
||||
|
||||
clutter_state_set (layout_state, NULL, "right",
|
||||
actor, "delayed::x", CLUTTER_LINEAR, STAGE_WIDTH * 1.0,
|
||||
((row*1.0/ROWS))/2,
|
||||
(1.0-(row*1.0/ROWS))/2,
|
||||
actor, "delayed::y", CLUTTER_LINEAR, STAGE_HEIGHT * 1.0,
|
||||
((row*1.0/ROWS))/2,
|
||||
0.0,
|
||||
NULL);
|
||||
|
||||
clutter_state_set (layout_state, NULL, "left",
|
||||
actor, "rotation-angle-x", CLUTTER_LINEAR, 45.0,
|
||||
actor, "rotation-angle-y", CLUTTER_LINEAR, 5.0,
|
||||
actor, "x", CLUTTER_LINEAR, 0-64.0,
|
||||
actor, "y", CLUTTER_LINEAR, 0-64.0,
|
||||
NULL);
|
||||
|
||||
a_state = clutter_state_new ();
|
||||
g_object_set_data_full (G_OBJECT (actor), "hover-state-machine",
|
||||
a_state, g_object_unref);
|
||||
|
||||
clutter_state_set (a_state, NULL, "normal",
|
||||
actor, "opacity", CLUTTER_LINEAR, 0x77,
|
||||
actor, "rotation-angle-z", CLUTTER_LINEAR, 0.0,
|
||||
NULL);
|
||||
clutter_state_set (a_state, NULL, "hover",
|
||||
actor, "opacity", CLUTTER_LINEAR, 0xff,
|
||||
actor, "rotation-angle-z", CLUTTER_LINEAR, 10.0,
|
||||
NULL);
|
||||
clutter_actor_set_opacity (actor, 0x77);
|
||||
|
||||
clutter_state_set_duration (a_state, NULL, NULL, 500);
|
||||
}
|
||||
|
||||
clutter_state_set_duration (layout_state, NULL, NULL, 1000);
|
||||
clutter_state_set_duration (layout_state, "active", "left", 1400);
|
||||
|
||||
g_signal_connect (layout_state, "completed", G_CALLBACK (completed), NULL);
|
||||
|
||||
clutter_actor_show (stage);
|
||||
|
||||
clutter_state_warp_to_state (layout_state, "left");
|
||||
clutter_state_set_state (layout_state, "active");
|
||||
|
||||
clutter_perf_fake_mouse (CLUTTER_STAGE (stage));
|
||||
clutter_perf_fps_start (CLUTTER_STAGE (stage));
|
||||
clutter_main ();
|
||||
clutter_perf_fps_report ("test-state-pick");
|
||||
g_object_unref (layout_state);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@ -1,158 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <gmodule.h>
|
||||
#include <clutter/clutter.h>
|
||||
#include "test-common.h"
|
||||
|
||||
static gint times = 16;
|
||||
|
||||
#define STAGE_WIDTH 800
|
||||
#define STAGE_HEIGHT 600
|
||||
|
||||
#define ACTOR_WIDTH 64
|
||||
#define ACTOR_HEIGHT 64
|
||||
|
||||
#define COLS (STAGE_WIDTH/ACTOR_WIDTH)
|
||||
#define ROWS (STAGE_HEIGHT/ACTOR_HEIGHT)
|
||||
#define TOTAL (ROWS*COLS)
|
||||
|
||||
|
||||
static void completed (ClutterState *state,
|
||||
gpointer data)
|
||||
{
|
||||
if (g_str_equal (clutter_state_get_state (state), "right"))
|
||||
{
|
||||
/* skip straight to left state when reaching right */
|
||||
clutter_state_warp_to_state (state, "left");
|
||||
}
|
||||
else if (g_str_equal (clutter_state_get_state (state), "active"))
|
||||
clutter_state_set_state (state, "right");
|
||||
else
|
||||
{
|
||||
clutter_state_set_state (state, "active");
|
||||
}
|
||||
times --;
|
||||
if (times <=0)
|
||||
clutter_main_quit ();
|
||||
}
|
||||
|
||||
static ClutterActor *new_rect (gint r,
|
||||
gint g,
|
||||
gint b,
|
||||
gint a)
|
||||
{
|
||||
GError *error = NULL;
|
||||
ClutterColor *color = clutter_color_new (r, g, b, a);
|
||||
ClutterActor *group = clutter_actor_new ();
|
||||
ClutterActor *rectangle = clutter_rectangle_new_with_color (color);
|
||||
ClutterActor *hand = NULL;
|
||||
|
||||
gchar *file = g_build_filename (TESTS_DATA_DIR, "redhand.png", NULL);
|
||||
|
||||
hand = clutter_texture_new_from_file (file, &error);
|
||||
if (rectangle == NULL)
|
||||
g_error ("image load failed: %s", error->message);
|
||||
g_free (file);
|
||||
clutter_actor_set_size (hand, ACTOR_WIDTH,ACTOR_HEIGHT);
|
||||
|
||||
clutter_actor_set_size (rectangle, ACTOR_WIDTH,ACTOR_HEIGHT);
|
||||
clutter_color_free (color);
|
||||
clutter_container_add (CLUTTER_CONTAINER (group), rectangle, hand, NULL);
|
||||
return group;
|
||||
}
|
||||
|
||||
gint
|
||||
main (gint argc,
|
||||
gchar **argv)
|
||||
{
|
||||
ClutterActor *stage;
|
||||
ClutterState *layout_state;
|
||||
gint i;
|
||||
|
||||
clutter_perf_fps_init ();
|
||||
if (CLUTTER_INIT_SUCCESS != clutter_init (&argc, &argv))
|
||||
g_error ("Failed to initialize Clutter");
|
||||
|
||||
stage = clutter_stage_new ();
|
||||
layout_state = clutter_state_new ();
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black);
|
||||
clutter_stage_set_title (CLUTTER_STAGE (stage), "State Performance");
|
||||
clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);
|
||||
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
|
||||
|
||||
for (i=0; i<TOTAL; i++)
|
||||
{
|
||||
ClutterActor *actor;
|
||||
ClutterState *a_state;
|
||||
|
||||
int row = i/COLS;
|
||||
int col = i%COLS;
|
||||
|
||||
actor = new_rect (255 * ( 1.0*col/COLS), 50,
|
||||
255 * ( 1.0*row/ROWS), 255);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor);
|
||||
clutter_actor_set_position (actor, 320.0, 240.0);
|
||||
clutter_actor_set_reactive (actor, TRUE);
|
||||
|
||||
|
||||
clutter_state_set (layout_state, NULL, "active",
|
||||
actor, "delayed::x", CLUTTER_LINEAR,
|
||||
ACTOR_WIDTH * 1.0 * ((TOTAL-1-i) % COLS),
|
||||
((row*1.0/ROWS))/2, (1.0-(row*1.0/ROWS))/2,
|
||||
actor, "delayed::y", CLUTTER_LINEAR,
|
||||
ACTOR_HEIGHT * 1.0 * ((TOTAL-1-i) / COLS),
|
||||
((row*1.0/ROWS))/2, 0.0,
|
||||
actor, "rotation-angle-x", CLUTTER_LINEAR, 0.0,
|
||||
actor, "rotation-angle-y", CLUTTER_LINEAR, 0.0,
|
||||
NULL);
|
||||
|
||||
clutter_state_set (layout_state, NULL, "right",
|
||||
actor, "delayed::x", CLUTTER_LINEAR, STAGE_WIDTH * 1.0,
|
||||
((row*1.0/ROWS))/2,
|
||||
(1.0-(row*1.0/ROWS))/2,
|
||||
actor, "delayed::y", CLUTTER_LINEAR, STAGE_HEIGHT * 1.0,
|
||||
((row*1.0/ROWS))/2,
|
||||
0.0,
|
||||
NULL);
|
||||
|
||||
clutter_state_set (layout_state, NULL, "left",
|
||||
actor, "rotation-angle-x", CLUTTER_LINEAR, 45.0,
|
||||
actor, "rotation-angle-y", CLUTTER_LINEAR, 5.0,
|
||||
actor, "x", CLUTTER_LINEAR, 0-64.0,
|
||||
actor, "y", CLUTTER_LINEAR, 0-64.0,
|
||||
NULL);
|
||||
|
||||
a_state = clutter_state_new ();
|
||||
g_object_set_data_full (G_OBJECT (actor), "hover-state-machine",
|
||||
a_state, g_object_unref);
|
||||
|
||||
clutter_state_set (a_state, NULL, "normal",
|
||||
actor, "opacity", CLUTTER_LINEAR, 0x77,
|
||||
actor, "rotation-angle-z", CLUTTER_LINEAR, 0.0,
|
||||
NULL);
|
||||
clutter_state_set (a_state, NULL, "hover",
|
||||
actor, "opacity", CLUTTER_LINEAR, 0xff,
|
||||
actor, "rotation-angle-z", CLUTTER_LINEAR, 10.0,
|
||||
NULL);
|
||||
clutter_actor_set_opacity (actor, 0x77);
|
||||
|
||||
clutter_state_set_duration (a_state, NULL, NULL, 500);
|
||||
}
|
||||
|
||||
clutter_state_set_duration (layout_state, NULL, NULL, 1000);
|
||||
clutter_state_set_duration (layout_state, "active", "left", 1400);
|
||||
|
||||
g_signal_connect (layout_state, "completed", G_CALLBACK (completed), NULL);
|
||||
|
||||
clutter_actor_show (stage);
|
||||
|
||||
clutter_state_warp_to_state (layout_state, "left");
|
||||
clutter_state_set_state (layout_state, "active");
|
||||
|
||||
clutter_perf_fps_start (CLUTTER_STAGE (stage));
|
||||
clutter_main ();
|
||||
clutter_perf_fps_report ("test-state");
|
||||
g_object_unref (layout_state);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@ -56,7 +56,6 @@ clutter/clutter/clutter-virtual-input-device.c
|
||||
clutter/clutter/clutter-zoom-action.c
|
||||
clutter/clutter/deprecated/clutter-alpha.c
|
||||
clutter/clutter/deprecated/clutter-animation.c
|
||||
clutter/clutter/deprecated/clutter-animator.c
|
||||
clutter/clutter/deprecated/clutter-behaviour.c
|
||||
clutter/clutter/deprecated/clutter-behaviour-depth.c
|
||||
clutter/clutter/deprecated/clutter-behaviour-ellipse.c
|
||||
@ -67,7 +66,6 @@ clutter/clutter/deprecated/clutter-behaviour-scale.c
|
||||
clutter/clutter/deprecated/clutter-box.c
|
||||
clutter/clutter/deprecated/clutter-cairo-texture.c
|
||||
clutter/clutter/deprecated/clutter-rectangle.c
|
||||
clutter/clutter/deprecated/clutter-state.c
|
||||
clutter/clutter/deprecated/clutter-table-layout.c
|
||||
clutter/clutter/deprecated/clutter-texture.c
|
||||
clutter/clutter/evdev/clutter-input-device-evdev.c
|
||||
|
Loading…
Reference in New Issue
Block a user