summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Dilly <bdilly@profusion.mobi>2012-09-03 23:18:26 +0000
committerBruno Dilly <bdilly@profusion.mobi>2012-09-03 23:18:26 +0000
commitc790b9e25d1f6738426054b43c2b7e859ad2c522 (patch)
treefc74eaf8d250c6aea92285fb1529e60d96ffbf0d
parentc07e6973d38816459d88892b4cc0e9cdf490df01 (diff)
Econcentration: calculate score based on time and
attempts SVN revision: 76092
-rw-r--r--src/bin/main.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/bin/main.c b/src/bin/main.c
index 04c6dec..5a55be6 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -58,7 +58,7 @@ _board_size_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
58 return; 58 return;
59 } 59 }
60 60
61 snprintf(buf, sizeof(buf), "%i s", score); 61 snprintf(buf, sizeof(buf), "%i points", score);
62 elm_object_text_set(game->best_time_lb, buf); 62 elm_object_text_set(game->best_time_lb, buf);
63} 63}
64 64
@@ -125,20 +125,26 @@ _player_win(Game *game)
125 } 125 }
126 else 126 else
127 { 127 {
128 etrophy_gamescore_level_score_add( 128 int score;
129 game->gamescore, 129
130 BOARD_SIZE[game->board_index - 1], 130 score = 60 * game->board_index - game->play_time +
131 NULL, game->play_time, 0); 131 2 * (game->total_size - game->attempts);
132 snprintf(buf, sizeof(buf), "%i s", 132 if (score < 0) score = 0;
133 etrophy_gamescore_level_low_score_get( 133
134 etrophy_gamescore_level_score_add(game->gamescore,
135 BOARD_SIZE[game->board_index - 1],
136 NULL, score, 0);
137 snprintf(buf, sizeof(buf), "%i points",
138 etrophy_gamescore_level_hi_score_get(
134 game->gamescore, 139 game->gamescore,
135 BOARD_SIZE[game->board_index - 1])); 140 BOARD_SIZE[game->board_index - 1]));
136 elm_object_text_set(game->best_time_lb, buf); 141 elm_object_text_set(game->best_time_lb, buf);
137 142
138 snprintf(buf, sizeof(buf), 143 snprintf(buf, sizeof(buf),
139 "Congratulations, you solved it!<br>" 144 "Congratulations, you solved it!<br>"
140 "You spent %i seconds and made %i attempts.", 145 "You spent %i seconds and made %i attempts.<br>"
141 game->play_time, game->attempts); 146 "Your score was: %i.",
147 game->play_time, game->attempts, score);
142 } 148 }
143 149
144 elm_object_text_set(popup, buf); 150 elm_object_text_set(popup, buf);
@@ -622,13 +628,13 @@ _create_window_desktop(Game *game)
622 fr = elm_frame_add(win); 628 fr = elm_frame_add(win);
623 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 629 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
624 evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); 630 evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
625 elm_object_text_set(fr, "Best Time:"); 631 elm_object_text_set(fr, "Hi-Score:");
626 elm_box_pack_end(bxctl, fr); 632 elm_box_pack_end(bxctl, fr);
627 evas_object_show(fr); 633 evas_object_show(fr);
628 634
629 lb = elm_label_add(win); 635 lb = elm_label_add(win);
630 snprintf(buf, sizeof(buf), "%i s", 636 snprintf(buf, sizeof(buf), "%i points",
631 etrophy_gamescore_level_low_score_get(game->gamescore, 637 etrophy_gamescore_level_hi_score_get(game->gamescore,
632 BOARD_SIZE[0])); 638 BOARD_SIZE[0]));
633 elm_object_text_set(lb, buf); 639 elm_object_text_set(lb, buf);
634 evas_object_size_hint_weight_set(lb, 0.0, 0.0); 640 evas_object_size_hint_weight_set(lb, 0.0, 0.0);