This email list is read-only. Emails sent to this list will be discarded
----------------------------------
apple/apple.c | 258 ++++++++++++++++++++++++++++--------------------
colortext/colortext.c | 53 ++++++-----
squares/squares.c | 133 ++++++++++++++++----------
3 files changed, 261 insertions(+), 183 deletions(-)
New commits:
commit fd0822549bc28d1b6d56c1d392132e3c677dce33
Author: Felicia Decker <[EMAIL PROTECTED]>
Date: Fri Aug 15 14:23:46 2008 -0700
Changed colortext/apple/squares apps to be the same size as helloworld.
800x480
Diff in this email is a maximum of 400 lines.
diff --git a/apple/apple.c b/apple/apple.c
index d3ebef0..b947560 100644
--- a/apple/apple.c
+++ b/apple/apple.c
@@ -3,6 +3,18 @@
#include <sys/stat.h>
/**
+ This app looks best at 1024x600. So we'll
+ call this 100%. We can scale position and
+ image size down to a resolution of lower
+ value.
+ */
+#define SCN_WIDTH 800
+#define SCN_HEIGHT 480
+double scale_factor = .1;
+double x_scale_factor = .1;
+double y_scale_factor = .1;
+
+/**
Rings start from the top-inner ring of the
apple, moving out towards the top curve
and following down to the bottom-inside
@@ -50,6 +62,7 @@ ClutterActor *ring18[9];
#define ELLIPSE_X 640
#define NUM_PATH_KNOTS 70
+
ClutterActor *stage;
/* space between apple square pieces */
@@ -77,96 +90,98 @@ void add_to_ellipse_behaviour(ClutterTimeline
*timeline_rotation,
CLUTTER_ALPHA_RAMP_INC,
NULL, NULL);
ClutterBehaviour *behaviour;
+ double ellipse_x = ELLIPSE_X * x_scale_factor;
+ double ellipse_y = 170;
switch(line)
{
case RING1:
behaviour = clutter_behaviour_ellipse_new(
- alpha, ELLIPSE_X, 170, 135, 20, CLUTTER_ROTATE_CW, start_angle,
+ alpha, ellipse_x, ellipse_y * y_scale_factor, 135 * x_scale_factor,
20 * y_scale_factor, CLUTTER_ROTATE_CW, start_angle,
start_angle);
break;
case RING2:
behaviour = clutter_behaviour_ellipse_new(
- alpha, ELLIPSE_X, 160, 220, 50, CLUTTER_ROTATE_CW, start_angle,
+ alpha, ellipse_x, (ellipse_y - 10) * y_scale_factor, 220 *
x_scale_factor, 50 * y_scale_factor, CLUTTER_ROTATE_CW, start_angle,
start_angle);
break;
case RING3:
behaviour = clutter_behaviour_ellipse_new(
- alpha, ELLIPSE_X, 140, 305, 50, CLUTTER_ROTATE_CW, start_angle,
+ alpha, ellipse_x, (ellipse_y - 30) * y_scale_factor, 305 *
x_scale_factor, 50 * y_scale_factor, CLUTTER_ROTATE_CW, start_angle,
start_angle);
break;
case RING4:
behaviour = clutter_behaviour_ellipse_new(
- alpha, ELLIPSE_X, 120, 370, 50, CLUTTER_ROTATE_CW, start_angle,
+ alpha, ellipse_x, (ellipse_y - 50) * y_scale_factor, 370 *
x_scale_factor, 50 * y_scale_factor, CLUTTER_ROTATE_CW, start_angle,
start_angle);
break;
case RING5:
behaviour = clutter_behaviour_ellipse_new(
- alpha, ELLIPSE_X, 125, 450, 50, CLUTTER_ROTATE_CW, start_angle,
+ alpha, ellipse_x, (ellipse_y - 45) * y_scale_factor, 450 *
x_scale_factor, 50 * y_scale_factor, CLUTTER_ROTATE_CW, start_angle,
start_angle);
break;
case RING6:
behaviour = clutter_behaviour_ellipse_new(
- alpha, ELLIPSE_X, 140, 540, 100, CLUTTER_ROTATE_CW, start_angle,
+ alpha, ellipse_x, (ellipse_y - 30) * y_scale_factor, 540 *
x_scale_factor, 100 * y_scale_factor, CLUTTER_ROTATE_CW, start_angle,
start_angle);
break;
case RING7:
behaviour = clutter_behaviour_ellipse_new(
- alpha, ELLIPSE_X, 180, 580, 100, CLUTTER_ROTATE_CW, start_angle,
+ alpha, ellipse_x, (ellipse_y + 10) * y_scale_factor, 580 *
x_scale_factor, 100 * y_scale_factor, CLUTTER_ROTATE_CW, start_angle,
start_angle);
break;
case RING8:
behaviour = clutter_behaviour_ellipse_new(
- alpha, ELLIPSE_X, 220, 605, 100, CLUTTER_ROTATE_CW, start_angle,
+ alpha, ellipse_x, (ellipse_y + 50) * y_scale_factor, 605 *
x_scale_factor, 100 * y_scale_factor, CLUTTER_ROTATE_CW, start_angle,
start_angle);
break;
case RING9:
behaviour = clutter_behaviour_ellipse_new(
- alpha, ELLIPSE_X, 260, 605, 100, CLUTTER_ROTATE_CW, start_angle,
+ alpha, ellipse_x, (ellipse_y + 90) * y_scale_factor, 605 *
x_scale_factor, 100 * y_scale_factor, CLUTTER_ROTATE_CW, start_angle,
start_angle);
break;
case RING10:
behaviour = clutter_behaviour_ellipse_new(
- alpha, ELLIPSE_X, 300, 585, 100, CLUTTER_ROTATE_CW, start_angle,
+ alpha, ellipse_x, (ellipse_y + 130) * y_scale_factor, 585 *
x_scale_factor, 100 * y_scale_factor, CLUTTER_ROTATE_CW, start_angle,
start_angle);
break;
case RING11:
behaviour = clutter_behaviour_ellipse_new(
- alpha, ELLIPSE_X, 340, 565, 100, CLUTTER_ROTATE_CW, start_angle,
+ alpha, ellipse_x, (ellipse_y + 170) * y_scale_factor, 565 *
x_scale_factor, 100 * y_scale_factor, CLUTTER_ROTATE_CW, start_angle,
start_angle);
break;
case RING12:
behaviour = clutter_behaviour_ellipse_new(
- alpha, ELLIPSE_X, 380, 540, 100, CLUTTER_ROTATE_CW, start_angle,
+ alpha, ellipse_x, (ellipse_y + 210) * y_scale_factor, 540 *
x_scale_factor, 100 * y_scale_factor, CLUTTER_ROTATE_CW, start_angle,
start_angle);
break;
case RING13:
behaviour = clutter_behaviour_ellipse_new(
- alpha, ELLIPSE_X, 420, 500, 100, CLUTTER_ROTATE_CW, start_angle,
+ alpha, ellipse_x, (ellipse_y + 250) * y_scale_factor, 500 *
x_scale_factor, 100 * y_scale_factor, CLUTTER_ROTATE_CW, start_angle,
start_angle);
break;
case RING14:
behaviour = clutter_behaviour_ellipse_new(
- alpha, ELLIPSE_X, 460, 440, 100, CLUTTER_ROTATE_CW, start_angle,
+ alpha, ellipse_x, (ellipse_y + 290) * y_scale_factor, 440 *
x_scale_factor, 100 * y_scale_factor, CLUTTER_ROTATE_CW, start_angle,
start_angle);
break;
case RING15:
behaviour = clutter_behaviour_ellipse_new(
- alpha, ELLIPSE_X, 500, 370, 100, CLUTTER_ROTATE_CW, start_angle,
+ alpha, ellipse_x, (ellipse_y + 330) * y_scale_factor, 370 *
x_scale_factor, 100 * y_scale_factor, CLUTTER_ROTATE_CW, start_angle,
start_angle);
break;
case RING16:
behaviour = clutter_behaviour_ellipse_new(
- alpha, ELLIPSE_X, 500, 300, 50, CLUTTER_ROTATE_CW, start_angle,
+ alpha, ellipse_x, (ellipse_y + 330) * y_scale_factor, 300 *
x_scale_factor, 50 * y_scale_factor, CLUTTER_ROTATE_CW, start_angle,
start_angle);
break;
case RING17:
behaviour = clutter_behaviour_ellipse_new(
- alpha, ELLIPSE_X, 500, 210, 50, CLUTTER_ROTATE_CW, start_angle,
+ alpha, ellipse_x, (ellipse_y + 330) * y_scale_factor, 210 *
x_scale_factor, 50 * y_scale_factor, CLUTTER_ROTATE_CW, start_angle,
start_angle);
break;
case RING18:
behaviour = clutter_behaviour_ellipse_new(
- alpha, ELLIPSE_X, 480, 110, 30, CLUTTER_ROTATE_CW, start_angle,
+ alpha, ellipse_x, (ellipse_y + 310) * y_scale_factor, 110 *
x_scale_factor, 30 * y_scale_factor, CLUTTER_ROTATE_CW, start_angle,
start_angle);
break;
case STEM:
@@ -175,7 +190,7 @@ void add_to_ellipse_behaviour(ClutterTimeline
*timeline_rotation,
break;
default:
behaviour = clutter_behaviour_ellipse_new(
- alpha, ELLIPSE_X, 480, 110, 30, CLUTTER_ROTATE_CW, start_angle,
+ alpha, ellipse_x, (ellipse_y + 310) * y_scale_factor, 110 *
x_scale_factor, 30 * y_scale_factor, CLUTTER_ROTATE_CW, start_angle,
start_angle);
}
clutter_behaviour_apply(behaviour, actor);
@@ -198,89 +213,89 @@ void setup_path(ClutterActor *actor, ClutterTimeline
*timeline)
ClutterKnot knot[NUM_PATH_KNOTS];
- knot[0].x = 258; knot[0].y = 136;
- knot[1].x = 246; knot[1].y = 137;
- knot[2].x = 236; knot[2].y = 139;
- knot[3].x = 230; knot[3].y = 142;
- knot[4].x = 229; knot[4].y = 145; //5
-
- knot[5].x = 231; knot[5].y = 148;
- knot[6].x = 242; knot[6].y = 153;
- knot[7].x = 255; knot[7].y = 159;
- knot[8].x = 261; knot[8].y = 163;
- knot[9].x = 263; knot[9].y = 166; //10
-
- knot[10].x = 260; knot[10].y = 168;
- knot[11].x = 252; knot[11].y = 169;
- knot[12].x = 235; knot[12].y = 169;
- knot[13].x = 209; knot[13].y = 169;
- knot[14].x = 174; knot[14].y = 170; //15
-
- knot[15].x = 123; knot[15].y = 171;
- knot[16].x = 101; knot[16].y = 173;
- knot[17].x = 93; knot[17].y = 175;
- knot[18].x = 88; knot[18].y = 178;
- knot[19].x = 86; knot[19].y = 182; //20
-
- knot[20].x = 86; knot[20].y = 186;
- knot[21].x = 89; knot[21].y = 189;
- knot[22].x = 96; knot[22].y = 190;
- knot[23].x = 106; knot[23].y = 191;
- knot[24].x = 121; knot[24].y = 194; //25
-
- knot[25].x = 143; knot[25].y = 198;
- knot[26].x = 175; knot[26].y = 207;
- knot[27].x = 215; knot[27].y = 221;
- knot[28].x = 235; knot[28].y = 234;
- knot[29].x = 241; knot[29].y = 241; //30
+ knot[0].x = x_scale_factor * 258; knot[0].y = y_scale_factor * 136;
+ knot[1].x = x_scale_factor * 246; knot[1].y = y_scale_factor * 137;
+ knot[2].x = x_scale_factor * 236; knot[2].y = y_scale_factor * 139;
+ knot[3].x = x_scale_factor * 230; knot[3].y = y_scale_factor * 142;
+ knot[4].x = x_scale_factor * 229; knot[4].y = y_scale_factor * 145; //5
+
+ knot[5].x = x_scale_factor * 231; knot[5].y = y_scale_factor * 148;
+ knot[6].x = x_scale_factor * 242; knot[6].y = y_scale_factor * 153;
+ knot[7].x = x_scale_factor * 255; knot[7].y = y_scale_factor * 159;
+ knot[8].x = x_scale_factor * 261; knot[8].y = y_scale_factor * 163;
+ knot[9].x = x_scale_factor * 263; knot[9].y = y_scale_factor * 166; //10
+
+ knot[10].x = x_scale_factor * 260; knot[10].y = y_scale_factor * 168;
+ knot[11].x = x_scale_factor * 252; knot[11].y = y_scale_factor * 169;
+ knot[12].x = x_scale_factor * 235; knot[12].y = y_scale_factor * 169;
+ knot[13].x = x_scale_factor * 209; knot[13].y = y_scale_factor * 169;
+ knot[14].x = x_scale_factor * 174; knot[14].y = y_scale_factor * 170; //15
+
+ knot[15].x = x_scale_factor * 123; knot[15].y = y_scale_factor * 171;
+ knot[16].x = x_scale_factor * 101; knot[16].y = y_scale_factor * 173;
+ knot[17].x = x_scale_factor * 93; knot[17].y = y_scale_factor * 175;
+ knot[18].x = x_scale_factor * 88; knot[18].y = y_scale_factor * 178;
+ knot[19].x = x_scale_factor * 86; knot[19].y = y_scale_factor * 182; //20
+
+ knot[20].x = x_scale_factor * 86; knot[20].y = y_scale_factor * 186;
+ knot[21].x = x_scale_factor * 89; knot[21].y = y_scale_factor * 189;
+ knot[22].x = x_scale_factor * 96; knot[22].y = y_scale_factor * 190;
+ knot[23].x = x_scale_factor * 106; knot[23].y = y_scale_factor * 191;
+ knot[24].x = x_scale_factor * 121; knot[24].y = y_scale_factor * 194; //25
+
+ knot[25].x = x_scale_factor * 143; knot[25].y = y_scale_factor * 198;
+ knot[26].x = x_scale_factor * 175; knot[26].y = y_scale_factor * 207;
+ knot[27].x = x_scale_factor * 215; knot[27].y = y_scale_factor * 221;
+ knot[28].x = x_scale_factor * 235; knot[28].y = y_scale_factor * 234;
+ knot[29].x = x_scale_factor * 241; knot[29].y = y_scale_factor * 241; //30
- knot[30].x = 244; knot[30].y = 248;
- knot[31].x = 244; knot[31].y = 253;
- knot[32].x = 244; knot[32].y = 258;
- knot[33].x = 241; knot[33].y = 262;
- knot[34].x = 237; knot[34].y = 265; //35
-
- knot[35].x = 230; knot[35].y = 269;
- knot[36].x = 218; knot[36].y = 274;
- knot[37].x = 201; knot[37].y = 280;
- knot[38].x = 174; knot[38].y = 288;
- knot[39].x = 140; knot[39].y = 294; //40
-
- knot[40].x = 93; knot[40].y = 300;
- knot[41].x = 57; knot[41].y = 310;
- knot[42].x = 34; knot[42].y = 318;
- knot[43].x = 27; knot[43].y = 323;
- knot[44].x = 22; knot[44].y = 328; //45
-
- knot[45].x = 17; knot[45].y = 333;
- knot[46].x = 14; knot[46].y = 338;
- knot[47].x = 12; knot[47].y = 343;
- knot[48].x = 10; knot[48].y = 348;
- knot[49].x = 9; knot[49].y = 352; //50
-
- knot[50].x = 8; knot[50].y = 358;
- knot[51].x = 8; knot[51].y = 365;
- knot[52].x = 11; knot[52].y = 371;
- knot[53].x = 14; knot[53].y = 378;
- knot[54].x = 21; knot[54].y = 386; //55
-
- knot[55].x = 27; knot[55].y = 391;
- knot[56].x = 35; knot[56].y = 398;
- knot[57].x = 44; knot[57].y = 405;
- knot[58].x = 65; knot[58].y = 416;
- knot[59].x = 102; knot[59].y = 434; //60
-
- knot[60].x = 149; knot[60].y = 459;
- knot[61].x = 155; knot[61].y = 465;
- knot[62].x = 159; knot[62].y = 472;
- knot[63].x = 160; knot[63].y = 482;
- knot[64].x = 157; knot[64].y = 506; //65
-
- knot[65].x = 153; knot[65].y = 524;
- knot[66].x = 152; knot[66].y = 528;
- knot[67].x = 149; knot[67].y = 531;
- knot[68].x = 144; knot[68].y = 536;
- knot[69].x = 114; knot[69].y = 556; //70
+ knot[30].x = x_scale_factor * 244; knot[30].y = y_scale_factor * 248;
+ knot[31].x = x_scale_factor * 244; knot[31].y = y_scale_factor * 253;
+ knot[32].x = x_scale_factor * 244; knot[32].y = y_scale_factor * 258;
+ knot[33].x = x_scale_factor * 241; knot[33].y = y_scale_factor * 262;
+ knot[34].x = x_scale_factor * 237; knot[34].y = y_scale_factor * 265; //35
+
+ knot[35].x = x_scale_factor * 230; knot[35].y = y_scale_factor * 269;
+ knot[36].x = x_scale_factor * 218; knot[36].y = y_scale_factor * 274;
+ knot[37].x = x_scale_factor * 201; knot[37].y = y_scale_factor * 280;
+ knot[38].x = x_scale_factor * 174; knot[38].y = y_scale_factor * 288;
+ knot[39].x = x_scale_factor * 140; knot[39].y = y_scale_factor * 294; //40
+
+ knot[40].x = x_scale_factor * 93; knot[40].y = y_scale_factor * 300;
+ knot[41].x = x_scale_factor * 57; knot[41].y = y_scale_factor * 310;
+ knot[42].x = x_scale_factor * 34; knot[42].y = y_scale_factor * 318;
+ knot[43].x = x_scale_factor * 27; knot[43].y = y_scale_factor * 323;
+ knot[44].x = x_scale_factor * 22; knot[44].y = y_scale_factor * 328; //45
+
+ knot[45].x = x_scale_factor * 17; knot[45].y = y_scale_factor * 333;
+ knot[46].x = x_scale_factor * 14; knot[46].y = y_scale_factor * 338;
+ knot[47].x = x_scale_factor * 12; knot[47].y = y_scale_factor * 343;
+ knot[48].x = x_scale_factor * 10; knot[48].y = y_scale_factor * 348;
+ knot[49].x = x_scale_factor * 9; knot[49].y = y_scale_factor * 352; //50
+
+ knot[50].x = x_scale_factor * 8; knot[50].y = y_scale_factor * 358;
+ knot[51].x = x_scale_factor * 8; knot[51].y = y_scale_factor * 365;
+ knot[52].x = x_scale_factor * 11; knot[52].y = y_scale_factor * 371;
+ knot[53].x = x_scale_factor * 14; knot[53].y = y_scale_factor * 378;
+ knot[54].x = x_scale_factor * 21; knot[54].y = y_scale_factor * 386; //55
+
+ knot[55].x = x_scale_factor * 27; knot[55].y = y_scale_factor * 391;
+ knot[56].x = x_scale_factor * 35; knot[56].y = y_scale_factor * 398;
+ knot[57].x = x_scale_factor * 44; knot[57].y = y_scale_factor * 405;
+ knot[58].x = x_scale_factor * 65; knot[58].y = y_scale_factor * 416;
+ knot[59].x = x_scale_factor * 102; knot[59].y = y_scale_factor * 434; //60
+
+ knot[60].x = x_scale_factor * 149; knot[60].y = y_scale_factor * 459;
+ knot[61].x = x_scale_factor * 155; knot[61].y = y_scale_factor * 465;
+ knot[62].x = x_scale_factor * 159; knot[62].y = y_scale_factor * 472;
+ knot[63].x = x_scale_factor * 160; knot[63].y = y_scale_factor * 482;
+ knot[64].x = x_scale_factor * 157; knot[64].y = y_scale_factor * 506; //65
+
+ knot[65].x = x_scale_factor * 153; knot[65].y = y_scale_factor * 524;
+ knot[66].x = x_scale_factor * 152; knot[66].y = y_scale_factor * 528;
+ knot[67].x = x_scale_factor * 149; knot[67].y = y_scale_factor * 531;
+ knot[68].x = x_scale_factor * 144; knot[68].y = y_scale_factor * 536;
+ knot[69].x = x_scale_factor * 114; knot[69].y = y_scale_factor * 556; //70
alpha = clutter_alpha_new_full(timeline,
CLUTTER_ALPHA_SMOOTHSTEP_INC,
@@ -289,7 +304,7 @@ void setup_path(ClutterActor *actor, ClutterTimeline
*timeline)
knot,
sizeof(knot)/sizeof(ClutterKnot));
clutter_behaviour_apply(behaviour, actor);
- behaviour1 = clutter_behaviour_scale_new(alpha, .05, .05, 1, 1);
+ behaviour1 = clutter_behaviour_scale_new(alpha, .05, .05, x_scale_factor,
y_scale_factor);
clutter_behaviour_apply(behaviour1, actor);
}
@@ -306,7 +321,7 @@ void init_apple_piece(ClutterActor *apple_piece, int line,
gdouble angle)
{
ClutterColor apple_red = { 0xEE, 0x63, 0x63, 0xff };
apple_piece = clutter_rectangle_new_with_color(&apple_red);
- clutter_actor_set_size(apple_piece, 30, 30);
+ clutter_actor_set_size(apple_piece, 30 * y_scale_factor, 30 *
y_scale_factor);
clutter_actor_set_opacity(apple_piece, 80);
if (line == RING16 || line == RING17 || line == RING18) {
clutter_actor_set_opacity(apple_piece, 40);
@@ -515,7 +530,9 @@ int init_stem()
if (!stem) {
return -1;
}
- clutter_actor_set_position(stem, 480, 20);
+ clutter_actor_set_scale(stem, x_scale_factor, y_scale_factor);
+ clutter_actor_set_position(stem, 480 * x_scale_factor,
+ 20 * (1.0 + y_scale_factor));
clutter_container_add_actor(CLUTTER_CONTAINER(stage), stem);
clutter_actor_show(stem);
@@ -535,7 +552,8 @@ int init_leaf()
if (!leaf) {
return -1;
}
- clutter_actor_set_position(leaf, 630, 30);
+ clutter_actor_set_scale(leaf, x_scale_factor, y_scale_factor);
+ clutter_actor_set_position(leaf, 630 * x_scale_factor, 30 * (1.0 +
y_scale_factor));
clutter_container_add_actor(CLUTTER_CONTAINER(stage), leaf);
clutter_actor_show(leaf);
@@ -555,6 +573,8 @@ int init_caterpillar(ClutterTimeline *timeline)
if (!caterpillar) {
return -1;
}
+ //coors for set anchor are relative to the image itself
+ clutter_actor_set_scale(caterpillar, x_scale_factor, y_scale_factor);
clutter_actor_set_anchor_point(caterpillar, 75, 233);
clutter_container_add_actor(CLUTTER_CONTAINER(stage), caterpillar);
@@ -574,21 +594,43 @@ void path_complete(ClutterTimeline *timeline, gpointer
data)
if (!text_bubble) {
return;
}
- clutter_actor_set_position(text_bubble, 60, 50);
+
+ clutter_actor_set_scale(text_bubble, x_scale_factor, y_scale_factor);
+ clutter_actor_set_position(text_bubble, 60 * x_scale_factor, 50 *
y_scale_factor);
clutter_container_add_actor(CLUTTER_CONTAINER(stage), text_bubble);
return;
}
+/**
+ */
+void calc_scale_factors()
+{
+ double scn_height = SCN_HEIGHT, scn_width = SCN_WIDTH;
+ double res_x = 1024;
+ double res_y = 600;
+ double best_res = res_x * res_y;
+ double new_res = scn_width * scn_height;
_______________________________________________
Commits mailing list
[email protected]
https://www.moblin.org/mailman/listinfo/commits