gnome-games r8690 - trunk/gnometris
- From: jclinton svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-games r8690 - trunk/gnometris
- Date: Mon, 9 Feb 2009 05:57:46 +0000 (UTC)
Author: jclinton
Date: Mon Feb 9 05:57:46 2009
New Revision: 8690
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8690&view=rev
Log:
Add rotation preview window. Has a few issues.
The rotation is off-center because of legacy matrix sizes. Also, the box
still doesn't scale to maintain compat. with older engine. This older
engine will be ripped out in 2.27 so hopefully this is a temporary
limitation.
Modified:
trunk/gnometris/preview.cpp
trunk/gnometris/preview.h
Modified: trunk/gnometris/preview.cpp
==============================================================================
--- trunk/gnometris/preview.cpp (original)
+++ trunk/gnometris/preview.cpp Mon Feb 9 05:57:46 2009
@@ -62,6 +62,19 @@
clutter_group_add (CLUTTER_GROUP (stage),
rotar);
clutter_actor_show_all (stage);
+
+ rot_timeline = clutter_timeline_new_for_duration (5000);
+ clutter_timeline_set_loop (rot_timeline, true);
+ alpha = clutter_alpha_new_full (rot_timeline,
+ CLUTTER_ALPHA_RAMP_INC,
+ NULL, NULL);
+ rot_behav = clutter_behaviour_rotate_new (alpha,
+ CLUTTER_Z_AXIS, CLUTTER_ROTATE_CW, 0.0, 360.0);
+ clutter_behaviour_rotate_set_center (CLUTTER_BEHAVIOUR_ROTATE (rot_behav),
+ PREVIEW_SIZE*12, PREVIEW_SIZE*12, 0);
+ clutter_actor_set_position (CLUTTER_ACTOR(rotar), 0, 0);
+ clutter_behaviour_apply (rot_behav, rotar);
+ clutter_timeline_start (rot_timeline);
}
Preview::~Preview ()
@@ -89,9 +102,9 @@
if (renderer) {
delete renderer;
- renderer = rendererFactory (themeID, PREVIEW_SIZE, PREVIEW_SIZE);
+ renderer = rendererFactory (themeID, PREVIEW_SIZE*4, PREVIEW_SIZE*4);
} else {
- renderer = rendererFactory (themeID, PREVIEW_SIZE, PREVIEW_SIZE);
+ renderer = rendererFactory (themeID, PREVIEW_SIZE*4, PREVIEW_SIZE*4);
}
}
@@ -99,9 +112,9 @@
Preview::regenerateRenderer ()
{
if (renderer)
- renderer->rescaleCache (PREVIEW_SIZE, PREVIEW_SIZE);
+ renderer->rescaleCache (PREVIEW_SIZE*4, PREVIEW_SIZE*4);
else {
- renderer = rendererFactory (themeID, PREVIEW_SIZE, PREVIEW_SIZE);
+ renderer = rendererFactory (themeID, PREVIEW_SIZE*4, PREVIEW_SIZE*4);
}
}
@@ -124,7 +137,7 @@
blocks[x][y].createActor (rotar,
renderer->getCacheCellById (color));
clutter_actor_set_position (CLUTTER_ACTOR(blocks[x][y].actor),
- x*PREVIEW_SIZE, y*PREVIEW_SIZE);
+ x*PREVIEW_SIZE*4, y*PREVIEW_SIZE*4);
} else {
blocks[x][y].what = EMPTY;
if (blocks[x][y].actor) {
@@ -141,13 +154,8 @@
void
Preview::positionRotar()
{
- clutter_actor_set_anchor_pointu (CLUTTER_ACTOR(rotar),
- CLUTTER_UNITS_FROM_PARENT_WIDTH_PERCENTAGE(rotar, 50),
- CLUTTER_UNITS_FROM_PARENT_HEIGHT_PERCENTAGE(rotar, 50));
- clutter_actor_set_positionu (CLUTTER_ACTOR(rotar),
- CLUTTER_UNITS_FROM_STAGE_WIDTH_PERCENTAGE(50),
- CLUTTER_UNITS_FROM_STAGE_HEIGHT_PERCENTAGE(50));
+ //
}
gint
Modified: trunk/gnometris/preview.h
==============================================================================
--- trunk/gnometris/preview.h (original)
+++ trunk/gnometris/preview.h Mon Feb 9 05:57:46 2009
@@ -53,6 +53,10 @@
gint color;
gint themeID;
+ ClutterTimeline *rot_timeline;
+ ClutterAlpha *alpha;
+ ClutterBehaviour *rot_behav;
+
Block **blocks;
ClutterActor* rotar;
Renderer* renderer;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]