Exemplo n.º 1
0
static Eina_Bool 
_elitaire_card_job_drag(Elitaire_Job_List * list, void * data)
{
    int fr;
    Elitaire_Card * ecard;
    Elitaire_Card_Job * job;

    job = (Elitaire_Card_Job *) data;
    ecard = (Elitaire_Card *) evas_object_smart_data_get(job->card);

    fr = ecard->eli->frame_rate;
    evas_object_raise(job->card);

    ecard->flying = true;

    if (ecard->eli->shadow) {
        _elitaire_card_shadow_on(job->card);
        job->timer = ecore_animator_add(_elitaire_card_drag_cb, data);
    }
    else {
        job->x.i = 1;
        job->timer = ecore_animator_add(_elitaire_card_wait_time_cb, data);
    }

    return 0;
}
Exemplo n.º 2
0
void animator_setup(animator_callback_gui_shared_info_s* common_data)
{
	debug_only("%s","animator_setup");
	ecore_animator_frametime_set(REFRESH_SPEED);
	common_data->dash_animator = ecore_animator_add(animator_rotate_dashes, common_data);
	common_data->balls_animator = ecore_animator_add(animator_spawns_balls, common_data);
	ecore_animator_freeze(common_data->dash_animator);
	ecore_animator_freeze(common_data->balls_animator);
}
Exemplo n.º 3
0
/**
 * Set up connections, signal handlers, sockets etc.
 * @return 1 or greater on success, 0 otherwise
 *
 * This function sets up all singal handlers and the basic event loop. If it
 * succeeds, 1 will be returned, otherwise 0 will be returned.
 *
 * @code
 * #include <Ecore.h>
 *
 * int main(int argc, char **argv)
 * {
 *   if (!ecore_init())
 *   {
 *     printf("ERROR: Cannot init Ecore!\n");
 *     return -1;
 *   }
 *   ecore_main_loop_begin();
 *   ecore_shutdown();
 * }
 * @endcode
 */
EAPI int ecore_init(void)
{
	if (++_ecore_init_count != 1)
		return _ecore_init_count;

#ifdef HAVE_LOCALE_H
	setlocale(LC_CTYPE, "");
#endif
	/*
	   if (strcmp(nl_langinfo(CODESET), "UTF-8"))
	   {
	   WRN("Not a utf8 locale!");
	   }
	 */
#ifdef HAVE_EVIL
	if (!evil_init())
		return --_ecore_init_count;
#endif
	if (!eina_init())
		goto shutdown_evil;
	_ecore_log_dom =
	    eina_log_domain_register("Ecore", ECORE_DEFAULT_LOG_COLOR);
	if (_ecore_log_dom < 0) {
		EINA_LOG_ERR("Ecore was unable to create a log domain.");
		goto shutdown_log_dom;
	}
	if (getenv("ECORE_FPS_DEBUG"))
		_ecore_fps_debug = 1;
	if (_ecore_fps_debug)
		_ecore_fps_debug_init();
	_ecore_main_loop_init();
	_ecore_signal_init();
	_ecore_exe_init();
	_ecore_thread_init();
	_ecore_glib_init();
	_ecore_job_init();
	_ecore_time_init();

#if HAVE_MALLINFO
	if (getenv("ECORE_MEM_STAT")) {
		_ecore_memory_pid = getpid();
		ecore_animator_add(_ecore_memory_statistic, NULL);
	}
#endif

#if defined(GLIB_INTEGRATION_ALWAYS)
	if (_ecore_glib_always_integrate)
		ecore_main_loop_glib_integrate();
#endif

	return _ecore_init_count;

      shutdown_log_dom:
	eina_shutdown();
      shutdown_evil:
#ifdef HAVE_EVIL
	evil_shutdown();
#endif
	return --_ecore_init_count;
}
Exemplo n.º 4
0
void XmasWidget::Show()
{
        edje_object_signal_emit(edje, "enable", "calaos");
        EdjeObject::Show();

        if (animator) ecore_animator_del(animator);
        animator = ecore_animator_add(_snow_cb_animator, this);
}
Exemplo n.º 5
0
static void 
_elitaire_card_job_timer_add(Elitaire_Job_List * list, void * data,
                                  int (*func) (void *))
{
    Elitaire_Card_Job * job;

    job = (Elitaire_Card_Job *) data;
    job->timer = ecore_animator_add(func, data);
}
Exemplo n.º 6
0
EAPI void
_emotion_frame_new(Evas_Object *obj)
{
   Smart_Data *sd;

   E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);

   if (!sd->anim) sd->anim = ecore_animator_add(_emotion_frame_anim, obj);
}
Exemplo n.º 7
0
static void
mouse_down_arrow_down(void *d, Evas *e, Evas_Object *obj, void *event_info)
{
    app_t *app = d;

    if (app->mouse_down_anim)
        ecore_animator_del(app->mouse_down_anim);

    app->mouse_down_anim = ecore_animator_add(do_move_down, app);
    move_down(app);
}
Exemplo n.º 8
0
PREFIX value ml_ecore_animator_add(value v_fun)
{
        value* data = ml_register_value(v_fun);
        Ecore_Animator* anim =
                ecore_animator_add(ml_Ecore_Task_Cb_free_on_last, data);
        if(anim == NULL) {
                ml_remove_value(data);
                caml_failwith("ecore_animator_add");
        }
        return Val_Ecore_Animator(anim);
}
Exemplo n.º 9
0
static bool
app_create(void *data)
{
	appdata_s *ad = data;
	cairo_evasgl_drawing(ad);

	ecore_animator_frametime_set(0.016);
	ecore_animator_add(_animate_cb, (void *)ad->img);

	eext_rotary_event_handler_add(_rotary_handler_cb, ad);
	return true;
}
Exemplo n.º 10
0
static void
scroll_setup(app_t *app, int dir)
{
    gettimeofday(&app->scroll.start, NULL);

    scroll_init(app, &app->scroll.start, dir);

    if (app->scroll.delay_ms < MINIMUM_SCROLL_DELAY) {
        app->scroll.last = app->scroll.start;
        scroll_ended(app);
        return;
    }

    app->scroll.anim = ecore_animator_add(scroll, app);
}
Exemplo n.º 11
0
static Eina_Bool 
_elitaire_card_job_wait_time(Elitaire_Job_List * list, void * data)
{
    int fr;
    Elitaire_Card * ecard;
    Elitaire_Card_Job * job;

    job = (Elitaire_Card_Job *) data;
    ecard = (Elitaire_Card *) evas_object_smart_data_get(job->card);

    fr = ecard->eli->frame_rate;

    ecard->waiting = true;
    job->timer = ecore_animator_add(_elitaire_card_wait_time_cb, data);

    return 0;
}
Exemplo n.º 12
0
static void
_rotate_go(Smart_Data *sd, unsigned char mode)
{
    char inc = 1;

    if (!sd->animator) sd->animator = ecore_animator_add(_rotate, sd);
    sd->start = ecore_loop_time_get();

    if (!mode)
        inc = -1;

    sd->state += inc;
    if (sd->state < 0)
        sd->state = 3;
    else if (sd->state > 3)
        sd->state = 0;
    sd->mode = mode;
}
Exemplo n.º 13
0
static Eina_Bool 
_elitaire_card_job_drop(Elitaire_Job_List * list, void * data)
{
    int fr;
    Elitaire_Card * ecard;
    Elitaire_Card_Job * job;

    job = (Elitaire_Card_Job *) data;
    ecard = (Elitaire_Card *) evas_object_smart_data_get(job->card);

    fr = ecard->eli->frame_rate;

    ecard->flying = false;

    if (ecard->eli->shadow) ecore_animator_add(_elitaire_card_drop_cb, data);
    else {
        //elitaire_card_chain_del(job->card);
        elitaire_stack_layer_reinit(ecard->eli, ecard->pcard);
        return 1;
    }
    return 0;
}
Exemplo n.º 14
0
static int
EvasDisplayMainloopCb( vout_display_t *vd )
{
    vout_display_sys_t *sys = vd->sys;

    if( sys->b_evas_changed || sys->pf_set_data( vd ) )
        return -1;

    evas_object_image_data_update_add( sys->p_evas, 0, 0,
                                       sys->i_width, sys->i_height );
    evas_object_image_pixels_dirty_set( sys->p_evas, 0 );

    if( !sys->p_anim )
        sys->p_anim = ecore_animator_add( mainloop_evas_anim_cb, vd );

    if( sys->p_current_buffer )
        BUFFER_FIFO_PUSH( sys->p_current_buffer );

    sys->p_current_buffer = sys->p_new_buffer;
    sys->p_new_buffer = NULL;
    return 0;
}
EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *win, *bg, *bx, *bt, *gl;
   Ecore_Animator *ani;
   GLData *gld = NULL;

   if (!(gld = calloc(1, sizeof(GLData)))) return 1;

   // set the engine to opengl_x11
   // if commented out, ELM will choose one
   elm_config_engine_set("opengl_x11");

   win = elm_win_add(NULL, "glview simple", ELM_WIN_BASIC);
   elm_win_title_set(win, "GLView Simple");
   elm_win_autodel_set(win, EINA_TRUE);
   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   bg = elm_bg_add(win);
   elm_win_resize_object_add(win, bg);
   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_show(bg);

   bx = elm_box_add(win);
   evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, bx);
   evas_object_show(bx);

   //-//-//-// THIS IS WHERE GL INIT STUFF HAPPENS (ALA EGL)
   //-//
   // create a new glview object
   gl = elm_glview_add(win);
   gld->glapi = elm_glview_gl_api_get(gl);
   evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
   evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   // mode is simply for supporting alpha, depth buffering, and stencil
   // buffering.
   elm_glview_mode_set(gl, ELM_GLVIEW_ALPHA | ELM_GLVIEW_DEPTH);
   // resize policy tells glview what to do with the surface when it
   // resizes.  ELM_GLVIEW_RESIZE_POLICY_RECREATE will tell it to
   // destroy the current surface and recreate it to the new size
   elm_glview_resize_policy_set(gl, ELM_GLVIEW_RESIZE_POLICY_RECREATE);
   // render policy tells glview how it would like glview to render
   // gl code. ELM_GLVIEW_RENDER_POLICY_ON_DEMAND will have the gl
   // calls called in the pixel_get callback, which only gets called
   // if the object is visible, hence ON_DEMAND.  ALWAYS mode renders
   // it despite the visibility of the object.
   elm_glview_render_policy_set(gl, ELM_GLVIEW_RENDER_POLICY_ON_DEMAND);
   // initialize callback function gets registered here
   elm_glview_init_func_set(gl, _init_gl);
   // delete callback function gets registered here
   elm_glview_del_func_set(gl, _del_gl);
   elm_glview_resize_func_set(gl, _resize_gl);
   elm_glview_render_func_set(gl, _draw_gl);
   //-//
   //-//-//-// END GL INIT BLOB

   elm_box_pack_end(bx, gl);
   evas_object_show(gl);

   elm_object_focus_set(gl, EINA_TRUE);

   // animating - just a demo. as long as you trigger an update on the image
   // object via elm_glview_changed_set() it will be updated.
   //
   // NOTE: if you delete gl, this animator will keep running trying to access
   // gl so you'd better delete this animator with ecore_animator_del().
   ani = ecore_animator_add(_anim, gl);

   evas_object_data_set(gl, "ani", ani);
   evas_object_data_set(gl, "gld", gld);
   evas_object_event_callback_add(gl, EVAS_CALLBACK_DEL, _del, gl);

   // add an 'OK' button to end the program
   bt = elm_button_add(win);
   elm_object_text_set(bt, "OK");
   evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
   evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
   elm_box_pack_end(bx, bt);
   evas_object_show(bt);
   evas_object_smart_callback_add(bt, "clicked", _on_done, win);

   evas_object_resize(win, 320, 480);
   evas_object_show(win);

   // run the mainloop and process events and callbacks
   elm_run();
   elm_shutdown();

   return 0;
}
Exemplo n.º 16
0
Animator::Animator()
{
  Dout( dc::notice, "Animator::Animator() - current frametime is " << frameTime() );
  _ea = ecore_animator_add( &Animator::__dispatcher, this );
}
Exemplo n.º 17
0
static void
_init_glview(Evas_Object *win, GLData *gld)
{
   Evas_Object *bg, *bx, *bt, *gl;
   Ecore_Animator *ani;

   bg = elm_bg_add(win);
   elm_win_resize_object_add(win, bg);
   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_show(bg);

   bx = elm_box_add(win);
   evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, bx);
   evas_object_show(bx);

   //-//-//-// THIS IS WHERE GL INIT STUFF HAPPENS (ALA EGL)
   //-//
   // create a new glview object
   gl = elm_glview_add(win);
   gld->glapi = elm_glview_gl_api_get(gl);
   evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
   evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   // mode is simply for supporting alpha, depth buffering, and stencil
   // buffering.
   elm_glview_mode_set(gl, ELM_GLVIEW_ALPHA | ELM_GLVIEW_DEPTH);
   // resize policy tells glview what to do with the surface when it
   // resizes.  ELM_GLVIEW_RESIZE_POLICY_RECREATE will tell it to
   // destroy the current surface and recreate it to the new size
   elm_glview_resize_policy_set(gl, ELM_GLVIEW_RESIZE_POLICY_RECREATE);
   // render policy tells glview how it would like glview to render
   // gl code. ELM_GLVIEW_RENDER_POLICY_ON_DEMAND will have the gl
   // calls called in the pixel_get callback, which only gets called
   // if the object is visible, hence ON_DEMAND.  ALWAYS mode renders
   // it despite the visibility of the object.
   elm_glview_render_policy_set(gl, ELM_GLVIEW_RENDER_POLICY_ON_DEMAND);
   // initialize callback function gets registered here
   elm_glview_init_func_set(gl, _init_gl);
   // delete callback function gets registered here
   elm_glview_del_func_set(gl, _del_gl);
   elm_glview_resize_func_set(gl, _resize_gl);
   elm_glview_render_func_set(gl, _draw_gl);
   //-//
   //-//-//-// END GL INIT BLOB

   elm_box_pack_end(bx, gl);
   evas_object_show(gl);

   elm_object_focus_set(gl, EINA_TRUE);

   // animating - just a demo. as long as you trigger an update on the image
   // object via elm_glview_changed_set() it will be updated.
   //
   // NOTE: if you delete gl, this animator will keep running trying to access
   // gl so you'd better delete this animator with ecore_animator_del().
   ani = ecore_animator_add(_anim, gl);

   evas_object_data_set(gl, "ani", ani);
   evas_object_data_set(gl, "gld", gld);
   evas_object_event_callback_add(gl, EVAS_CALLBACK_DEL, _del, gl);

   // add an 'OK' button to end the program
   bt = elm_button_add(win);
   elm_object_text_set(bt, "OK");
   evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
   evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
   elm_box_pack_end(bx, bt);
   evas_object_show(bt);
   evas_object_smart_callback_add(bt, "clicked", _on_done, win);

   evas_object_resize(win, 320, 480);
}
Exemplo n.º 18
0
static bool app_create(void *data)
{
	/* Hook to take necessary actions before main event loop starts
	 * Initialize UI resources and application's data
	 * If this function returns true, the main loop of application starts
	 * If this function returns false, the application is terminated. */

	Evas_Object *gl;
	appdata_s *ad = data;

	if (!data)
		return false;

	/* Create the window */
	ad->win = add_win(ad->name);

	if (!ad->win)
		return false;

	create_indicator(ad);
	evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL);
	eext_object_event_callback_add(ad->win, EEXT_CALLBACK_BACK, win_back_cb, ad);

	/* Create and initialize GLView */
	gl = elm_glview_add(ad->conform);
	ELEMENTARY_GLVIEW_GLOBAL_USE(gl);
	evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
	evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);

	/* Request a surface with alpha and a depth buffer */
	elm_glview_mode_set(gl, ELM_GLVIEW_DEPTH);

	/* The resize policy tells GLView what to do with the surface when it
	 * resizes. ELM_GLVIEW_RESIZE_POLICY_RECREATE will tell it to
	 * destroy the current surface and recreate it to the new size.
	 */
	elm_glview_resize_policy_set(gl, ELM_GLVIEW_RESIZE_POLICY_RECREATE);

	/* The render policy sets how GLView should render GL code.
	 * ELM_GLVIEW_RENDER_POLICY_ON_DEMAND will have the GL callback
	 * called only when the object is visible.
	 * ELM_GLVIEW_RENDER_POLICY_ALWAYS would cause the callback to be
	 * called even if the object were hidden.
	 */
	elm_glview_render_policy_set(gl, ELM_GLVIEW_RENDER_POLICY_ON_DEMAND);

	/* The initialize callback function gets registered here */
	elm_glview_init_func_set(gl, init_gl);

	/* The delete callback function gets registered here */
	elm_glview_del_func_set(gl, del_gl);

	/* The resize callback function gets registered here */
	elm_glview_resize_func_set(gl, resize_gl);

	/* The render callback function gets registered here */
	elm_glview_render_func_set(gl, draw_gl);

	/* Add the GLView to the conformant and show it */
	elm_object_content_set(ad->conform, gl);
	evas_object_show(gl);

	elm_object_focus_set(gl, EINA_TRUE);

	/* This adds an animator so that the app will regularly
	 * trigger updates of the GLView using elm_glview_changed_set().
	 *
	 * NOTE: If you delete GL, this animator will keep running trying to access
	 * GL so this animator needs to be deleted with ecore_animator_del().
	 */
	ad->ani = ecore_animator_add(anim, gl);
	evas_object_data_set(gl, "ad", ad);
	evas_object_event_callback_add(gl, EVAS_CALLBACK_DEL, del_anim, gl);

	evas_object_event_callback_add(gl, EVAS_CALLBACK_MOUSE_DOWN, mouse_down_cb, ad);
	evas_object_event_callback_add(gl, EVAS_CALLBACK_MOUSE_UP, mouse_up_cb, ad);
	evas_object_event_callback_add(gl, EVAS_CALLBACK_MOUSE_MOVE, mouse_move_cb, ad);

	evas_object_show(ad->win);

	/* Return true: the main loop will now start running */
	return true;
}
Exemplo n.º 19
0
static void
_create_view_layout(Evas_Object *parent, char *layout_file, char *index_style, char it_style[][20], Eina_Bool even_num)
{
	Evas_Object *layout, *scroller, *box, *left_right_rect, *img, *page_layout, *index;
	Elm_Object_Item *nf_it;
	char img_path[PATH_MAX];
	int i, max_items;

	page_data *pd = (page_data *)calloc(1, sizeof(page_data));

	/* Create Layout */
	layout = elm_layout_add(parent);
	elm_layout_file_set(layout, ELM_DEMO_EDJ, layout_file);
	evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	evas_object_show(layout);
	evas_object_event_callback_add(layout, EVAS_CALLBACK_DEL, _layout_del_cb, pd);
	pd->main_layout = layout;

	/* Create Scroller */
	scroller = elm_scroller_add(layout);
	elm_scroller_loop_set(scroller, EINA_FALSE, EINA_FALSE);
	evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	evas_object_size_hint_align_set(scroller, EVAS_HINT_FILL, EVAS_HINT_FILL);
	elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
	elm_scroller_page_scroll_limit_set(scroller, 1, 0);
	elm_object_scroll_lock_y_set(scroller, EINA_TRUE);
	elm_object_part_content_set(layout, "scroller", scroller);
	evas_object_show(scroller);
	evas_object_smart_callback_add(scroller, "scroll", _scroll, pd);
	pd->scroller = scroller;

	/* Create Box */
	box = elm_box_add(scroller);
	elm_box_horizontal_set(box, EINA_TRUE);
	elm_object_content_set(scroller, box);
	evas_object_show(box);
	pd->box = box;

	/* Create Rect object for page_layout center align in Box */
	left_right_rect = evas_object_rectangle_add(evas_object_evas_get(box));
	elm_box_pack_end(box, left_right_rect);

	/* Create Pages */
	if (even_num)
		max_items = NUM_INDEX_CIRCLE_EVEN;
	else
		max_items = NUM_ITEMS;
	for (i = 0; i < max_items; ++i)
	{
		page_layout = elm_layout_add(box);
		pd->page_layout[i] = page_layout;
		evas_object_size_hint_weight_set(page_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
		evas_object_size_hint_align_set(page_layout, 0, EVAS_HINT_FILL);
		elm_layout_theme_set(page_layout, "layout", "body_thumbnail", "default");
		evas_object_show(page_layout);

		img = elm_image_add(page_layout);
		snprintf(img_path, sizeof(img_path), "%s/100_%d.jpg", ICON_DIR, (i % 6) + 1);
		elm_image_file_set(img, img_path, NULL);
		elm_object_part_content_set(page_layout, "elm.icon", img);

		/* Make unselect state all of the pages except first one */
		if (i)
			elm_object_signal_emit(page_layout, "elm,state,thumbnail,unselect", "elm");

		elm_box_pack_end(box, page_layout);
	}

	/*Add resize callback for get a actual size of layout and main layout */
	evas_object_event_callback_add(pd->page_layout[0], EVAS_CALLBACK_RESIZE, _layout_resize_cb, pd);

	elm_box_pack_end(box, left_right_rect);
	pd->left_right_rect = left_right_rect;

	/* Add animator for page transfer effect */
	ecore_animator_add(animator_cb, pd);

	/* Create Index */
	index = elm_index_add(layout);
	elm_object_style_set(index, index_style);
	evas_object_size_hint_weight_set(index, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	evas_object_size_hint_align_set(index, EVAS_HINT_FILL, EVAS_HINT_FILL);
	elm_index_horizontal_set(index, EINA_TRUE);
	elm_index_autohide_disabled_set(index, EINA_TRUE);
	elm_object_part_content_set(layout, "controller", index);

	for (i = 0; i < max_items; ++i)
	{
		pd->it[i] = elm_index_item_append(index, NULL, NULL, (void *) i);
		if (it_style)
			elm_object_item_style_set(pd->it[i], it_style[i]);
	}

	pd->min_page = 0;
	pd->max_page = max_items - 1;
	elm_index_level_go(index, 0);
	elm_index_item_selected_set(pd->it[0], EINA_TRUE);

	pd->cur_page = 0;
	pd->index = index;
	pd->last_it = pd->it[0];

	evas_object_event_callback_add(index, EVAS_CALLBACK_MOUSE_DOWN, _on_index_mouse_down_cb, pd);
	evas_object_event_callback_add(index, EVAS_CALLBACK_MOUSE_MOVE, _on_index_mouse_move_cb, pd);
	evas_object_event_callback_add(index, EVAS_CALLBACK_MOUSE_UP, _on_index_mouse_up_cb, pd);

	nf_it = elm_naviframe_item_push(parent, NULL, NULL, NULL, layout, NULL);
	elm_naviframe_item_title_enabled_set(nf_it, EINA_FALSE, EINA_FALSE);
}
Exemplo n.º 20
0
static bool app_create(void *data) {
    /* Hook to take necessary actions before main event loop starts
     * Initialize UI resources and application's data
     * If this function returns true, the main loop of application starts
     * If this function returns false, the application is terminated. */

    Evas_Object *gl;
    Application *ad = (Application *)data;

    if (!data)
        return false;

    /* Create and initialize GLView */
    elm_config_accel_preference_set("opengl");
    /* Create the window */
    ad->_win = add_win("cocos2d-x");

    if (!ad->_win)
        return false;

    int rots[2];
    rots[0] = ad->_orientation;
    rots[1] = rots[0] + 180 % 360;
    elm_win_wm_rotation_available_rotations_set(ad->_win, rots, 2);

    ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _key_down_cb, ad);
    ecore_event_handler_add(ECORE_EVENT_KEY_UP, _key_up_cb, ad);

    gl = elm_glview_add(ad->_win);
    elm_win_resize_object_add(ad->_win, gl);
    ELEMENTARY_GLVIEW_GLOBAL_USE(gl);
    evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
    evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);

    /* Create and initialize GLView */
    ad->initGLContextAttrs();
    auto attrs = GLView::getGLContextAttrs();
    auto mode = get_glview_mode(attrs);
    elm_glview_mode_set(gl, mode);

    /* The resize policy tells GLView what to do with the surface when it
     * resizes. ELM_GLVIEW_RESIZE_POLICY_RECREATE will tell it to
     * destroy the current surface and recreate it to the new size.
     */
    //elm_glview_resize_policy_set(gl, ELM_GLVIEW_RESIZE_POLICY_RECREATE);

    /* The render policy sets how GLView should render GL code.
     * ELM_GLVIEW_RENDER_POLICY_ON_DEMAND will have the GL callback
     * called only when the object is visible.
     * ELM_GLVIEW_RENDER_POLICY_ALWAYS would cause the callback to be
     * called even if the object were hidden.
     */
    elm_glview_render_policy_set(gl, ELM_GLVIEW_RENDER_POLICY_ON_DEMAND);

    /* The initialize callback function gets registered here */
    elm_glview_init_func_set(gl, init_gl);

    /* The delete callback function gets registered here */
    elm_glview_del_func_set(gl, del_gl);

    /* The resize callback function gets registered here */
    // Cocos2d-x doesn't support to change orientation from portrait to landscape.
    // So comment next line.
//  elm_glview_resize_func_set(gl, resize_gl);

    /* The render callback function gets registered here */
    elm_glview_render_func_set(gl, draw_gl);

    /* Add the GLView to the box and show it */
    evas_object_show(gl);

    elm_object_focus_set(gl, EINA_TRUE);

    /* This adds an animator so that the app will regularly
     * trigger updates of the GLView using elm_glview_changed_set().
     *
     * NOTE: If you delete GL, this animator will keep running trying to access
     * GL so this animator needs to be deleted with ecore_animator_del().
     */
    ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER);
    ad->_ani = ecore_animator_add(anim, gl);
    evas_object_data_set(gl, "ani", ad->_ani);
    evas_object_event_callback_add(gl, EVAS_CALLBACK_DEL, del_anim, gl);

    /* Add Mouse Event Callbacks */
    evas_object_event_callback_add(gl, EVAS_CALLBACK_MOUSE_DOWN, touch_down_cb, ad);
    evas_object_event_callback_add(gl, EVAS_CALLBACK_MOUSE_MOVE, touch_move_cb, ad);
    evas_object_event_callback_add(gl, EVAS_CALLBACK_MOUSE_UP, touch_up_cb, ad);

    evas_object_event_callback_add(gl, EVAS_CALLBACK_MULTI_DOWN, touches_down_cb, ad);
    evas_object_event_callback_add(gl, EVAS_CALLBACK_MULTI_MOVE, touches_move_cb, ad);
    evas_object_event_callback_add(gl, EVAS_CALLBACK_MULTI_UP, touches_up_cb, ad);



    create_indicator(ad);

    return true;
}
Exemplo n.º 21
0
void GestureHandler::handleFlick(const IntSize& offset)
{
    m_flickOffset = offset;
    m_flickIndex = m_flickDuration = 1 / ecore_animator_frametime_get();
    m_flickAnimator = ecore_animator_add(flickAnimatorCallback, this);
}
Exemplo n.º 22
0
void GestureHandler::handlePanStarted(const IntPoint& point)
{
    ASSERT(!m_panAnimator);
    m_panAnimator = ecore_animator_add(panAnimatorCallback, this);
    m_lastPoint = m_currentPoint = point;
}
Exemplo n.º 23
0
   if (_apply_delay) ecore_timer_del(_apply_delay);
   if (_fade_animator) ecore_animator_del(_fade_animator);
   _apply_delay = NULL;
   _fade_animator = NULL;
   _applying = EINA_FALSE;
   _fade_obj = NULL;
}

static Eina_Bool
_cb_delay_timer(void *data EINA_UNUSED)
{
   _apply_delay = NULL;
   _target_from = 255;
   _target_to = 0;
   _start_time = ecore_loop_time_get();
   _fade_animator = ecore_animator_add(_cb_fade_animator, NULL);
   return EINA_FALSE;
}

static Eina_Bool
_cb_fade_animator(void *data EINA_UNUSED)
{
   double t = ecore_loop_time_get() - _start_time;
   int v;

   t = t / 0.5;
   if (t < 0.0) t = 0.0;
   v = _target_from + ((_target_to - _target_from) * t);
   if (t >= 1.0) v = _target_to;
   evas_object_color_set(_fade_obj, 0, 0, 0, v);
   if (v == _target_to)
Exemplo n.º 24
0
void Animator::init()
{
	m_Animator = ecore_animator_add( timer_func, this );
	ecore_animator_freeze( m_Animator );
}
Exemplo n.º 25
0
Evas_Object *
SampleView::CreateView(void *data) const {
	appdata_s *ad = static_cast<appdata_s *>(data);

	/* Create and initialize GLView */
	Evas_Object *glview = elm_glview_version_add(ad->navi, EVAS_GL_GLES_3_X);
	//Evas_Object* glview = elm_glview_add(ad->navi); 	//for GLES 2.0
	ELEMENTARY_GLVIEW_GLOBAL_USE(glview);

	evas_object_size_hint_align_set(glview, EVAS_HINT_FILL, EVAS_HINT_FILL);
	evas_object_size_hint_weight_set(glview, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);


	/* Request a surface with alpha and a depth buffer */
	elm_glview_mode_set(glview, ELM_GLVIEW_DEPTH);

	/* The resize policy tells GLView what to do with the surface when it
	 * resizes. ELM_GLVIEW_RESIZE_POLICY_RECREATE will tell it to
	 * destroy the current surface and recreate it to the new size.
	 */
	elm_glview_resize_policy_set(glview, ELM_GLVIEW_RESIZE_POLICY_RECREATE);

	/* The render policy sets how GLView should render GL code.
	 * ELM_GLVIEW_RENDER_POLICY_ON_DEMAND will have the GL callback
	 * called only when the obj is visible.
	 * ELM_GLVIEW_RENDER_POLICY_ALWAYS would cause the callback to be
	 * called even if the obj were hidden.
	 */
	elm_glview_render_policy_set(glview, ELM_GLVIEW_RENDER_POLICY_ON_DEMAND);

	/* The initialize callback function gets registered here */
	elm_glview_init_func_set(glview, init_glview);

	/* The delete callback function gets registered here */
	elm_glview_del_func_set(glview, del_glview);

	/* The resize callback function gets registered here */
	elm_glview_resize_func_set(glview, resize_glview);

	/* The render callback function gets registered here */
	elm_glview_render_func_set(glview, draw_glview);

	/* This adds an animator so that the app will regularly
	 * trigger updates of the GLView using elm_glview_changed_set().
	 *
	 * NOTE: If you delete GL, this animator will keep running trying to access
	 * GL so this animator needs to be deleted with ecore_animator_del().
	 */
	Ecore_Animator *ani = ecore_animator_add(anim_cb, glview);
	evas_object_event_callback_add(glview, EVAS_CALLBACK_DEL, del_anim_cb, glview);
	//
	evas_object_event_callback_add(glview, EVAS_CALLBACK_MOUSE_DOWN, mouse_down_cb, ad);
	evas_object_event_callback_add(glview, EVAS_CALLBACK_MOUSE_UP, mouse_up_cb, ad);
	evas_object_event_callback_add(glview, EVAS_CALLBACK_MOUSE_MOVE, mouse_move_cb, ad);

	evas_object_data_set(glview, "ad", ad);
	evas_object_data_set(glview, "ani", ani);
	evas_object_data_set(glview, "sv", this);

	return glview;
}
Exemplo n.º 26
0
int
main(int argc, char *argv[])
{
    app_t app;
    int i;
    char *engine = "x11-16";

    ecore_init();
    ecore_app_args_set(argc, (const char **)argv);
    ecore_evas_init();
    edje_init();

    edje_frametime_set(1.0 / 30.0);

    memset(&app, 0, sizeof(app));

    app.theme = THEME;
    app.fs = 1;
    app.total_ms = 1000;
    app.fade_in = 1;

    for (i=1; i < argc; i++)
        if (strcmp (argv[i], "-fs") == 0)
            ecore_evas_fullscreen_set(app.ee, 1);
        else if (strncmp (argv[i], "-theme=", sizeof("-theme=") - 1) == 0)
            app.theme = argv[i] + sizeof("-theme=") - 1;
        else if (strncmp (argv[i], "-time=", sizeof("-time=") - 1) == 0)
            app.total_ms = atoi(argv[i] + sizeof("-time=") - 1);
        else if (strncmp (argv[i], "-engine=", sizeof("-engine=") - 1) == 0)
            engine = argv[i] + sizeof("-engine=") - 1;

    if (app.total_ms < 1)
        app.total_ms = 1000;

    app.ee = init_ecore_evas(engine);
    if (!app.ee) {
        fprintf(stderr, "Could not init engine '%s'.\n", engine);
        return 1;
    }
    ecore_evas_data_set(app.ee, "app", &app);
    ecore_evas_title_set(app.ee, TITLE);
    ecore_evas_name_class_set(app.ee, WM_NAME, WM_CLASS);
    ecore_evas_fullscreen_set(app.ee, app.fs);

    fprintf(stderr, "time to fade: %dms\n", app.total_ms);

    app.evas = ecore_evas_get(app.ee);

    app.edje_main = edje_object_add(app.evas);
    evas_data_attach_set(app.evas, &app);
    if (!edje_object_file_set(app.edje_main, app.theme, THEME_GROUP)) {
        fprintf(stderr, "Failed to load file \"%s\", part \"%s\".\n",
                app.theme, THEME_GROUP);
        return 1;
    }

    app.obj = edje_object_part_object_get(app.edje_main, "obj");

    evas_object_move(app.edje_main, 0, 0);
    evas_object_resize(app.edje_main, WIDTH, HEIGHT);

    evas_object_show(app.edje_main);
    ecore_evas_show(app.ee);

    ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, app_signal_exit, NULL);
    ecore_evas_callback_resize_set(app.ee, resize_cb);

    evas_object_event_callback_add(app.edje_main, EVAS_CALLBACK_KEY_DOWN,
                                   key_down, &app);
    evas_object_focus_set(app.edje_main, 1);

    gettimeofday(&app.start, NULL);
    app.anim = ecore_animator_add(do_anim, &app);

    ecore_main_loop_begin();

    return 0;
}
Exemplo n.º 27
0
EAPI void
ede_game_start(void)
{
   Ede_Level *level;
   int row = 0, col = 0;

   D(" ");

   level = ede_level_current_get();

   ede_gui_level_selector_hide();
   ede_gui_menu_hide();

   ede_gui_level_init(level->rows, level->cols, level->towers);

   // populate the checkboard with walls, start points and home
   for (row = 0; row < level->rows; row++)
   {
      for (col = 0; col < level->cols; col++)
      {
#if LOCAL_DEBUG
         // DBG show col/row numbers
         if (row == 0)
         {
            ede_gui_cell_overlay_add(OVERLAY_BORDER_RED, row, col);
            ede_gui_cell_overlay_text_set(row, col, col, 1);
         }
         if (col == 0)
         {
            ede_gui_cell_overlay_add(OVERLAY_BORDER_RED, row, col);
            ede_gui_cell_overlay_text_set(row, col, row, 2);
         }
#endif
         //~ printf("%d\n", level->cells[row][col]);
         switch (cells[row][col])
         {
            case CELL_WALL:
               ede_gui_cell_overlay_add(OVERLAY_IMAGE_WALL, row, col);
               break;
            case CELL_START0:case CELL_START1:case CELL_START2:case CELL_START3:
            case CELL_START4:case CELL_START5:case CELL_START6:case CELL_START7:
            case CELL_START8:case CELL_START9:
               ede_gui_cell_overlay_add(OVERLAY_COLOR_RED, row, col);
               ede_gui_cell_overlay_text_set(row, col, cells[row][col] - CELL_START0, 1);
               break;
            default:
               break;
         }
      }
   }
   ede_gui_cell_overlay_add(OVERLAY_COLOR_GREEN, level->home_row, level->home_col);

   _player_lives = level->lives;
   _player_bucks = level->bucks;
   _player_score = 0;
   _play_time = 0.0;

   ede_gui_lives_set(_player_lives);
   ede_gui_bucks_set(_player_bucks);
   ede_gui_score_set(_player_score);
   ede_game_state_set(GAME_STATE_PLAYING);

   ede_wave_start();

   ecore_animator_frametime_set(1.0 / MAX_FPS);

   if (!_animator)
      _animator = ecore_animator_add(_game_loop, NULL);
}