/* game-view.c generated by valac 0.16.0, the Vala compiler
 * generated from game-view.vala, do not modify */


#include <glib.h>
#include <glib-object.h>
#include <clutter/clutter.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <math.h>
#include <glib/gi18n-lib.h>
#include <pango/pango.h>
#include <gobject/gvaluecollector.h>


#define TYPE_GAME_VIEW (game_view_get_type ())
#define GAME_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GAME_VIEW, GameView))
#define GAME_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GAME_VIEW, GameViewClass))
#define IS_GAME_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GAME_VIEW))
#define IS_GAME_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GAME_VIEW))
#define GAME_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GAME_VIEW, GameViewClass))

typedef struct _GameView GameView;
typedef struct _GameViewClass GameViewClass;
typedef struct _GameViewPrivate GameViewPrivate;

#define TYPE_TILE_ACTOR (tile_actor_get_type ())
#define TILE_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TILE_ACTOR, TileActor))
#define TILE_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TILE_ACTOR, TileActorClass))
#define IS_TILE_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TILE_ACTOR))
#define IS_TILE_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TILE_ACTOR))
#define TILE_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TILE_ACTOR, TileActorClass))

typedef struct _TileActor TileActor;
typedef struct _TileActorClass TileActorClass;

#define TYPE_GAME (game_get_type ())
#define GAME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GAME, Game))
#define GAME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GAME, GameClass))
#define IS_GAME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GAME))
#define IS_GAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GAME))
#define GAME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GAME, GameClass))

typedef struct _Game Game;
typedef struct _GameClass GameClass;

#define TYPE_THEME (theme_get_type ())
#define THEME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_THEME, Theme))
#define THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_THEME, ThemeClass))
#define IS_THEME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_THEME))
#define IS_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_THEME))
#define THEME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_THEME, ThemeClass))

typedef struct _Theme Theme;
typedef struct _ThemeClass ThemeClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _theme_unref0(var) ((var == NULL) ? NULL : (var = (theme_unref (var), NULL)))

#define TYPE_TILE (tile_get_type ())
#define TILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TILE, Tile))
#define TILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TILE, TileClass))
#define IS_TILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TILE))
#define IS_TILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TILE))
#define TILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TILE, TileClass))

typedef struct _Tile Tile;
typedef struct _TileClass TileClass;
#define _tile_unref0(var) ((var == NULL) ? NULL : (var = (tile_unref (var), NULL)))
typedef struct _ThemePrivate ThemePrivate;
typedef struct _TilePrivate TilePrivate;
typedef struct _TileActorPrivate TileActorPrivate;
#define __g_list_free__tile_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__tile_unref0_ (var), NULL)))

#define TYPE_SCORE_ACTOR (score_actor_get_type ())
#define SCORE_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SCORE_ACTOR, ScoreActor))
#define SCORE_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SCORE_ACTOR, ScoreActorClass))
#define IS_SCORE_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SCORE_ACTOR))
#define IS_SCORE_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SCORE_ACTOR))
#define SCORE_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SCORE_ACTOR, ScoreActorClass))

typedef struct _ScoreActor ScoreActor;
typedef struct _ScoreActorClass ScoreActorClass;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _ParamSpecTheme ParamSpecTheme;
typedef struct _ScoreActorPrivate ScoreActorPrivate;

struct _GameView {
	ClutterGroup parent_instance;
	GameViewPrivate * priv;
	gboolean is_zealous;
};

struct _GameViewClass {
	ClutterGroupClass parent_class;
};

struct _GameViewPrivate {
	TileActor** tiles;
	gint tiles_length1;
	gint tiles_length2;
	ClutterGroup* game_actors;
	Game* _game;
	GHashTable* themes;
	gchar* _theme_name;
	gint tile_size;
};

struct _Theme {
	GTypeInstance parent_instance;
	volatile int ref_count;
	ThemePrivate * priv;
	ClutterTexture** textures;
	gint textures_length1;
};

struct _ThemeClass {
	GTypeClass parent_class;
	void (*finalize) (Theme *self);
};

struct _Tile {
	GTypeInstance parent_instance;
	volatile int ref_count;
	TilePrivate * priv;
	gint grid_x;
	gint grid_y;
	gint color;
	gboolean visited;
};

struct _TileClass {
	GTypeClass parent_class;
	void (*finalize) (Tile *self);
};

struct _TileActor {
	ClutterClone parent_instance;
	TileActorPrivate * priv;
	Tile* tile;
};

struct _TileActorClass {
	ClutterCloneClass parent_class;
};

struct _ParamSpecTheme {
	GParamSpec parent_instance;
};

struct _ScoreActor {
	ClutterGroup parent_instance;
	ScoreActorPrivate * priv;
};

struct _ScoreActorClass {
	ClutterGroupClass parent_class;
};

struct _ScoreActorPrivate {
	ClutterText* label;
	gfloat scene_width;
	gfloat scene_height;
};


static gpointer game_view_parent_class = NULL;
static gpointer theme_parent_class = NULL;
static gpointer tile_actor_parent_class = NULL;
static gpointer score_actor_parent_class = NULL;

GType game_view_get_type (void) G_GNUC_CONST;
GType tile_actor_get_type (void) G_GNUC_CONST;
GType game_get_type (void) G_GNUC_CONST;
gpointer theme_ref (gpointer instance);
void theme_unref (gpointer instance);
GParamSpec* param_spec_theme (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_theme (GValue* value, gpointer v_object);
void value_take_theme (GValue* value, gpointer v_object);
gpointer value_get_theme (const GValue* value);
GType theme_get_type (void) G_GNUC_CONST;
#define GAME_VIEW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_GAME_VIEW, GameViewPrivate))
enum  {
	GAME_VIEW_DUMMY_PROPERTY,
	GAME_VIEW_GAME,
	GAME_VIEW_THEME_NAME
};
static void game_view_remove_tiles (GameView* self);
Game* game_view_get_game (GameView* self);
gint game_get_columns (Game* self);
gint game_get_rows (Game* self);
static void game_view_place_tiles (GameView* self);
const gchar* game_view_get_theme_name (GameView* self);
gpointer tile_ref (gpointer instance);
void tile_unref (gpointer instance);
GParamSpec* param_spec_tile (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_tile (GValue* value, gpointer v_object);
void value_take_tile (GValue* value, gpointer v_object);
gpointer value_get_tile (const GValue* value);
GType tile_get_type (void) G_GNUC_CONST;
Tile* game_get_tile (Game* self, gint x, gint y);
TileActor* tile_actor_new (Tile* tile, ClutterTexture* texture, gint size);
TileActor* tile_actor_construct (GType object_type, Tile* tile, ClutterTexture* texture, gint size);
void game_view_move_cb (GameView* self, gint old_x, gint old_y, gint new_x, gint new_y);
static void _game_view_move_cb_tile_move (Tile* _sender, gint old_x, gint old_y, gint new_x, gint new_y, gpointer self);
void game_view_close_cb (GameView* self, gint grid_x, gint grid_y);
static void _game_view_close_cb_tile_close (Tile* _sender, gint grid_x, gint grid_y, gpointer self);
static gboolean game_view_remove_region_cb (GameView* self, ClutterActor* actor, ClutterButtonEvent* event);
static gboolean _game_view_remove_region_cb_clutter_actor_button_release_event (ClutterActor* _sender, ClutterButtonEvent* event, gpointer self);
static gboolean game_view_tile_entered_cb (GameView* self, ClutterActor* actor, ClutterCrossingEvent* event);
static gboolean _game_view_tile_entered_cb_clutter_actor_enter_event (ClutterActor* _sender, ClutterCrossingEvent* event, gpointer self);
static gboolean game_view_tile_left_cb (GameView* self, ClutterActor* actor, ClutterCrossingEvent* event);
static gboolean _game_view_tile_left_cb_clutter_actor_leave_event (ClutterActor* _sender, ClutterCrossingEvent* event, gpointer self);
GameView* game_view_new (void);
GameView* game_view_construct (GType object_type);
static void _g_free0_ (gpointer var);
static void _theme_unref0_ (gpointer var);
Theme* theme_new (const gchar* name);
Theme* theme_construct (GType object_type, const gchar* name);
void tile_actor_animate_out (TileActor* self);
void tile_actor_animate_to (TileActor* self, gdouble new_x, gdouble new_y, gboolean is_zealous);
GList* game_connected_tiles (Game* self, Tile* li);
static void _tile_unref0_ (gpointer var);
static void _g_list_free__tile_unref0_ (GList* self);
gboolean game_remove_connected_tiles (Game* self, Tile* tile);
gboolean game_view_board_left_cb (GameView* self);
void game_reset_visit (Game* self);
void game_view_update_score_cb (GameView* self, gint points_awarded);
ScoreActor* score_actor_new (gdouble x, gdouble y, gdouble width, gdouble height);
ScoreActor* score_actor_construct (GType object_type, gdouble x, gdouble y, gdouble width, gdouble height);
GType score_actor_get_type (void) G_GNUC_CONST;
void score_actor_animate_score (ScoreActor* self, gint points);
void game_view_game_complete_cb (GameView* self);
void score_actor_animate_final_score (ScoreActor* self, guint points);
gint game_get_score (Game* self);
void game_view_set_game (GameView* self, Game* value);
static void _game_view_game_complete_cb_game_complete (Game* _sender, gpointer self);
static void _game_view_update_score_cb_game_update_score (Game* _sender, gint points_awarded, gpointer self);
void game_view_set_theme_name (GameView* self, const gchar* value);
static void game_view_finalize (GObject* obj);
static void _vala_game_view_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_game_view_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
enum  {
	THEME_DUMMY_PROPERTY
};
static void theme_finalize (Theme* obj);
enum  {
	TILE_ACTOR_DUMMY_PROPERTY
};
static void tile_actor_hide_tile_cb (TileActor* self);
static void _tile_actor_hide_tile_cb_clutter_timeline_completed (ClutterTimeline* _sender, gpointer self);
static void tile_actor_finalize (GObject* obj);
#define SCORE_ACTOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_SCORE_ACTOR, ScoreActorPrivate))
enum  {
	SCORE_ACTOR_DUMMY_PROPERTY
};
static void __lambda2_ (ScoreActor* self);
static void ___lambda2__clutter_timeline_completed (ClutterTimeline* _sender, gpointer self);
static void score_actor_finalize (GObject* obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);


static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


static void game_view_remove_tiles (GameView* self) {
	Game* _tmp0_;
	Game* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = game_view_get_game (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == NULL) {
		return;
	}
	{
		gint x;
		x = 0;
		{
			gboolean _tmp2_;
			_tmp2_ = TRUE;
			while (TRUE) {
				gboolean _tmp3_;
				gint _tmp5_;
				Game* _tmp6_;
				Game* _tmp7_;
				gint _tmp8_;
				gint _tmp9_;
				_tmp3_ = _tmp2_;
				if (!_tmp3_) {
					gint _tmp4_;
					_tmp4_ = x;
					x = _tmp4_ + 1;
				}
				_tmp2_ = FALSE;
				_tmp5_ = x;
				_tmp6_ = game_view_get_game (self);
				_tmp7_ = _tmp6_;
				_tmp8_ = game_get_columns (_tmp7_);
				_tmp9_ = _tmp8_;
				if (!(_tmp5_ < _tmp9_)) {
					break;
				}
				{
					gint y;
					y = 0;
					{
						gboolean _tmp10_;
						_tmp10_ = TRUE;
						while (TRUE) {
							gboolean _tmp11_;
							gint _tmp13_;
							Game* _tmp14_;
							Game* _tmp15_;
							gint _tmp16_;
							gint _tmp17_;
							TileActor** _tmp18_;
							gint _tmp18__length1;
							gint _tmp18__length2;
							gint _tmp19_;
							gint _tmp20_;
							TileActor* _tmp21_;
							TileActor* _tmp22_;
							TileActor* tile;
							TileActor* _tmp23_;
							TileActor** _tmp24_;
							gint _tmp24__length1;
							gint _tmp24__length2;
							gint _tmp25_;
							gint _tmp26_;
							TileActor* _tmp27_;
							TileActor* _tmp28_;
							TileActor* _tmp29_;
							_tmp11_ = _tmp10_;
							if (!_tmp11_) {
								gint _tmp12_;
								_tmp12_ = y;
								y = _tmp12_ + 1;
							}
							_tmp10_ = FALSE;
							_tmp13_ = y;
							_tmp14_ = game_view_get_game (self);
							_tmp15_ = _tmp14_;
							_tmp16_ = game_get_rows (_tmp15_);
							_tmp17_ = _tmp16_;
							if (!(_tmp13_ < _tmp17_)) {
								break;
							}
							_tmp18_ = self->priv->tiles;
							_tmp18__length1 = self->priv->tiles_length1;
							_tmp18__length2 = self->priv->tiles_length2;
							_tmp19_ = x;
							_tmp20_ = y;
							_tmp21_ = _tmp18_[(_tmp19_ * _tmp18__length2) + _tmp20_];
							_tmp22_ = _g_object_ref0 (_tmp21_);
							tile = _tmp22_;
							_tmp23_ = tile;
							if (_tmp23_ == NULL) {
								_g_object_unref0 (tile);
								continue;
							}
							_tmp24_ = self->priv->tiles;
							_tmp24__length1 = self->priv->tiles_length1;
							_tmp24__length2 = self->priv->tiles_length2;
							_tmp25_ = x;
							_tmp26_ = y;
							_g_object_unref0 (_tmp24_[(_tmp25_ * _tmp24__length2) + _tmp26_]);
							_tmp24_[(_tmp25_ * _tmp24__length2) + _tmp26_] = NULL;
							_tmp27_ = _tmp24_[(_tmp25_ * _tmp24__length2) + _tmp26_];
							_tmp28_ = tile;
							g_signal_handlers_disconnect_matched (_tmp28_, G_SIGNAL_MATCH_DATA, (guint) 0, (GQuark) 0, NULL, NULL, self);
							_tmp29_ = tile;
							clutter_actor_destroy ((ClutterActor*) _tmp29_);
							_g_object_unref0 (tile);
						}
					}
				}
			}
		}
	}
}


static gpointer _theme_ref0 (gpointer self) {
	return self ? theme_ref (self) : NULL;
}


static void _game_view_move_cb_tile_move (Tile* _sender, gint old_x, gint old_y, gint new_x, gint new_y, gpointer self) {
	game_view_move_cb (self, old_x, old_y, new_x, new_y);
}


static void _game_view_close_cb_tile_close (Tile* _sender, gint grid_x, gint grid_y, gpointer self) {
	game_view_close_cb (self, grid_x, grid_y);
}


static gboolean _game_view_remove_region_cb_clutter_actor_button_release_event (ClutterActor* _sender, ClutterButtonEvent* event, gpointer self) {
	gboolean result;
	result = game_view_remove_region_cb (self, _sender, event);
	return result;
}


static gboolean _game_view_tile_entered_cb_clutter_actor_enter_event (ClutterActor* _sender, ClutterCrossingEvent* event, gpointer self) {
	gboolean result;
	result = game_view_tile_entered_cb (self, _sender, event);
	return result;
}


static gboolean _game_view_tile_left_cb_clutter_actor_leave_event (ClutterActor* _sender, ClutterCrossingEvent* event, gpointer self) {
	gboolean result;
	result = game_view_tile_left_cb (self, _sender, event);
	return result;
}


static void game_view_place_tiles (GameView* self) {
	Game* _tmp0_;
	Game* _tmp1_;
	GHashTable* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	gconstpointer _tmp5_ = NULL;
	Theme* _tmp6_;
	Theme* theme;
	Theme* _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp0_ = game_view_get_game (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == NULL) {
		return;
	}
	_tmp2_ = self->priv->themes;
	_tmp3_ = game_view_get_theme_name (self);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_hash_table_lookup (_tmp2_, _tmp4_);
	_tmp6_ = _theme_ref0 ((Theme*) _tmp5_);
	theme = _tmp6_;
	_tmp7_ = theme;
	if (_tmp7_ == NULL) {
		GHashTable* _tmp8_;
		gconstpointer _tmp9_ = NULL;
		Theme* _tmp10_;
		_tmp8_ = self->priv->themes;
		_tmp9_ = g_hash_table_lookup (_tmp8_, "shapesandcolors");
		_tmp10_ = _theme_ref0 ((Theme*) _tmp9_);
		_theme_unref0 (theme);
		theme = _tmp10_;
	}
	{
		gint x;
		x = 0;
		{
			gboolean _tmp11_;
			_tmp11_ = TRUE;
			while (TRUE) {
				gboolean _tmp12_;
				gint _tmp14_;
				Game* _tmp15_;
				Game* _tmp16_;
				gint _tmp17_;
				gint _tmp18_;
				_tmp12_ = _tmp11_;
				if (!_tmp12_) {
					gint _tmp13_;
					_tmp13_ = x;
					x = _tmp13_ + 1;
				}
				_tmp11_ = FALSE;
				_tmp14_ = x;
				_tmp15_ = game_view_get_game (self);
				_tmp16_ = _tmp15_;
				_tmp17_ = game_get_columns (_tmp16_);
				_tmp18_ = _tmp17_;
				if (!(_tmp14_ < _tmp18_)) {
					break;
				}
				{
					gint y;
					y = 0;
					{
						gboolean _tmp19_;
						_tmp19_ = TRUE;
						while (TRUE) {
							gboolean _tmp20_;
							gint _tmp22_;
							Game* _tmp23_;
							Game* _tmp24_;
							gint _tmp25_;
							gint _tmp26_;
							Game* _tmp27_;
							Game* _tmp28_;
							gint _tmp29_;
							gint _tmp30_;
							Tile* _tmp31_ = NULL;
							Tile* l;
							Tile* _tmp32_;
							Tile* _tmp33_;
							Theme* _tmp34_;
							ClutterTexture** _tmp35_;
							gint _tmp35__length1;
							Tile* _tmp36_;
							gint _tmp37_;
							ClutterTexture* _tmp38_;
							gint _tmp39_;
							TileActor* _tmp40_;
							TileActor* _tmp41_;
							TileActor* tile;
							Tile* _tmp42_;
							Tile* _tmp43_;
							gfloat xx = 0.0F;
							gfloat yy = 0.0F;
							gint _tmp44_;
							gint _tmp45_;
							gint _tmp46_;
							Game* _tmp47_;
							Game* _tmp48_;
							gint _tmp49_;
							gint _tmp50_;
							gint _tmp51_;
							gint _tmp52_;
							gint _tmp53_;
							TileActor* _tmp54_;
							gfloat _tmp55_;
							gfloat _tmp56_;
							TileActor* _tmp57_;
							TileActor* _tmp58_;
							TileActor* _tmp59_;
							TileActor* _tmp60_;
							TileActor** _tmp61_;
							gint _tmp61__length1;
							gint _tmp61__length2;
							gint _tmp62_;
							gint _tmp63_;
							TileActor* _tmp64_;
							TileActor* _tmp65_;
							TileActor* _tmp66_;
							ClutterGroup* _tmp67_;
							TileActor* _tmp68_;
							_tmp20_ = _tmp19_;
							if (!_tmp20_) {
								gint _tmp21_;
								_tmp21_ = y;
								y = _tmp21_ + 1;
							}
							_tmp19_ = FALSE;
							_tmp22_ = y;
							_tmp23_ = game_view_get_game (self);
							_tmp24_ = _tmp23_;
							_tmp25_ = game_get_rows (_tmp24_);
							_tmp26_ = _tmp25_;
							if (!(_tmp22_ < _tmp26_)) {
								break;
							}
							_tmp27_ = game_view_get_game (self);
							_tmp28_ = _tmp27_;
							_tmp29_ = x;
							_tmp30_ = y;
							_tmp31_ = game_get_tile (_tmp28_, _tmp29_, _tmp30_);
							l = _tmp31_;
							_tmp32_ = l;
							if (_tmp32_ == NULL) {
								_tile_unref0 (l);
								continue;
							}
							_tmp33_ = l;
							_tmp34_ = theme;
							_tmp35_ = _tmp34_->textures;
							_tmp35__length1 = _tmp34_->textures_length1;
							_tmp36_ = l;
							_tmp37_ = _tmp36_->color;
							_tmp38_ = _tmp35_[_tmp37_];
							_tmp39_ = self->priv->tile_size;
							_tmp40_ = tile_actor_new (_tmp33_, _tmp38_, _tmp39_);
							_tmp41_ = g_object_ref_sink (_tmp40_);
							tile = _tmp41_;
							_tmp42_ = l;
							g_signal_connect_object (_tmp42_, "move", (GCallback) _game_view_move_cb_tile_move, self, 0);
							_tmp43_ = l;
							g_signal_connect_object (_tmp43_, "close", (GCallback) _game_view_close_cb_tile_close, self, 0);
							_tmp44_ = x;
							_tmp45_ = self->priv->tile_size;
							_tmp46_ = self->priv->tile_size;
							xx = (gfloat) ((_tmp44_ * _tmp45_) + (_tmp46_ / 2));
							_tmp47_ = game_view_get_game (self);
							_tmp48_ = _tmp47_;
							_tmp49_ = game_get_rows (_tmp48_);
							_tmp50_ = _tmp49_;
							_tmp51_ = y;
							_tmp52_ = self->priv->tile_size;
							_tmp53_ = self->priv->tile_size;
							yy = (gfloat) ((((_tmp50_ - _tmp51_) - 1) * _tmp52_) + (_tmp53_ / 2));
							_tmp54_ = tile;
							_tmp55_ = xx;
							_tmp56_ = yy;
							clutter_actor_set_position ((ClutterActor*) _tmp54_, _tmp55_, _tmp56_);
							_tmp57_ = tile;
							clutter_actor_set_reactive ((ClutterActor*) _tmp57_, TRUE);
							_tmp58_ = tile;
							g_signal_connect_object ((ClutterActor*) _tmp58_, "button-release-event", (GCallback) _game_view_remove_region_cb_clutter_actor_button_release_event, self, 0);
							_tmp59_ = tile;
							g_signal_connect_object ((ClutterActor*) _tmp59_, "enter-event", (GCallback) _game_view_tile_entered_cb_clutter_actor_enter_event, self, 0);
							_tmp60_ = tile;
							g_signal_connect_object ((ClutterActor*) _tmp60_, "leave-event", (GCallback) _game_view_tile_left_cb_clutter_actor_leave_event, self, 0);
							_tmp61_ = self->priv->tiles;
							_tmp61__length1 = self->priv->tiles_length1;
							_tmp61__length2 = self->priv->tiles_length2;
							_tmp62_ = x;
							_tmp63_ = y;
							_tmp64_ = tile;
							_tmp65_ = _g_object_ref0 (_tmp64_);
							_g_object_unref0 (_tmp61_[(_tmp62_ * _tmp61__length2) + _tmp63_]);
							_tmp61_[(_tmp62_ * _tmp61__length2) + _tmp63_] = _tmp65_;
							_tmp66_ = _tmp61_[(_tmp62_ * _tmp61__length2) + _tmp63_];
							_tmp67_ = self->priv->game_actors;
							_tmp68_ = tile;
							clutter_container_add_actor ((ClutterContainer*) _tmp67_, (ClutterActor*) _tmp68_);
							_g_object_unref0 (tile);
							_tile_unref0 (l);
						}
					}
				}
			}
		}
	}
	_theme_unref0 (theme);
}


static void _g_free0_ (gpointer var) {
	var = (g_free (var), NULL);
}


static void _theme_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (theme_unref (var), NULL));
}


GameView* game_view_construct (GType object_type) {
	GameView * self = NULL;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	Theme* _tmp3_;
	Theme* theme;
	GHashTable* _tmp4_;
	gchar* _tmp5_;
	Theme* _tmp6_;
	Theme* _tmp7_;
	Theme* _tmp8_;
	ClutterTexture** _tmp9_;
	gint _tmp9__length1;
	Theme* _tmp13_;
	GHashTable* _tmp14_;
	gchar* _tmp15_;
	Theme* _tmp16_;
	Theme* _tmp17_;
	Theme* _tmp18_;
	ClutterTexture** _tmp19_;
	gint _tmp19__length1;
	self = (GameView*) g_object_new (object_type, NULL);
	_tmp0_ = g_str_hash;
	_tmp1_ = g_str_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _g_free0_, _theme_unref0_);
	_g_hash_table_unref0 (self->priv->themes);
	self->priv->themes = _tmp2_;
	_tmp3_ = theme_new ("colors");
	theme = _tmp3_;
	_tmp4_ = self->priv->themes;
	_tmp5_ = g_strdup ("colors");
	_tmp6_ = theme;
	_tmp7_ = _theme_ref0 (_tmp6_);
	g_hash_table_insert (_tmp4_, _tmp5_, _tmp7_);
	_tmp8_ = theme;
	_tmp9_ = _tmp8_->textures;
	_tmp9__length1 = _tmp8_->textures_length1;
	{
		ClutterTexture** t_collection = NULL;
		gint t_collection_length1 = 0;
		gint _t_collection_size_ = 0;
		gint t_it = 0;
		t_collection = _tmp9_;
		t_collection_length1 = _tmp9__length1;
		for (t_it = 0; t_it < _tmp9__length1; t_it = t_it + 1) {
			ClutterTexture* _tmp10_;
			ClutterTexture* t = NULL;
			_tmp10_ = _g_object_ref0 (t_collection[t_it]);
			t = _tmp10_;
			{
				ClutterTexture* _tmp11_;
				ClutterTexture* _tmp12_;
				_tmp11_ = t;
				clutter_actor_hide ((ClutterActor*) _tmp11_);
				_tmp12_ = t;
				clutter_container_add_actor ((ClutterContainer*) self, (ClutterActor*) _tmp12_);
				_g_object_unref0 (t);
			}
		}
	}
	_tmp13_ = theme_new ("shapesandcolors");
	_theme_unref0 (theme);
	theme = _tmp13_;
	_tmp14_ = self->priv->themes;
	_tmp15_ = g_strdup ("shapesandcolors");
	_tmp16_ = theme;
	_tmp17_ = _theme_ref0 (_tmp16_);
	g_hash_table_insert (_tmp14_, _tmp15_, _tmp17_);
	_tmp18_ = theme;
	_tmp19_ = _tmp18_->textures;
	_tmp19__length1 = _tmp18_->textures_length1;
	{
		ClutterTexture** t_collection = NULL;
		gint t_collection_length1 = 0;
		gint _t_collection_size_ = 0;
		gint t_it = 0;
		t_collection = _tmp19_;
		t_collection_length1 = _tmp19__length1;
		for (t_it = 0; t_it < _tmp19__length1; t_it = t_it + 1) {
			ClutterTexture* _tmp20_;
			ClutterTexture* t = NULL;
			_tmp20_ = _g_object_ref0 (t_collection[t_it]);
			t = _tmp20_;
			{
				ClutterTexture* _tmp21_;
				ClutterTexture* _tmp22_;
				_tmp21_ = t;
				clutter_actor_hide ((ClutterActor*) _tmp21_);
				_tmp22_ = t;
				clutter_container_add_actor ((ClutterContainer*) self, (ClutterActor*) _tmp22_);
				_g_object_unref0 (t);
			}
		}
	}
	_theme_unref0 (theme);
	return self;
}


GameView* game_view_new (void) {
	return game_view_construct (TYPE_GAME_VIEW);
}


void game_view_close_cb (GameView* self, gint grid_x, gint grid_y) {
	TileActor** _tmp0_;
	gint _tmp0__length1;
	gint _tmp0__length2;
	gint _tmp1_;
	gint _tmp2_;
	TileActor* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->tiles;
	_tmp0__length1 = self->priv->tiles_length1;
	_tmp0__length2 = self->priv->tiles_length2;
	_tmp1_ = grid_x;
	_tmp2_ = grid_y;
	_tmp3_ = _tmp0_[(_tmp1_ * _tmp0__length2) + _tmp2_];
	tile_actor_animate_out (_tmp3_);
}


void game_view_move_cb (GameView* self, gint old_x, gint old_y, gint new_x, gint new_y) {
	TileActor** _tmp0_;
	gint _tmp0__length1;
	gint _tmp0__length2;
	gint _tmp1_;
	gint _tmp2_;
	TileActor* _tmp3_;
	TileActor* _tmp4_;
	TileActor* tile;
	TileActor** _tmp5_;
	gint _tmp5__length1;
	gint _tmp5__length2;
	gint _tmp6_;
	gint _tmp7_;
	TileActor* _tmp8_;
	TileActor* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	gdouble new_xx;
	Game* _tmp13_;
	Game* _tmp14_;
	gint _tmp15_;
	gint _tmp16_;
	gint _tmp17_;
	gint _tmp18_;
	gint _tmp19_;
	gdouble new_yy;
	gboolean _tmp20_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->tiles;
	_tmp0__length1 = self->priv->tiles_length1;
	_tmp0__length2 = self->priv->tiles_length2;
	_tmp1_ = old_x;
	_tmp2_ = old_y;
	_tmp3_ = _tmp0_[(_tmp1_ * _tmp0__length2) + _tmp2_];
	_tmp4_ = _g_object_ref0 (_tmp3_);
	tile = _tmp4_;
	_tmp5_ = self->priv->tiles;
	_tmp5__length1 = self->priv->tiles_length1;
	_tmp5__length2 = self->priv->tiles_length2;
	_tmp6_ = new_x;
	_tmp7_ = new_y;
	_tmp8_ = _g_object_ref0 (tile);
	_g_object_unref0 (_tmp5_[(_tmp6_ * _tmp5__length2) + _tmp7_]);
	_tmp5_[(_tmp6_ * _tmp5__length2) + _tmp7_] = _tmp8_;
	_tmp9_ = _tmp5_[(_tmp6_ * _tmp5__length2) + _tmp7_];
	_tmp10_ = new_x;
	_tmp11_ = self->priv->tile_size;
	_tmp12_ = self->priv->tile_size;
	new_xx = (_tmp10_ * _tmp11_) + (_tmp12_ / 2.0);
	_tmp13_ = game_view_get_game (self);
	_tmp14_ = _tmp13_;
	_tmp15_ = game_get_rows (_tmp14_);
	_tmp16_ = _tmp15_;
	_tmp17_ = new_y;
	_tmp18_ = self->priv->tile_size;
	_tmp19_ = self->priv->tile_size;
	new_yy = (((_tmp16_ - _tmp17_) - 1) * _tmp18_) + (_tmp19_ / 2.0);
	_tmp20_ = self->is_zealous;
	tile_actor_animate_to (tile, new_xx, new_yy, _tmp20_);
	_g_object_unref0 (tile);
}


static gpointer _tile_ref0 (gpointer self) {
	return self ? tile_ref (self) : NULL;
}


static void _tile_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (tile_unref (var), NULL));
}


static void _g_list_free__tile_unref0_ (GList* self) {
	g_list_foreach (self, (GFunc) _tile_unref0_, NULL);
	g_list_free (self);
}


static gboolean game_view_tile_entered_cb (GameView* self, ClutterActor* actor, ClutterCrossingEvent* event) {
	gboolean result = FALSE;
	ClutterActor* _tmp0_;
	TileActor* _tmp1_;
	TileActor* tile;
	Game* _tmp2_;
	Game* _tmp3_;
	TileActor* _tmp4_;
	Tile* _tmp5_;
	GList* _tmp6_ = NULL;
	GList* connected_tiles;
	GList* _tmp7_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (actor != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp0_ = actor;
	_tmp1_ = _g_object_ref0 (TILE_ACTOR (_tmp0_));
	tile = _tmp1_;
	_tmp2_ = game_view_get_game (self);
	_tmp3_ = _tmp2_;
	_tmp4_ = tile;
	_tmp5_ = _tmp4_->tile;
	_tmp6_ = game_connected_tiles (_tmp3_, _tmp5_);
	connected_tiles = _tmp6_;
	_tmp7_ = connected_tiles;
	{
		GList* l_collection = NULL;
		GList* l_it = NULL;
		l_collection = _tmp7_;
		for (l_it = l_collection; l_it != NULL; l_it = l_it->next) {
			Tile* _tmp8_;
			Tile* l = NULL;
			_tmp8_ = _tile_ref0 ((Tile*) l_it->data);
			l = _tmp8_;
			{
				TileActor** _tmp9_;
				gint _tmp9__length1;
				gint _tmp9__length2;
				Tile* _tmp10_;
				gint _tmp11_;
				Tile* _tmp12_;
				gint _tmp13_;
				TileActor* _tmp14_;
				_tmp9_ = self->priv->tiles;
				_tmp9__length1 = self->priv->tiles_length1;
				_tmp9__length2 = self->priv->tiles_length2;
				_tmp10_ = l;
				_tmp11_ = _tmp10_->grid_x;
				_tmp12_ = l;
				_tmp13_ = _tmp12_->grid_y;
				_tmp14_ = _tmp9_[(_tmp11_ * _tmp9__length2) + _tmp13_];
				clutter_actor_set_opacity ((ClutterActor*) _tmp14_, (guint) 255);
				_tile_unref0 (l);
			}
		}
	}
	result = FALSE;
	__g_list_free__tile_unref0_0 (connected_tiles);
	_g_object_unref0 (tile);
	return result;
}


static gboolean game_view_tile_left_cb (GameView* self, ClutterActor* actor, ClutterCrossingEvent* event) {
	gboolean result = FALSE;
	ClutterActor* _tmp0_;
	TileActor* _tmp1_;
	TileActor* tile;
	Game* _tmp2_;
	Game* _tmp3_;
	TileActor* _tmp4_;
	Tile* _tmp5_;
	GList* _tmp6_ = NULL;
	GList* connected_tiles;
	GList* _tmp7_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (actor != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp0_ = actor;
	_tmp1_ = _g_object_ref0 (TILE_ACTOR (_tmp0_));
	tile = _tmp1_;
	_tmp2_ = game_view_get_game (self);
	_tmp3_ = _tmp2_;
	_tmp4_ = tile;
	_tmp5_ = _tmp4_->tile;
	_tmp6_ = game_connected_tiles (_tmp3_, _tmp5_);
	connected_tiles = _tmp6_;
	_tmp7_ = connected_tiles;
	{
		GList* l_collection = NULL;
		GList* l_it = NULL;
		l_collection = _tmp7_;
		for (l_it = l_collection; l_it != NULL; l_it = l_it->next) {
			Tile* _tmp8_;
			Tile* l = NULL;
			_tmp8_ = _tile_ref0 ((Tile*) l_it->data);
			l = _tmp8_;
			{
				TileActor** _tmp9_;
				gint _tmp9__length1;
				gint _tmp9__length2;
				Tile* _tmp10_;
				gint _tmp11_;
				Tile* _tmp12_;
				gint _tmp13_;
				TileActor* _tmp14_;
				_tmp9_ = self->priv->tiles;
				_tmp9__length1 = self->priv->tiles_length1;
				_tmp9__length2 = self->priv->tiles_length2;
				_tmp10_ = l;
				_tmp11_ = _tmp10_->grid_x;
				_tmp12_ = l;
				_tmp13_ = _tmp12_->grid_y;
				_tmp14_ = _tmp9_[(_tmp11_ * _tmp9__length2) + _tmp13_];
				clutter_actor_set_opacity ((ClutterActor*) _tmp14_, (guint) 180);
				_tile_unref0 (l);
			}
		}
	}
	result = FALSE;
	__g_list_free__tile_unref0_0 (connected_tiles);
	_g_object_unref0 (tile);
	return result;
}


static gboolean game_view_remove_region_cb (GameView* self, ClutterActor* actor, ClutterButtonEvent* event) {
	gboolean result = FALSE;
	ClutterActor* _tmp0_;
	TileActor* _tmp1_;
	TileActor* tile;
	Game* _tmp2_;
	Game* _tmp3_;
	Tile* _tmp4_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (actor != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp0_ = actor;
	_tmp1_ = _g_object_ref0 (TILE_ACTOR (_tmp0_));
	tile = _tmp1_;
	_tmp2_ = game_view_get_game (self);
	_tmp3_ = _tmp2_;
	_tmp4_ = tile->tile;
	game_remove_connected_tiles (_tmp3_, _tmp4_);
	result = FALSE;
	_g_object_unref0 (tile);
	return result;
}


gboolean game_view_board_left_cb (GameView* self) {
	gboolean result = FALSE;
	Game* _tmp0_;
	Game* _tmp1_;
	TileActor** _tmp2_;
	gint _tmp2__length1;
	gint _tmp2__length2;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = game_view_get_game (self);
	_tmp1_ = _tmp0_;
	game_reset_visit (_tmp1_);
	_tmp2_ = self->priv->tiles;
	_tmp2__length1 = self->priv->tiles_length1;
	_tmp2__length2 = self->priv->tiles_length2;
	{
		TileActor** tile_collection = NULL;
		gint tile_collection_length1 = 0;
		gint tile_collection_length2 = 0;
		gint tile_it = 0;
		tile_collection = _tmp2_;
		tile_collection_length1 = _tmp2__length1 * _tmp2__length2;
		for (tile_it = 0; tile_it < (_tmp2__length1 * _tmp2__length2); tile_it = tile_it + 1) {
			TileActor* _tmp3_;
			TileActor* tile = NULL;
			_tmp3_ = _g_object_ref0 (tile_collection[tile_it]);
			tile = _tmp3_;
			{
				TileActor* _tmp4_;
				_tmp4_ = tile;
				clutter_actor_set_opacity ((ClutterActor*) _tmp4_, (guint) 180);
				_g_object_unref0 (tile);
			}
		}
	}
	result = FALSE;
	return result;
}


void game_view_update_score_cb (GameView* self, gint points_awarded) {
	gboolean _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->is_zealous;
	if (_tmp0_) {
		gfloat _tmp1_;
		gfloat _tmp2_;
		gfloat _tmp3_;
		gfloat _tmp4_;
		gfloat _tmp5_;
		gfloat _tmp6_;
		gfloat _tmp7_;
		gfloat _tmp8_;
		ScoreActor* _tmp9_;
		ScoreActor* _tmp10_;
		ScoreActor* text;
		ClutterGroup* _tmp11_;
		ScoreActor* _tmp12_;
		ScoreActor* _tmp13_;
		gint _tmp14_;
		_tmp1_ = clutter_actor_get_width ((ClutterActor*) self);
		_tmp2_ = _tmp1_;
		_tmp3_ = clutter_actor_get_height ((ClutterActor*) self);
		_tmp4_ = _tmp3_;
		_tmp5_ = clutter_actor_get_width ((ClutterActor*) self);
		_tmp6_ = _tmp5_;
		_tmp7_ = clutter_actor_get_height ((ClutterActor*) self);
		_tmp8_ = _tmp7_;
		_tmp9_ = score_actor_new (_tmp2_ / 2.0, _tmp4_ / 2.0, (gdouble) _tmp6_, (gdouble) _tmp8_);
		_tmp10_ = g_object_ref_sink (_tmp9_);
		text = _tmp10_;
		_tmp11_ = self->priv->game_actors;
		_tmp12_ = text;
		clutter_container_add_actor ((ClutterContainer*) _tmp11_, (ClutterActor*) _tmp12_);
		_tmp13_ = text;
		_tmp14_ = points_awarded;
		score_actor_animate_score (_tmp13_, _tmp14_);
		_g_object_unref0 (text);
	}
}


void game_view_game_complete_cb (GameView* self) {
	gfloat _tmp0_;
	gfloat _tmp1_;
	gfloat _tmp2_;
	gfloat _tmp3_;
	gfloat _tmp4_;
	gfloat _tmp5_;
	gfloat _tmp6_;
	gfloat _tmp7_;
	ScoreActor* _tmp8_;
	ScoreActor* _tmp9_;
	ScoreActor* text;
	ClutterGroup* _tmp10_;
	Game* _tmp11_;
	Game* _tmp12_;
	gint _tmp13_;
	gint _tmp14_;
	g_return_if_fail (self != NULL);
	_tmp0_ = clutter_actor_get_width ((ClutterActor*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = clutter_actor_get_height ((ClutterActor*) self);
	_tmp3_ = _tmp2_;
	_tmp4_ = clutter_actor_get_width ((ClutterActor*) self);
	_tmp5_ = _tmp4_;
	_tmp6_ = clutter_actor_get_height ((ClutterActor*) self);
	_tmp7_ = _tmp6_;
	_tmp8_ = score_actor_new (_tmp1_ / 2.0, _tmp3_ / 2.0, (gdouble) _tmp5_, (gdouble) _tmp7_);
	_tmp9_ = g_object_ref_sink (_tmp8_);
	text = _tmp9_;
	_tmp10_ = self->priv->game_actors;
	clutter_container_add_actor ((ClutterContainer*) _tmp10_, (ClutterActor*) text);
	_tmp11_ = game_view_get_game (self);
	_tmp12_ = _tmp11_;
	_tmp13_ = game_get_score (_tmp12_);
	_tmp14_ = _tmp13_;
	score_actor_animate_final_score (text, (guint) _tmp14_);
	_g_object_unref0 (text);
}


Game* game_view_get_game (GameView* self) {
	Game* result;
	Game* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_game;
	result = _tmp0_;
	return result;
}


static void _game_view_game_complete_cb_game_complete (Game* _sender, gpointer self) {
	game_view_game_complete_cb (self);
}


static void _game_view_update_score_cb_game_update_score (Game* _sender, gint points_awarded, gpointer self) {
	game_view_update_score_cb (self, points_awarded);
}


void game_view_set_game (GameView* self, Game* value) {
	ClutterGroup* _tmp0_;
	ClutterGroup* _tmp2_;
	ClutterGroup* _tmp3_;
	ClutterGroup* _tmp4_;
	Game* _tmp5_;
	Game* _tmp6_;
	Game* _tmp9_;
	Game* _tmp10_;
	Game* _tmp11_;
	Game* _tmp12_;
	Game* _tmp13_;
	Game* _tmp14_;
	Game* _tmp15_;
	Game* _tmp16_;
	gint _tmp17_;
	gint _tmp18_;
	Game* _tmp19_;
	Game* _tmp20_;
	gint _tmp21_;
	gint _tmp22_;
	TileActor** _tmp23_ = NULL;
	gint _tmp24_;
	Game* _tmp25_;
	Game* _tmp26_;
	gint _tmp27_;
	gint _tmp28_;
	gint _tmp29_;
	Game* _tmp30_;
	Game* _tmp31_;
	gint _tmp32_;
	gint _tmp33_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->game_actors;
	if (_tmp0_ != NULL) {
		ClutterGroup* _tmp1_;
		_tmp1_ = self->priv->game_actors;
		clutter_actor_destroy ((ClutterActor*) _tmp1_);
	}
	_tmp2_ = (ClutterGroup*) clutter_group_new ();
	_tmp3_ = g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->game_actors);
	self->priv->game_actors = _tmp3_;
	_tmp4_ = self->priv->game_actors;
	clutter_container_add_actor ((ClutterContainer*) self, (ClutterActor*) _tmp4_);
	game_view_remove_tiles (self);
	_tmp5_ = game_view_get_game (self);
	_tmp6_ = _tmp5_;
	if (_tmp6_ != NULL) {
		Game* _tmp7_;
		Game* _tmp8_;
		_tmp7_ = game_view_get_game (self);
		_tmp8_ = _tmp7_;
		g_signal_handlers_disconnect_matched (_tmp8_, G_SIGNAL_MATCH_DATA, (guint) 0, (GQuark) 0, NULL, NULL, self);
	}
	_tmp9_ = value;
	_tmp10_ = _g_object_ref0 (_tmp9_);
	_g_object_unref0 (self->priv->_game);
	self->priv->_game = _tmp10_;
	_tmp11_ = game_view_get_game (self);
	_tmp12_ = _tmp11_;
	g_signal_connect_object (_tmp12_, "complete", (GCallback) _game_view_game_complete_cb_game_complete, self, 0);
	_tmp13_ = game_view_get_game (self);
	_tmp14_ = _tmp13_;
	g_signal_connect_object (_tmp14_, "update-score", (GCallback) _game_view_update_score_cb_game_update_score, self, 0);
	_tmp15_ = game_view_get_game (self);
	_tmp16_ = _tmp15_;
	_tmp17_ = game_get_columns (_tmp16_);
	_tmp18_ = _tmp17_;
	_tmp19_ = game_view_get_game (self);
	_tmp20_ = _tmp19_;
	_tmp21_ = game_get_rows (_tmp20_);
	_tmp22_ = _tmp21_;
	_tmp23_ = g_new0 (TileActor*, (_tmp18_ * _tmp22_) + 1);
	self->priv->tiles = (_vala_array_free (self->priv->tiles, self->priv->tiles_length1 * self->priv->tiles_length2, (GDestroyNotify) g_object_unref), NULL);
	self->priv->tiles = _tmp23_;
	self->priv->tiles_length1 = _tmp18_;
	self->priv->tiles_length2 = _tmp22_;
	game_view_place_tiles (self);
	_tmp24_ = self->priv->tile_size;
	_tmp25_ = game_view_get_game (self);
	_tmp26_ = _tmp25_;
	_tmp27_ = game_get_columns (_tmp26_);
	_tmp28_ = _tmp27_;
	clutter_actor_set_width ((ClutterActor*) self, (gfloat) (_tmp24_ * _tmp28_));
	_tmp29_ = self->priv->tile_size;
	_tmp30_ = game_view_get_game (self);
	_tmp31_ = _tmp30_;
	_tmp32_ = game_get_rows (_tmp31_);
	_tmp33_ = _tmp32_;
	clutter_actor_set_height ((ClutterActor*) self, (gfloat) (_tmp29_ * _tmp33_));
	g_object_notify ((GObject *) self, "game");
}


const gchar* game_view_get_theme_name (GameView* self) {
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_theme_name;
	result = _tmp0_;
	return result;
}


void game_view_set_theme_name (GameView* self, const gchar* value) {
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = game_view_get_theme_name (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = value;
	if (g_strcmp0 (_tmp1_, _tmp2_) == 0) {
		return;
	}
	_tmp3_ = value;
	_tmp4_ = g_strdup (_tmp3_);
	_g_free0 (self->priv->_theme_name);
	self->priv->_theme_name = _tmp4_;
	game_view_remove_tiles (self);
	game_view_place_tiles (self);
	g_object_notify ((GObject *) self, "theme-name");
}


static void game_view_class_init (GameViewClass * klass) {
	game_view_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GameViewPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_game_view_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_game_view_set_property;
	G_OBJECT_CLASS (klass)->finalize = game_view_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAME_VIEW_GAME, g_param_spec_object ("game", "game", "game", TYPE_GAME, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAME_VIEW_THEME_NAME, g_param_spec_string ("theme-name", "theme-name", "theme-name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
}


static void game_view_instance_init (GameView * self) {
	gchar* _tmp0_;
	self->priv = GAME_VIEW_GET_PRIVATE (self);
	self->priv->game_actors = NULL;
	self->priv->_game = NULL;
	_tmp0_ = g_strdup ("shapesandcolors");
	self->priv->_theme_name = _tmp0_;
	self->priv->tile_size = 50;
}


static void game_view_finalize (GObject* obj) {
	GameView * self;
	self = GAME_VIEW (obj);
	self->priv->tiles = (_vala_array_free (self->priv->tiles, self->priv->tiles_length1 * self->priv->tiles_length2, (GDestroyNotify) g_object_unref), NULL);
	_g_object_unref0 (self->priv->game_actors);
	_g_object_unref0 (self->priv->_game);
	_g_hash_table_unref0 (self->priv->themes);
	_g_free0 (self->priv->_theme_name);
	G_OBJECT_CLASS (game_view_parent_class)->finalize (obj);
}


/**
 *  This class defines the view of a game. All clutter related stuff goes here. It follows the
 *  principle of MVC framework. This class deals with the presentation (view) layer. It communicates
 *  with the model class by composite relation and with the control layer by means of signals and
 *  events.
 */
GType game_view_get_type (void) {
	static volatile gsize game_view_type_id__volatile = 0;
	if (g_once_init_enter (&game_view_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GameViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) game_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GameView), 0, (GInstanceInitFunc) game_view_instance_init, NULL };
		GType game_view_type_id;
		game_view_type_id = g_type_register_static (clutter_group_get_type (), "GameView", &g_define_type_info, 0);
		g_once_init_leave (&game_view_type_id__volatile, game_view_type_id);
	}
	return game_view_type_id__volatile;
}


static void _vala_game_view_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GameView * self;
	self = GAME_VIEW (object);
	switch (property_id) {
		case GAME_VIEW_GAME:
		g_value_set_object (value, game_view_get_game (self));
		break;
		case GAME_VIEW_THEME_NAME:
		g_value_set_string (value, game_view_get_theme_name (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_game_view_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	GameView * self;
	self = GAME_VIEW (object);
	switch (property_id) {
		case GAME_VIEW_GAME:
		game_view_set_game (self, g_value_get_object (value));
		break;
		case GAME_VIEW_THEME_NAME:
		game_view_set_theme_name (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


Theme* theme_construct (GType object_type, const gchar* name) {
	Theme* self = NULL;
	ClutterTexture** _tmp0_ = NULL;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar** _tmp5_ = NULL;
	gchar** colors;
	gint colors_length1;
	gint _colors_size_;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (name != NULL, NULL);
	self = (Theme*) g_type_create_instance (object_type);
	_tmp0_ = g_new0 (ClutterTexture*, 4 + 1);
	self->textures = (_vala_array_free (self->textures, self->textures_length1, (GDestroyNotify) g_object_unref), NULL);
	self->textures = _tmp0_;
	self->textures_length1 = 4;
	_tmp1_ = g_strdup ("blue");
	_tmp2_ = g_strdup ("green");
	_tmp3_ = g_strdup ("yellow");
	_tmp4_ = g_strdup ("red");
	_tmp5_ = g_new0 (gchar*, 4 + 1);
	_tmp5_[0] = _tmp1_;
	_tmp5_[1] = _tmp2_;
	_tmp5_[2] = _tmp3_;
	_tmp5_[3] = _tmp4_;
	colors = _tmp5_;
	colors_length1 = 4;
	_colors_size_ = colors_length1;
	{
		{
			gint i;
			i = 0;
			{
				gboolean _tmp6_;
				_tmp6_ = TRUE;
				while (TRUE) {
					gboolean _tmp7_;
					gint _tmp9_;
					const gchar* _tmp10_;
					gchar** _tmp11_;
					gint _tmp11__length1;
					gint _tmp12_;
					const gchar* _tmp13_;
					gchar* _tmp14_;
					gchar* _tmp15_;
					gchar* _tmp16_ = NULL;
					gchar* _tmp17_;
					ClutterTexture* _tmp18_;
					ClutterTexture* _tmp19_;
					ClutterTexture* _tmp20_;
					ClutterTexture* _tmp21_;
					ClutterTexture** _tmp22_;
					gint _tmp22__length1;
					gint _tmp23_;
					ClutterTexture* _tmp24_;
					ClutterTexture* _tmp25_;
					_tmp7_ = _tmp6_;
					if (!_tmp7_) {
						gint _tmp8_;
						_tmp8_ = i;
						i = _tmp8_ + 1;
					}
					_tmp6_ = FALSE;
					_tmp9_ = i;
					if (!(_tmp9_ < 4)) {
						break;
					}
					_tmp10_ = name;
					_tmp11_ = colors;
					_tmp11__length1 = colors_length1;
					_tmp12_ = i;
					_tmp13_ = _tmp11_[_tmp12_];
					_tmp14_ = g_strconcat (_tmp13_, ".svg", NULL);
					_tmp15_ = _tmp14_;
					_tmp16_ = g_build_filename (DATADIR, "themes", _tmp10_, _tmp15_, NULL);
					_tmp17_ = _tmp16_;
					_tmp18_ = (ClutterTexture*) clutter_texture_new_from_file (_tmp17_, &_inner_error_);
					_tmp19_ = g_object_ref_sink (_tmp18_);
					_tmp20_ = _tmp19_;
					_g_free0 (_tmp17_);
					_g_free0 (_tmp15_);
					_tmp21_ = _tmp20_;
					if (_inner_error_ != NULL) {
						if (_inner_error_->domain == CLUTTER_TEXTURE_ERROR) {
							goto __catch0_clutter_texture_error;
						}
						colors = (_vala_array_free (colors, colors_length1, (GDestroyNotify) g_free), NULL);
						g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
						g_clear_error (&_inner_error_);
						return NULL;
					}
					_tmp22_ = self->textures;
					_tmp22__length1 = self->textures_length1;
					_tmp23_ = i;
					_tmp24_ = g_object_ref_sink (_tmp21_);
					_g_object_unref0 (_tmp22_[_tmp23_]);
					_tmp22_[_tmp23_] = _tmp24_;
					_tmp25_ = _tmp22_[_tmp23_];
				}
			}
		}
	}
	goto __finally0;
	__catch0_clutter_texture_error:
	{
		GError* e = NULL;
		GError* _tmp26_;
		const gchar* _tmp27_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp26_ = e;
		_tmp27_ = _tmp26_->message;
		g_warning ("game-view.vala:252: Failed to load textures: %s", _tmp27_);
		_g_error_free0 (e);
	}
	__finally0:
	if (_inner_error_ != NULL) {
		colors = (_vala_array_free (colors, colors_length1, (GDestroyNotify) g_free), NULL);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return NULL;
	}
	colors = (_vala_array_free (colors, colors_length1, (GDestroyNotify) g_free), NULL);
	return self;
}


Theme* theme_new (const gchar* name) {
	return theme_construct (TYPE_THEME, name);
}


static void value_theme_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


static void value_theme_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		theme_unref (value->data[0].v_pointer);
	}
}


static void value_theme_copy_value (const GValue* src_value, GValue* dest_value) {
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = theme_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}


static gpointer value_theme_peek_pointer (const GValue* value) {
	return value->data[0].v_pointer;
}


static gchar* value_theme_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		Theme* object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = theme_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* value_theme_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	Theme** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = theme_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* param_spec_theme (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	ParamSpecTheme* spec;
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_THEME), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}


gpointer value_get_theme (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_THEME), NULL);
	return value->data[0].v_pointer;
}


void value_set_theme (GValue* value, gpointer v_object) {
	Theme* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_THEME));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_THEME));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		theme_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		theme_unref (old);
	}
}


void value_take_theme (GValue* value, gpointer v_object) {
	Theme* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_THEME));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_THEME));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		theme_unref (old);
	}
}


static void theme_class_init (ThemeClass * klass) {
	theme_parent_class = g_type_class_peek_parent (klass);
	THEME_CLASS (klass)->finalize = theme_finalize;
}


static void theme_instance_init (Theme * self) {
	self->ref_count = 1;
}


static void theme_finalize (Theme* obj) {
	Theme * self;
	self = THEME (obj);
	self->textures = (_vala_array_free (self->textures, self->textures_length1, (GDestroyNotify) g_object_unref), NULL);
}


/**
 *  This class holds the textures for a specific theme. These textures are used for creating light
 *  actors.
 */
GType theme_get_type (void) {
	static volatile gsize theme_type_id__volatile = 0;
	if (g_once_init_enter (&theme_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { value_theme_init, value_theme_free_value, value_theme_copy_value, value_theme_peek_pointer, "p", value_theme_collect_value, "p", value_theme_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (ThemeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) theme_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Theme), 0, (GInstanceInitFunc) theme_instance_init, &g_define_type_value_table };
		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
		GType theme_type_id;
		theme_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Theme", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&theme_type_id__volatile, theme_type_id);
	}
	return theme_type_id__volatile;
}


gpointer theme_ref (gpointer instance) {
	Theme* self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}


void theme_unref (gpointer instance) {
	Theme* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		THEME_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}


TileActor* tile_actor_construct (GType object_type, Tile* tile, ClutterTexture* texture, gint size) {
	TileActor * self = NULL;
	Tile* _tmp0_;
	Tile* _tmp1_;
	ClutterTexture* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	g_return_val_if_fail (tile != NULL, NULL);
	g_return_val_if_fail (texture != NULL, NULL);
	self = (TileActor*) g_object_new (object_type, NULL);
	_tmp0_ = tile;
	_tmp1_ = _tile_ref0 (_tmp0_);
	_tile_unref0 (self->tile);
	self->tile = _tmp1_;
	_tmp2_ = texture;
	clutter_clone_set_source ((ClutterClone*) self, (ClutterActor*) _tmp2_);
	clutter_actor_set_opacity ((ClutterActor*) self, (guint) 180);
	_tmp3_ = size;
	_tmp4_ = size;
	clutter_actor_set_size ((ClutterActor*) self, (gfloat) _tmp3_, (gfloat) _tmp4_);
	_tmp5_ = size;
	_tmp6_ = size;
	clutter_actor_set_anchor_point ((ClutterActor*) self, (gfloat) (_tmp5_ / 2), (gfloat) (_tmp6_ / 2));
	return self;
}


TileActor* tile_actor_new (Tile* tile, ClutterTexture* texture, gint size) {
	return tile_actor_construct (TYPE_TILE_ACTOR, tile, texture, size);
}


static void _tile_actor_hide_tile_cb_clutter_timeline_completed (ClutterTimeline* _sender, gpointer self) {
	tile_actor_hide_tile_cb (self);
}


void tile_actor_animate_out (TileActor* self) {
	ClutterAnimation* _tmp0_ = NULL;
	ClutterAnimation* _tmp1_;
	ClutterAnimation* a;
	ClutterTimeline* _tmp2_;
	ClutterTimeline* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = clutter_actor_animate ((ClutterActor*) self, (gulong) CLUTTER_LINEAR, (guint) 500, "scale-x", 2.0, "scale-y", 2.0, "opacity", 0, NULL);
	_tmp1_ = _g_object_ref0 (_tmp0_);
	a = _tmp1_;
	_tmp2_ = clutter_animation_get_timeline (a);
	_tmp3_ = _tmp2_;
	g_signal_connect_object (_tmp3_, "completed", (GCallback) _tile_actor_hide_tile_cb_clutter_timeline_completed, self, 0);
	_g_object_unref0 (a);
}


static void tile_actor_hide_tile_cb (TileActor* self) {
	g_return_if_fail (self != NULL);
	clutter_actor_hide ((ClutterActor*) self);
}


void tile_actor_animate_to (TileActor* self, gdouble new_x, gdouble new_y, gboolean is_zealous) {
	ClutterAnimationMode _tmp0_ = 0;
	gboolean _tmp1_;
	ClutterAnimationMode _tmp2_;
	ClutterAnimationMode anim_mode;
	gdouble _tmp3_;
	gdouble _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp1_ = is_zealous;
	if (_tmp1_) {
		_tmp0_ = CLUTTER_EASE_OUT_BOUNCE;
	} else {
		_tmp0_ = CLUTTER_EASE_OUT_QUAD;
	}
	_tmp2_ = _tmp0_;
	anim_mode = _tmp2_;
	_tmp3_ = new_x;
	_tmp4_ = new_y;
	clutter_actor_animate ((ClutterActor*) self, (gulong) anim_mode, (guint) 500, "x", _tmp3_, "y", _tmp4_, NULL);
}


static void tile_actor_class_init (TileActorClass * klass) {
	tile_actor_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = tile_actor_finalize;
}


static void tile_actor_instance_init (TileActor * self) {
}


static void tile_actor_finalize (GObject* obj) {
	TileActor * self;
	self = TILE_ACTOR (obj);
	_tile_unref0 (self->tile);
	G_OBJECT_CLASS (tile_actor_parent_class)->finalize (obj);
}


/**
 *  This class defines the view of a tile. All clutter related stuff goes here
 */
GType tile_actor_get_type (void) {
	static volatile gsize tile_actor_type_id__volatile = 0;
	if (g_once_init_enter (&tile_actor_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (TileActorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tile_actor_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TileActor), 0, (GInstanceInitFunc) tile_actor_instance_init, NULL };
		GType tile_actor_type_id;
		tile_actor_type_id = g_type_register_static (clutter_clone_get_type (), "TileActor", &g_define_type_info, 0);
		g_once_init_leave (&tile_actor_type_id__volatile, tile_actor_type_id);
	}
	return tile_actor_type_id__volatile;
}


ScoreActor* score_actor_construct (GType object_type, gdouble x, gdouble y, gdouble width, gdouble height) {
	ScoreActor * self = NULL;
	ClutterText* _tmp0_;
	ClutterText* _tmp1_;
	ClutterText* _tmp2_;
	ClutterColor _tmp3_ = {0};
	ClutterText* _tmp4_;
	gdouble _tmp5_;
	gdouble _tmp6_;
	gdouble _tmp7_;
	gdouble _tmp8_;
	self = (ScoreActor*) g_object_new (object_type, NULL);
	_tmp0_ = (ClutterText*) clutter_text_new ();
	_tmp1_ = g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->label);
	self->priv->label = _tmp1_;
	_tmp2_ = self->priv->label;
	clutter_color_from_string (&_tmp3_, "rgba(255, 255, 255, 255)");
	clutter_text_set_color (_tmp2_, &_tmp3_);
	g_object_set ((ClutterActor*) self, "anchor-gravity", CLUTTER_GRAVITY_CENTER, NULL);
	_tmp4_ = self->priv->label;
	clutter_container_add_actor ((ClutterContainer*) self, (ClutterActor*) _tmp4_);
	_tmp5_ = x;
	clutter_actor_set_x ((ClutterActor*) self, (gfloat) _tmp5_);
	_tmp6_ = y;
	clutter_actor_set_y ((ClutterActor*) self, (gfloat) _tmp6_);
	_tmp7_ = width;
	self->priv->scene_width = (gfloat) _tmp7_;
	_tmp8_ = height;
	self->priv->scene_height = (gfloat) _tmp8_;
	return self;
}


ScoreActor* score_actor_new (gdouble x, gdouble y, gdouble width, gdouble height) {
	return score_actor_construct (TYPE_SCORE_ACTOR, x, y, width, height);
}


static void __lambda2_ (ScoreActor* self) {
	clutter_actor_destroy ((ClutterActor*) self);
}


static void ___lambda2__clutter_timeline_completed (ClutterTimeline* _sender, gpointer self) {
	__lambda2_ (self);
}


void score_actor_animate_score (ScoreActor* self, gint points) {
	gint _tmp0_;
	ClutterText* _tmp1_;
	ClutterText* _tmp2_;
	gint _tmp3_;
	gchar* _tmp4_ = NULL;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	ClutterAnimation* _tmp8_ = NULL;
	ClutterAnimation* _tmp9_;
	ClutterAnimation* a;
	ClutterAnimation* _tmp10_;
	ClutterTimeline* _tmp11_;
	ClutterTimeline* _tmp12_;
	g_return_if_fail (self != NULL);
	_tmp0_ = points;
	if (_tmp0_ <= 0) {
		return;
	}
	_tmp1_ = self->priv->label;
	clutter_text_set_font_name (_tmp1_, "Bitstrem Vera Sans Bold 40");
	_tmp2_ = self->priv->label;
	_tmp3_ = points;
	_tmp4_ = g_strdup_printf ("%i", _tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_strconcat ("+", _tmp5_, NULL);
	_tmp7_ = _tmp6_;
	clutter_text_set_text (_tmp2_, _tmp7_);
	_g_free0 (_tmp7_);
	_g_free0 (_tmp5_);
	clutter_actor_set_opacity ((ClutterActor*) self, (guint) 255);
	clutter_actor_set_depth ((ClutterActor*) self, (gfloat) 0);
	_tmp8_ = clutter_actor_animate ((ClutterActor*) self, (gulong) CLUTTER_EASE_OUT_SINE, (guint) 600, "depth", 500.0, "opacity", 0, NULL);
	_tmp9_ = _g_object_ref0 (_tmp8_);
	a = _tmp9_;
	_tmp10_ = a;
	_tmp11_ = clutter_animation_get_timeline (_tmp10_);
	_tmp12_ = _tmp11_;
	g_signal_connect_object (_tmp12_, "completed", (GCallback) ___lambda2__clutter_timeline_completed, self, 0);
	_g_object_unref0 (a);
}


void score_actor_animate_final_score (ScoreActor* self, guint points) {
	ClutterText* _tmp0_;
	guint _tmp1_;
	const gchar* _tmp2_ = NULL;
	guint _tmp3_;
	gchar* _tmp4_ = NULL;
	gchar* points_label;
	ClutterText* _tmp5_;
	const gchar* _tmp6_ = NULL;
	gchar* _tmp7_ = NULL;
	gchar* _tmp8_;
	ClutterText* _tmp9_;
	gfloat _tmp10_;
	gfloat _tmp11_;
	gfloat _tmp12_;
	gfloat scale_to;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->label;
	clutter_text_set_font_name (_tmp0_, "Bitstrem Vera Sans 50");
	_tmp1_ = points;
	_tmp2_ = ngettext ("%u point", "%u points", (gulong) _tmp1_);
	_tmp3_ = points;
	_tmp4_ = g_strdup_printf (_tmp2_, _tmp3_);
	points_label = _tmp4_;
	_tmp5_ = self->priv->label;
	_tmp6_ = _ ("Game Over!");
	_tmp7_ = g_strdup_printf ("<b>%s</b>\n%s", _tmp6_, points_label);
	_tmp8_ = _tmp7_;
	clutter_text_set_markup (_tmp5_, _tmp8_);
	_g_free0 (_tmp8_);
	_tmp9_ = self->priv->label;
	clutter_text_set_line_alignment (_tmp9_, PANGO_ALIGN_CENTER);
	clutter_actor_set_opacity ((ClutterActor*) self, (guint) 255);
	clutter_actor_set_depth ((ClutterActor*) self, (gfloat) 0);
	g_object_set ((ClutterActor*) self, "scale-y", 0.0, NULL);
	g_object_set ((ClutterActor*) self, "scale-x", 0.0, NULL);
	_tmp10_ = self->priv->scene_width;
	_tmp11_ = clutter_actor_get_width ((ClutterActor*) self);
	_tmp12_ = _tmp11_;
	scale_to = _tmp10_ / _tmp12_;
	clutter_actor_animate ((ClutterActor*) self, (gulong) CLUTTER_EASE_OUT_ELASTIC, (guint) 2000, "scale-x", scale_to, "scale-y", scale_to, "opacity", 255, NULL);
	_g_free0 (points_label);
}


static void score_actor_class_init (ScoreActorClass * klass) {
	score_actor_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (ScoreActorPrivate));
	G_OBJECT_CLASS (klass)->finalize = score_actor_finalize;
}


static void score_actor_instance_init (ScoreActor * self) {
	self->priv = SCORE_ACTOR_GET_PRIVATE (self);
}


static void score_actor_finalize (GObject* obj) {
	ScoreActor * self;
	self = SCORE_ACTOR (obj);
	_g_object_unref0 (self->priv->label);
	G_OBJECT_CLASS (score_actor_parent_class)->finalize (obj);
}


/**
 *  This class defines the view of a score. All clutter related stuff goes here
 */
GType score_actor_get_type (void) {
	static volatile gsize score_actor_type_id__volatile = 0;
	if (g_once_init_enter (&score_actor_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ScoreActorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) score_actor_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ScoreActor), 0, (GInstanceInitFunc) score_actor_instance_init, NULL };
		GType score_actor_type_id;
		score_actor_type_id = g_type_register_static (clutter_group_get_type (), "ScoreActor", &g_define_type_info, 0);
		g_once_init_leave (&score_actor_type_id__volatile, score_actor_type_id);
	}
	return score_actor_type_id__volatile;
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}



