summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsongwon0.lee <songwon0.lee@samsung.com>2013-10-04 11:47:09 +0900
committersongwon0.lee <songwon0.lee@samsung.com>2013-10-04 11:47:09 +0900
commitafe1c28aca6db99943465542ce0c00edb168fe81 (patch)
treeca46579961275a738b2df12a56db94a92dccfd7d
parentbc9472bbbd7aa35eb3b82cdac90b382aade99bb5 (diff)
added shuffle the cells
-rw-r--r--src/cell.c3
-rw-r--r--src/cell_manager.c54
-rw-r--r--src/main.c8
3 files changed, 49 insertions, 16 deletions
diff --git a/src/cell.c b/src/cell.c
index 363574d..72f5ee3 100644
--- a/src/cell.c
+++ b/src/cell.c
@@ -63,7 +63,8 @@ cell_target_match_move(Cell_Info *info, Elm_Transit_Del_Cb match_cb, void* data)
63 Elm_Transit* trans = elm_transit_add(); 63 Elm_Transit* trans = elm_transit_add();
64 elm_transit_object_add(trans, info->obj); 64 elm_transit_object_add(trans, info->obj);
65 elm_transit_effect_translation_add(trans, 0, 0, 65 elm_transit_effect_translation_add(trans, 0, 0,
66 (info->target_x - info->pos_x) *SIZE, (info->target_y - info->pos_y) * SIZE); 66 (info->target_x - info->pos_x) *SIZE,
67 (info->target_y - info->pos_y) * SIZE);
67 elm_transit_duration_set(trans, 0.15); 68 elm_transit_duration_set(trans, 0.15);
68 elm_transit_objects_final_state_keep_set(trans, EINA_TRUE); 69 elm_transit_objects_final_state_keep_set(trans, EINA_TRUE);
69 elm_transit_go(trans); 70 elm_transit_go(trans);
diff --git a/src/cell_manager.c b/src/cell_manager.c
index fae3e52..1383733 100644
--- a/src/cell_manager.c
+++ b/src/cell_manager.c
@@ -145,7 +145,6 @@ _cell_chain_check_by_dir(Cell_Info *info, MOVE_DIR dir)
145static Eina_List * 145static Eina_List *
146_cell_chain_get(Cell_Info* info) 146_cell_chain_get(Cell_Info* info)
147{ 147{
148 int left, right, up, down;
149 Eina_List* h_list = eina_list_merge(_cell_chain_check_by_dir(info, LEFT), 148 Eina_List* h_list = eina_list_merge(_cell_chain_check_by_dir(info, LEFT),
150 _cell_chain_check_by_dir(info, RIGHT)); 149 _cell_chain_check_by_dir(info, RIGHT));
151 150
@@ -243,24 +242,24 @@ _cell_line_down(int x, Eina_List* list)
243 for ( ; y >= 0 ; --y) 242 for ( ; y >= 0 ; --y)
244 { 243 {
245 if (cell_list[x][y] == NULL) 244 if (cell_list[x][y] == NULL)
246 { 245 {
247 cell_list[x][y] = _cell_align_get(x, y, list); 246 cell_list[x][y] = _cell_align_get(x, y, list);
248 if (cell_list[x][y]) 247 if (cell_list[x][y])
249 { 248 {
250 move_cell_count++; 249 move_cell_count++;
251 cell_list[x][y]->target_x = x; 250 cell_list[x][y]->target_x = x;
252 cell_list[x][y]->target_y = y; 251 cell_list[x][y]->target_y = y;
253 cell_down_move(cell_list[x][y], _cell_down_move_end_cb); 252 cell_down_move(cell_list[x][y], _cell_down_move_end_cb);
254 } 253 }
255 } 254 }
256 } 255 }
257 256
258} 257}
259 258
260 static void 259static void
261_cell_chain_explosion(Eina_List* list) 260_cell_chain_explosion(Eina_List* list)
262{ 261{
263 Eina_List *l; 262 Eina_List *l;
264 Cell_Info *info; 263 Cell_Info *info;
265 264
266 list = eina_list_sort(list, eina_list_count(list),_cell_list_sort_cb); 265 list = eina_list_sort(list, eina_list_count(list),_cell_list_sort_cb);
@@ -336,6 +335,31 @@ _cell_mouse_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
336} 335}
337 336
338void 337void
338cell_table_shake(void)
339{
340 Cell_Info *cell_info;
341 int i = 0, j = 0;
342
343 for (j = 0 ; j < CELL_HEIGHT ; ++j)
344 {
345 for (i = 0 ; i < CELL_WIDTH ; ++i)
346 {
347 cell_info = cell_list[i][j];
348 cell_type_reset(cell_info);
349 }
350 }
351 for (j = 0 ; j < CELL_HEIGHT ; ++j)
352 {
353 for (i = 0 ; i < CELL_WIDTH ; ++i)
354 {
355 cell_info = cell_list[i][j];
356 while (_cell_chain_get(cell_info))
357 cell_type_reset(cell_info);
358 }
359 }
360}
361
362void
339cell_table_init(Evas_Object *parent) 363cell_table_init(Evas_Object *parent)
340{ 364{
341 Cell_Info *cell_info; 365 Cell_Info *cell_info;
@@ -363,7 +387,7 @@ cell_table_init(Evas_Object *parent)
363} 387}
364 388
365void 389void
366cell_table_remove() 390cell_table_remove(void)
367{ 391{
368 int i, j; 392 int i, j;
369 393
diff --git a/src/main.c b/src/main.c
index 7ad925c..ff0f5d5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2,6 +2,12 @@
2 2
3#include "cell.h" 3#include "cell.h"
4 4
5static void
6_on_shake(void *data, Evas_Object *obj, void *ev)
7{
8 cell_table_shake();
9}
10
5EAPI_MAIN int 11EAPI_MAIN int
6elm_main(int argc, char **argv) 12elm_main(int argc, char **argv)
7{ 13{
@@ -31,9 +37,11 @@ elm_main(int argc, char **argv)
31 37
32 btn = elm_button_add(win); 38 btn = elm_button_add(win);
33 elm_object_text_set(btn, "SHAKE"); 39 elm_object_text_set(btn, "SHAKE");
40 evas_object_smart_callback_add(btn, "clicked", _on_shake, NULL);
34 evas_object_show(btn); 41 evas_object_show(btn);
35 elm_box_pack_end(box, btn); 42 elm_box_pack_end(box, btn);
36 43
44
37 box = elm_box_add(win); 45 box = elm_box_add(win);
38 elm_object_part_content_set(layout, "bottom_menu_bar", box); 46 elm_object_part_content_set(layout, "bottom_menu_bar", box);
39 evas_object_show(box); 47 evas_object_show(box);