mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 03:22:04 +00:00
2007-11-30 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-timeline.h: * clutter/clutter-timeline.c (timeline_timeout_func), (clutter_timeline_get_delta): Add a function for retrieving the number of frames and the time (in milliseconds) elapsed since the last timeline ::new-frame signal. This can be useful for implementing a physics engine or just for knowing how if and how many frames have been skipped.
This commit is contained in:
parent
f04a0a4645
commit
9628df5ca9
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
2007-11-30 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* clutter/clutter-timeline.h:
|
||||
* clutter/clutter-timeline.c
|
||||
(timeline_timeout_func),
|
||||
(clutter_timeline_get_delta): Add a function for retrieving
|
||||
the number of frames and the time (in milliseconds) elapsed
|
||||
since the last timeline ::new-frame signal. This can be useful
|
||||
for implementing a physics engine or just for knowing how if
|
||||
and how many frames have been skipped.
|
||||
|
||||
2007-11-30 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* clutter/clutter-actor.c (parse_units),
|
||||
|
@ -70,6 +70,8 @@ struct _ClutterTimelinePrivate
|
||||
guint delay;
|
||||
guint duration;
|
||||
|
||||
gint skipped_frames;
|
||||
|
||||
gulong last_frame_msecs;
|
||||
gulong start_frame_secs;
|
||||
|
||||
@ -505,19 +507,27 @@ timeline_timeout_func (gpointer data)
|
||||
/ (1000 / priv->fps);
|
||||
|
||||
if (n_frames <= 0)
|
||||
{
|
||||
n_frames = 1;
|
||||
priv->skipped_frames = 0;
|
||||
}
|
||||
else if (n_frames > 1)
|
||||
{
|
||||
CLUTTER_TIMESTAMP (SCHEDULER,
|
||||
"Timeline [%p], skipping %d frames\n",
|
||||
timeline,
|
||||
n_frames);
|
||||
|
||||
priv->skipped_frames = n_frames - 1;
|
||||
}
|
||||
else
|
||||
priv->skipped_frames = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* First frame, set up timings.*/
|
||||
priv->start_frame_secs = timeval.tv_sec;
|
||||
priv->skipped_frames = 0;
|
||||
|
||||
msecs = timeval.tv_usec / 1000;
|
||||
n_frames = 1;
|
||||
@ -1206,3 +1216,58 @@ clutter_timeline_set_direction (ClutterTimeline *timeline,
|
||||
g_object_notify (G_OBJECT (timeline), "direction");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_timeline_get_delta:
|
||||
* @timeline: a #ClutterTimeline
|
||||
* @msecs: return location for the milliseconds elapsed since the last
|
||||
* frame, or %NULL
|
||||
*
|
||||
* Retrieves the number of frames and the amount of time elapsed since
|
||||
* the last ClutterTimeline::new-frame signal.
|
||||
*
|
||||
* This function is only useful inside handlers for the ::new-frame
|
||||
* signal, and its behaviour is undefined if the timeline is not
|
||||
* playing.
|
||||
*
|
||||
* Return value: the amount of frames elapsed since the last one
|
||||
*
|
||||
* Since: 0.6
|
||||
*/
|
||||
guint
|
||||
clutter_timeline_get_delta (ClutterTimeline *timeline,
|
||||
guint *msecs)
|
||||
{
|
||||
ClutterTimelinePrivate *priv;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), 0);
|
||||
|
||||
if (!clutter_timeline_is_playing (timeline))
|
||||
{
|
||||
if (msecs)
|
||||
*msecs = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
priv = timeline->priv;
|
||||
|
||||
if (msecs)
|
||||
{
|
||||
GTimeVal timeval;
|
||||
|
||||
g_get_current_time (&timeval);
|
||||
|
||||
if (priv->last_frame_msecs)
|
||||
{
|
||||
*msecs = ((timeval.tv_sec - priv->start_frame_secs) * 1000)
|
||||
+ (timeval.tv_usec / 1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
*msecs = timeval.tv_usec / 1000;
|
||||
}
|
||||
}
|
||||
|
||||
return priv->skipped_frames + 1;
|
||||
}
|
||||
|
@ -138,6 +138,8 @@ gboolean clutter_timeline_is_playing (ClutterTimeline *timeli
|
||||
void clutter_timeline_set_delay (ClutterTimeline *timeline,
|
||||
guint msecs);
|
||||
guint clutter_timeline_get_delay (ClutterTimeline *timeline);
|
||||
guint clutter_timeline_get_delta (ClutterTimeline *timeline,
|
||||
guint *msecs);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
2007-11-30 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* clutter-sections.txt: Update with the newly added API.
|
||||
|
||||
2007-11-28 Tomas Frydrych <tf@openedhand.com>
|
||||
|
||||
* clutter-sections.txt: added new CLUTTER_UNITS_FROM_* macros.
|
||||
|
@ -320,9 +320,7 @@ clutter_actor_set_y
|
||||
clutter_actor_get_y
|
||||
clutter_actor_move_by
|
||||
clutter_actor_set_rotation
|
||||
clutter_actor_set_rotationx
|
||||
clutter_actor_get_rotation
|
||||
clutter_actor_get_rotationx
|
||||
clutter_actor_set_opacity
|
||||
clutter_actor_get_opacity
|
||||
clutter_actor_set_name
|
||||
@ -348,9 +346,7 @@ clutter_actor_lower_bottom
|
||||
<SUBSECTION>
|
||||
clutter_actor_set_depth
|
||||
clutter_actor_get_depth
|
||||
clutter_actor_set_scalex
|
||||
clutter_actor_set_scale
|
||||
clutter_actor_get_scalex
|
||||
clutter_actor_get_scale
|
||||
clutter_actor_get_abs_size
|
||||
clutter_actor_apply_transform_to_point
|
||||
@ -362,14 +358,34 @@ clutter_actor_get_vertices
|
||||
<SUBSECTION>
|
||||
clutter_actor_set_anchor_point
|
||||
clutter_actor_get_anchor_point
|
||||
clutter_actor_set_anchor_pointu
|
||||
clutter_actor_get_anchor_pointu
|
||||
clutter_actor_set_anchor_point_from_gravity
|
||||
|
||||
<SUBSECTION>
|
||||
clutter_actor_set_reactive
|
||||
clutter_actor_get_reactive
|
||||
|
||||
<SUBSECTION>
|
||||
clutter_actor_set_depthu
|
||||
clutter_actor_get_depthu
|
||||
clutter_actor_set_heightu
|
||||
clutter_actor_get_heightu
|
||||
clutter_actor_set_widthu
|
||||
clutter_actor_get_widthu
|
||||
clutter_actor_set_xu
|
||||
clutter_actor_get_xu
|
||||
clutter_actor_set_yu
|
||||
clutter_actor_get_yu
|
||||
clutter_actor_set_positionu
|
||||
clutter_actor_set_sizeu
|
||||
clutter_actor_set_anchor_pointu
|
||||
clutter_actor_get_anchor_pointu
|
||||
|
||||
<SUBSECTION>
|
||||
clutter_actor_set_scalex
|
||||
clutter_actor_get_scalex
|
||||
clutter_actor_set_rotationx
|
||||
clutter_actor_get_rotationx
|
||||
|
||||
<SUBSECTION Standard>
|
||||
CLUTTER_TYPE_GEOMETRY
|
||||
CLUTTER_TYPE_ACTOR_BOX
|
||||
@ -445,6 +461,8 @@ clutter_stage_snapshot
|
||||
clutter_stage_event
|
||||
clutter_stage_set_key_focus
|
||||
clutter_stage_get_key_focus
|
||||
clutter_stage_get_resolution
|
||||
clutter_stage_get_resolutionx
|
||||
|
||||
<SUBSECTION>
|
||||
ClutterPerspective
|
||||
@ -516,6 +534,7 @@ clutter_timeline_rewind
|
||||
clutter_timeline_skip
|
||||
clutter_timeline_advance
|
||||
clutter_timeline_get_current_frame
|
||||
clutter_timeline_get_delta
|
||||
clutter_timeline_get_progress
|
||||
clutter_timeline_get_progressx
|
||||
clutter_timeline_is_playing
|
||||
@ -1126,12 +1145,16 @@ ClutterModelSortFunc
|
||||
ClutterModelForeachFunc
|
||||
clutter_model_new
|
||||
clutter_model_newv
|
||||
clutter_model_set_names
|
||||
clutter_model_set_types
|
||||
clutter_model_append
|
||||
clutter_model_prepend
|
||||
clutter_model_insert
|
||||
clutter_model_insert_value
|
||||
clutter_model_remove
|
||||
clutter_model_get_column_name
|
||||
clutter_model_get_column_type
|
||||
clutter_model_get_n_columns
|
||||
clutter_model_get_n_rows
|
||||
clutter_model_get_first_iter
|
||||
clutter_model_get_last_iter
|
||||
|
Loading…
Reference in New Issue
Block a user