tidy_scrollable_get_adjustments (TIDY_SCROLLABLE (priv->viewport), &hadjust, &vadjust);
//tidy_adjustment_get_values (hadjust, NULL, &lower, &upper, NULL, NULL, NULL);
- lower = 0;
if (priv->map->current_level->level < 8)
- upper = zoom_level_get_width(priv->map->current_level) - priv->viewportSize.width;
+ {
+ lower = -priv->viewportSize.width / 2;
+ upper = zoom_level_get_width(priv->map->current_level) - priv->viewportSize.width / 2;
+ }
else
- upper = G_MAXINT16;
+ {
+ lower = 0;
+ upper = G_MAXINT16;
+ }
g_object_set (hadjust, "lower", lower, "upper", upper,
"step-increment", 1.0, "elastic", TRUE, NULL);
//tidy_adjustment_get_values (vadjust, NULL, &lower, &upper, NULL, NULL, NULL);
- lower = 0;
+
if (priv->map->current_level->level < 8)
- upper = zoom_level_get_height(priv->map->current_level) - priv->viewportSize.height;
+ {
+ lower = -priv->viewportSize.height / 2;
+ upper = zoom_level_get_height(priv->map->current_level) - priv->viewportSize.height / 2;
+ }
else
- upper = G_MAXINT16;
+ {
+ lower = 0;
+ upper = G_MAXINT16;
+ }
g_object_set (vadjust, "lower", lower, "upper", upper,
"step-increment", 1.0, "elastic", TRUE, NULL);
-
- g_print("Level: %d\n", priv->map->current_level->level);
- g_print("Upper: %f\n", upper);
}
static void
GdkPoint rect;
tidy_viewport_get_origin(TIDY_VIEWPORT(priv->viewport), &rect.x, &rect.y, NULL);
- if (rect.x < 0 || rect.y < 0)
- return;
+
if (rect.x == priv->viewportSize.x &&
rect.y == priv->viewportSize.y)
return;
}
//FIXME: Inform tiles that there is a new anchor
-
- g_print("Anchor: %d, %d\n", anchor->x, anchor->y);
- g_print("Center: %f, %f\n", x, y);
-
+ int i;
+ for (i = 0; i < priv->map->current_level->tiles->len; i++)
+ {
+ Tile* tile = g_ptr_array_index(priv->map->current_level->tiles, i);
+ if (!tile->loading)
+ tile_set_position(priv->map, tile);
+ }
tidy_viewport_set_origin(TIDY_VIEWPORT(priv->viewport),
x - priv->viewportSize.width / 2.0,
#define CACHE_DIR "champlain"
static SoupSession * soup_session;
-
+
void
-tile_set(Map* map, Tile* tile)
+tile_set_position(Map* map, Tile* tile)
{
clutter_actor_set_position (tile->actor,
(tile->x * tile->size) - map->current_level->anchor.x,
{
tile->actor = clutter_texture_new_from_file("error.svg", NULL);
- tile_set(map, tile);
+ tile_set_position(map, tile);
clutter_container_add (CLUTTER_CONTAINER (map->current_level->group), tile->actor, NULL);
tile_setup_animation(tile);
gdk_pixbuf_get_rowstride (pixbuf),
3, 0, NULL);
- tile_set(map, tile);
+ tile_set_position(map, tile);
clutter_container_add (CLUTTER_CONTAINER (map->current_level->group), tile->actor, NULL);
tile_setup_animation(tile);
if (g_file_test (filename, G_FILE_TEST_EXISTS))
{
tile->actor = clutter_texture_new_from_file(filename, NULL);
- tile_set(map, tile);
+ tile_set_position(map, tile);
clutter_container_add (CLUTTER_CONTAINER (map->current_level->group), tile->actor, NULL);
// Do not animate since it is local and fast