1
-
1
+ #define CLUTTER_DISABLE_DEPRECATION_WARNINGS
2
2
#include <clutter/clutter.h>
3
3
#include <math.h>
4
4
10
10
#define SCREEN_H 480
11
11
12
12
#ifndef CLUTTER_ANGLE_FROM_RAD
13
- #define CLUTTER_ANGLE_FROM_RAD (x ) ((x) * 180.0 / M_PI )
13
+ #define CLUTTER_ANGLE_FROM_RAD (x ) ((x) * 180.0 / G_PI )
14
14
#endif
15
15
16
16
static void
@@ -19,14 +19,14 @@ circle_paint_cb (ClutterActor *actor)
19
19
const CoglColor fill_color = { 0xff , 0xff , 0xff , 0x80 };
20
20
gint i ;
21
21
gdouble angle ;
22
- guint radius = clutter_actor_get_width (actor )/ 2 ;
22
+ guint radius = clutter_actor_get_width (actor ) / 2 ;
23
23
24
24
cogl_set_source_color (& fill_color );
25
25
26
26
angle = * ((gdouble * )g_object_get_data (G_OBJECT (actor ), "angle" ));
27
- for (i = 0 ; i < CIRCLE_S ; i ++ , angle += (2.0 * M_PI )/ (gdouble )CIRCLE_S )
27
+ for (i = 0 ; i < CIRCLE_S ; i ++ , angle += (2.0 * G_PI ) / (gdouble ) CIRCLE_S )
28
28
{
29
- gdouble angle2 = angle + ((2.0 * M_PI )/ (gdouble )CIRCLE_S )/ 2.0 ;
29
+ gdouble angle2 = angle + ((2.0 * G_PI ) / (gdouble )CIRCLE_S ) / 2.0 ;
30
30
cogl_path_move_to (((radius - CIRCLE_W ) * cos (angle )) + radius ,
31
31
((radius - CIRCLE_W ) * sin (angle )) + radius );
32
32
cogl_path_arc (radius , radius , radius , radius ,
@@ -50,13 +50,16 @@ main (int argc, char **argv)
50
50
ClutterTimeline * timeline ;
51
51
ClutterActor * stage ;
52
52
gint i ;
53
-
54
- clutter_init (& argc , & argv );
55
-
56
- stage = clutter_stage_get_default ();
57
- clutter_actor_set_size (stage , SCREEN_W , SCREEN_H );
53
+
54
+ if (clutter_init (& argc , & argv ) != CLUTTER_INIT_SUCCESS )
55
+ return 1 ;
56
+
57
+ stage = clutter_stage_new ();
58
+ clutter_stage_set_title (CLUTTER_STAGE (stage ), "Circles" );
58
59
clutter_stage_set_color (CLUTTER_STAGE (stage ), & bg_color );
59
-
60
+ clutter_actor_set_size (stage , SCREEN_W , SCREEN_H );
61
+ g_signal_connect (stage , "destroy" , G_CALLBACK (clutter_main_quit ), NULL );
62
+
60
63
timeline = clutter_timeline_new (5000 );
61
64
clutter_timeline_set_loop (timeline , TRUE);
62
65
@@ -70,10 +73,11 @@ main (int argc, char **argv)
70
73
71
74
actor = clutter_rectangle_new_with_color (& transp );
72
75
73
- size = (i + 1 ) * (CIRCLE_W + CIRCLE_G ) * 2 ;
76
+ size = (i + 1 ) * (CIRCLE_W + CIRCLE_G ) * 2 ;
74
77
clutter_actor_set_size (actor , size , size );
75
- clutter_actor_set_position (actor , SCREEN_W - size /2 ,
76
- SCREEN_H - size /2 );
78
+ clutter_actor_set_position (actor ,
79
+ SCREEN_W - size / 2.0 ,
80
+ SCREEN_H - size / 2.0 );
77
81
78
82
clutter_container_add_actor (CLUTTER_CONTAINER (stage ), actor );
79
83
@@ -89,7 +93,9 @@ main (int argc, char **argv)
89
93
: CLUTTER_ROTATE_CCW ,
90
94
0.0 , 0.0 );
91
95
clutter_behaviour_rotate_set_center (CLUTTER_BEHAVIOUR_ROTATE (behaviour ),
92
- size /2 , size /2 , 0 );
96
+ size / 2 ,
97
+ size / 2 ,
98
+ 0 );
93
99
clutter_behaviour_apply (behaviour , actor );
94
100
}
95
101
@@ -101,4 +107,3 @@ main (int argc, char **argv)
101
107
102
108
return 0 ;
103
109
}
104
-
0 commit comments