int main(void) { if (!ecore_event_init()) { printf("ERROR: Cannot init Ecore!\n"); return -1; } ecore_event_handler_add(ECORE_EVENT_JOYSTICK, _joystick_event_handler_cb, NULL); ecore_input_joystick_event_axis_deadzone_set(300); printf("start the main loop.\n"); ecore_main_loop_begin(); ecore_shutdown(); return 0; }
void game_init(GameData *data, int argc, char** argv) { ecore_event_init(); ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _game_key_down_cb, data); ecore_event_handler_add(ECORE_EVENT_KEY_UP, _game_key_up_cb, data); elm_init(argc, argv); data->win = elm_win_util_standard_add(PROJ_NAME, PROJ_NAME); evas_object_smart_callback_add(data->win, "delete,request", _on_exit, NULL); elm_win_autodel_set(data->win, EINA_TRUE); evas_object_resize(data->win, SCREEN_WIDTH, SCREEN_HEIGHT); evas_object_show(data->win); data->layout = elm_layout_add(data->win); elm_layout_file_set(data->layout, LAYOUT_EDJ, GAME_MAIN_GROUP); evas_object_size_hint_weight_set(data->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(data->win, data->layout); evas_object_show(data->layout); evas_object_event_callback_add(data->layout, EVAS_CALLBACK_RESIZE, _on_resize, data); data->food = calloc(1, sizeof(Snake_Food)); snake_food_generate_random(data->food, data->layout); snake_food_draw(data->food); }
int ecore_wince_init() { WNDCLASS wc; if (++_ecore_wince_init_count != 1) return _ecore_wince_init_count; if (!eina_init()) return --_ecore_wince_init_count; eina_log_print_cb_set(_ecore_wince_error_print_cb, NULL); _ecore_wince_log_dom_global = eina_log_domain_register("ecore_wince", ECORE_WINCE_DEFAULT_LOG_COLOR); if (_ecore_wince_log_dom_global < 0) { EINA_LOG_ERR("Ecore_WinCE: Could not register log domain"); goto shutdown_eina; } if (!ecore_event_init()) { ERR("Ecore_WinCE: Could not init ecore_event"); goto unregister_log_domain; } _ecore_wince_instance = GetModuleHandle(NULL); if (!_ecore_wince_instance) { ERR("GetModuleHandle() failed"); goto shutdown_ecore_event; } memset (&wc, 0, sizeof (wc)); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = _ecore_wince_window_procedure; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = _ecore_wince_instance; wc.hIcon = NULL; wc.hCursor = LoadCursor (NULL, IDC_ARROW); wc.hbrBackground = GetSysColorBrush(COLOR_BTNFACE); wc.lpszMenuName = NULL; wc.lpszClassName = ECORE_WINCE_WINDOW_CLASS; if(!RegisterClass(&wc)) { ERR("RegisterClass() failed"); goto free_library; } if (!ECORE_WINCE_EVENT_MOUSE_IN) { ECORE_WINCE_EVENT_MOUSE_IN = ecore_event_type_new(); ECORE_WINCE_EVENT_MOUSE_OUT = ecore_event_type_new(); ECORE_WINCE_EVENT_WINDOW_FOCUS_IN = ecore_event_type_new(); ECORE_WINCE_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new(); ECORE_WINCE_EVENT_WINDOW_DAMAGE = ecore_event_type_new(); ECORE_WINCE_EVENT_WINDOW_CREATE = ecore_event_type_new(); ECORE_WINCE_EVENT_WINDOW_DESTROY = ecore_event_type_new(); ECORE_WINCE_EVENT_WINDOW_SHOW = ecore_event_type_new(); ECORE_WINCE_EVENT_WINDOW_HIDE = ecore_event_type_new(); ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new(); } return _ecore_wince_init_count; free_library: FreeLibrary(_ecore_wince_instance); shutdown_ecore_event: ecore_event_shutdown(); unregister_log_domain: eina_log_domain_unregister(_ecore_wince_log_dom_global); shutdown_eina: eina_shutdown(); return --_ecore_wince_init_count; }