summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHermet Park <hermet@hermet.pe.kr>2016-02-11 23:07:14 +0900
committerHermet Park <hermet@hermet.pe.kr>2016-02-11 23:07:14 +0900
commiteb2b7b7caed0d2dc6f4407134836431ed7b6edfd (patch)
tree1e96c6a219cd2a7e57af1b202b613113ece82cb6
parenta0eabea01dc6b1361092e8160ea7503e2c6189d8 (diff)
fix a score decreasing bug.
This bug was caused by double time return key events.
-rw-r--r--src/bin/etypers.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/bin/etypers.c b/src/bin/etypers.c
index 821adca..92472de 100644
--- a/src/bin/etypers.c
+++ b/src/bin/etypers.c
@@ -210,8 +210,7 @@ _update_gui(AppData *appdata)
210 elm_object_part_text_set(appdata->ly, "level_value", buf); 210 elm_object_part_text_set(appdata->ly, "level_value", buf);
211 211
212 //Score 212 //Score
213 snprintf(buf, sizeof(buf), "%ld", 213 snprintf(buf, sizeof(buf), "%ld", appdata->score);
214 ((unsigned long) ((appdata->level - 1) * 1000)) + appdata->score);
215 elm_object_part_text_set(appdata->ly, "score_value", buf); 214 elm_object_part_text_set(appdata->ly, "score_value", buf);
216} 215}
217 216
@@ -717,6 +716,8 @@ _key_down_cb(void *data, int type, void *event_info)
717 const char *input_text = elm_object_text_get(appdata->entry); 716 const char *input_text = elm_object_text_get(appdata->entry);
718 if (input_text) 717 if (input_text)
719 _enemies_kill(appdata, appdata->entry, input_text, EINA_FALSE); 718 _enemies_kill(appdata, appdata->entry, input_text, EINA_FALSE);
719
720 return ECORE_CALLBACK_DONE;
720 } 721 }
721 } 722 }
722 //Pause/Resume 723 //Pause/Resume
@@ -871,15 +872,16 @@ _app_init(AppData *appdata)
871EAPI_MAIN 872EAPI_MAIN
872int elm_main(int argc, char **argv) 873int elm_main(int argc, char **argv)
873{ 874{
875 srand((unsigned int) time(NULL));
876
874 AppData *appdata = calloc(1, sizeof(AppData)); 877 AppData *appdata = calloc(1, sizeof(AppData));
875 if (!appdata) return 0; 878 if (!appdata) return 0;
876 879
877 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); 880 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
878 elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR); 881 elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR);
879 elm_app_compile_bin_dir_set(PACKAGE_DATA_DIR); 882 elm_app_compile_bin_dir_set(PACKAGE_DATA_DIR);
880 snprintf(EDJE_PATH, sizeof(EDJE_PATH), "%s/theme/etypers.edj", PACKAGE_DATA_DIR); 883 snprintf(EDJE_PATH, sizeof(EDJE_PATH), "%s/theme/etypers.edj",
881 elm_theme_extension_add(NULL, EDJE_PATH); 884 PACKAGE_DATA_DIR);
882 srand((unsigned int) time(NULL));
883 ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _key_down_cb, appdata); 885 ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _key_down_cb, appdata);
884 886
885 _app_init(appdata); 887 _app_init(appdata);