diff options
-rw-r--r-- | inc/view/view_base.h | 5 | ||||
-rw-r--r-- | src/view/view_base.c | 11 | ||||
-rw-r--r-- | src/view/view_racing.c | 22 |
3 files changed, 28 insertions, 10 deletions
diff --git a/inc/view/view_base.h b/inc/view/view_base.h index a610f82..d9c896c 100644 --- a/inc/view/view_base.h +++ b/inc/view/view_base.h @@ -35,7 +35,8 @@ typedef enum _e_veritcal_align { void view_base_get_resource(const char *edj_file_in, char *edj_path_out); Evas_Object *view_base_create_button(Evas_Object *parent, char *part, char *text, Evas_Smart_Cb callback, void *data); Evas_Object *view_base_create_layout(Evas_Object *parent, char *edj_file, char *group); -void view_base_set_position(Evas_Object *image, int pos_X, - int pos_Y, e_horizontal_align horizontal_align, e_vertical_align vertical_align); +void view_base_set_position(Evas_Object *image, int pos_X, int pos_Y, + e_horizontal_align horizontal_align, e_vertical_align vertical_align); +void view_base_set_angle(Evas_Object *image, float angle, float rotation_center_x, float rotation_center_y); #endif /* VIEW_VIEW_BASE_H_ */ diff --git a/src/view/view_base.c b/src/view/view_base.c index 29c1c72..fdc7ef6 100644 --- a/src/view/view_base.c +++ b/src/view/view_base.c @@ -116,3 +116,14 @@ void view_base_set_position(Evas_Object *obj, int pos_x, int pos_y, evas_object_move(obj, x, y); } + +void view_base_set_angle(Evas_Object *image, float angle, float rotation_center_x, float rotation_center_y) +{ + Evas_Map *map = evas_map_new(4); + evas_map_util_points_populate_from_object(map, image); + evas_map_util_rotate(map, angle, rotation_center_x, rotation_center_y); + evas_object_map_set(image, map); + evas_object_map_enable_set(image, true); + evas_map_free(map); +} + diff --git a/src/view/view_racing.c b/src/view/view_racing.c index fc58725..0595cf1 100644 --- a/src/view/view_racing.c +++ b/src/view/view_racing.c @@ -25,14 +25,13 @@ typedef struct _s_view_racing { Evas_Object *layout; Evas_Object *velocity; Evas_Object *direction; + float velocity_angle; + float direction_angle; } s_view_racing; static s_view_racing s_info = { 0,}; -static Evas_Object *_create_image(Evas_Object* parent, - int pos_X, int pos_Y, int width, int height, - char *file_name, - e_horizontal_align horizontal_align, e_vertical_align vertical_align) +static Evas_Object *_create_image(Evas_Object* parent, int pos_X, int pos_Y, int width, int height, float angle, char *file_name,e_horizontal_align horizontal_align, e_vertical_align vertical_align) { char img_path[PATH_MAX]; view_base_get_resource(file_name, img_path); @@ -51,6 +50,8 @@ static Evas_Object *_create_image(Evas_Object* parent, evas_object_resize(image, width, height); view_base_set_position(image, pos_X, pos_Y, horizontal_align, vertical_align); + view_base_set_angle(image, angle, 180, 180); + evas_object_show(image); return image; @@ -78,10 +79,16 @@ static void _view_racing_create_gui(Evas_Object *parent) { s_info.layout = view_base_create_layout(parent, "edje/racing.edj", GRP_MAIN); eext_object_event_callback_add(s_info.layout, EEXT_CALLBACK_BACK, _layout_back_cb, NULL); - elm_layout_text_set(s_info.layout, "txt_title", "Racing"); - s_info.velocity = _create_image(parent, 44, 180, 160, 50, "images/vel.png", HORIZONTAL_ALIGN_LEFT, VERTICAL_ALIGN_CENTER); - s_info.direction = _create_image(parent, 180, -5, 38, 38, "images/circle.png", HORIZONTAL_ALIGN_CENTER, VERTICAL_ALIGN_TOP); + s_info.velocity_angle = 45; + s_info.velocity = _create_image(parent, 44, 180, 160, 50, + s_info.velocity_angle, + "images/vel.png", HORIZONTAL_ALIGN_LEFT, VERTICAL_ALIGN_CENTER); + + s_info.direction_angle = 30; + s_info.direction = _create_image(parent, 180, -5, 38, 38, + s_info.direction_angle, + "images/circle.png", HORIZONTAL_ALIGN_CENTER, VERTICAL_ALIGN_TOP); evas_object_event_callback_add(s_info.layout, EVAS_CALLBACK_DEL, _view_destroyed_cb, NULL); elm_layout_signal_callback_add(s_info.layout, "clicked", "", _racing_screen_clicked_cb, NULL); @@ -89,7 +96,6 @@ static void _view_racing_create_gui(Evas_Object *parent) void view_racing_init(Evas_Object *parent) { - controller_racing_init(NULL); _view_racing_create_gui(parent); } |