summaryrefslogtreecommitdiff
path: root/src/view/view_racing.c
diff options
context:
space:
mode:
authorMichal Skorupinski <m.skorupinsk@samsung.com>2018-08-31 21:13:28 +0200
committerKrzysztof Wieclaw <k.wieclaw@samsung.com>2018-09-07 15:01:40 +0200
commitc94da49615d1b9335b4f334fee8372178cf1bb10 (patch)
tree7b0a9595e82cca74549b3e03b162c07adbc39d46 /src/view/view_racing.c
parentf042b0dd4e753da471d9927655214ccd791b0a7c (diff)
downloadgear-racing-controller-c94da49615d1b9335b4f334fee8372178cf1bb10.tar.gz
gear-racing-controller-c94da49615d1b9335b4f334fee8372178cf1bb10.tar.bz2
gear-racing-controller-c94da49615d1b9335b4f334fee8372178cf1bb10.zip
Camera controll
Change-Id: Ib5de05c12fae6da1a1e3df350457b231bfe715d1 Signed-off-by: Michal Skorupinski <m.skorupinsk@samsung.com>
Diffstat (limited to 'src/view/view_racing.c')
-rw-r--r--src/view/view_racing.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/view/view_racing.c b/src/view/view_racing.c
index b588ede..f2468af 100644
--- a/src/view/view_racing.c
+++ b/src/view/view_racing.c
@@ -112,6 +112,9 @@ static void _controller_cb(void *data)
angle = math_helper_range_map(fabsf(controller_data->throttle), 0, 1, s_info.vel_min_angle, s_info.vel_max_angle);
view_base_set_angle(s_info.velocity, angle, 180.0, 180.0);
+ angle = math_helper_range_map(controller_data->cam_elevation, 0, 1, 0, 90);
+ view_base_set_angle(s_info.camera_elevation_indicator, 90 - angle, 180.0, 180.0);
+
if (controller_data->throttle < 0) {
evas_object_color_set(s_info.velocity, 0, 255, 255, 255);
} else {
@@ -165,17 +168,20 @@ static Eina_Bool _camera_azimuth_animator_cb(void *data)
s_info.cam_azimuth = 0;
}
-
if (s_info.cam_azimuth < -1) {
- s_info.cam_azimuth = 1;
- } else if (s_info.cam_azimuth > 1) {
s_info.cam_azimuth = -1;
+ } else if (s_info.cam_azimuth > 1) {
+ s_info.cam_azimuth = 1;
}
- float angle = math_helper_range_map(s_info.cam_azimuth, -1, 1, -180.0f, 180.0f);
+ controller_racing_set_cam_azimuth(s_info.cam_azimuth);
+
+ float angle = math_helper_range_map(s_info.cam_azimuth, -1, 1, -90.0f, 90.0f);
view_base_set_angle(s_info.camera_azimuth_indicator, angle, 180.0, 180.0);
_D("[CAM] AZIMUTH: % f", s_info.cam_azimuth);
+
+
return ECORE_CALLBACK_RENEW;
}
@@ -231,7 +237,7 @@ static void _view_racing_create_gui(Evas_Object *parent)
evas_object_color_set(s_info.camera_azimuth_indicator, 0, 255, 255, 255);
s_info.camera_elevation_indicator = _create_image(parent, 180, -5, 17, 17,
- 180.0f,
+ 90.0f,
"images/circle.png", HORIZONTAL_ALIGN_CENTER, VERTICAL_ALIGN_TOP);
evas_object_color_set(s_info.camera_elevation_indicator, 255, 0, 0, 255);