diff options
author | David Walter Seikel | 2013-01-27 11:19:12 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-27 11:19:12 +1000 |
commit | 08c416d49b10ba1a30d398980641a9d8b5ce4494 (patch) | |
tree | 07f50b172b9c159f81c2306f719f521f203a8a39 /ClientHamr/extantz | |
parent | Move a bunch of stuff into the new cameraMove structure, and some clean ups. (diff) | |
download | SledjHamr-08c416d49b10ba1a30d398980641a9d8b5ce4494.zip SledjHamr-08c416d49b10ba1a30d398980641a9d8b5ce4494.tar.gz SledjHamr-08c416d49b10ba1a30d398980641a9d8b5ce4494.tar.bz2 SledjHamr-08c416d49b10ba1a30d398980641a9d8b5ce4494.tar.xz |
Make keyboard rotation work.
Diffstat (limited to 'ClientHamr/extantz')
-rw-r--r-- | ClientHamr/extantz/extantz.c | 18 | ||||
-rw-r--r-- | ClientHamr/extantz/extantzCamera.cpp | 10 |
2 files changed, 20 insertions, 8 deletions
diff --git a/ClientHamr/extantz/extantz.c b/ClientHamr/extantz/extantz.c index 46dc8a3..7e9f353 100644 --- a/ClientHamr/extantz/extantz.c +++ b/ClientHamr/extantz/extantz.c | |||
@@ -370,15 +370,16 @@ static Eina_Bool _on_camera_input(void *data, Evas_Object *obj, Evas_Object *src | |||
370 | // Yes, we are dealing with the horrid Evas keyboard handling FUCKING STRING COMPARES! Soooo ... | 370 | // Yes, we are dealing with the horrid Evas keyboard handling FUCKING STRING COMPARES! Soooo ... |
371 | // TODO - make this a hash lookup dammit. | 371 | // TODO - make this a hash lookup dammit. |
372 | // TODO - these are not working, coz Elm is grabbing the Left, Right, Up, and Down KEY_DOWNs. | 372 | // TODO - these are not working, coz Elm is grabbing the Left, Right, Up, and Down KEY_DOWNs. |
373 | // TODO - no idea why yet, but can't do Home and Prior / Next at the same time. Don't seem to be a bug in the Irrlicht original at least. | ||
373 | if (EVAS_CALLBACK_KEY_DOWN == type) | 374 | if (EVAS_CALLBACK_KEY_DOWN == type) |
374 | { | 375 | { |
375 | if (0 == strcmp(ev->keyname, "Escape")) | 376 | if (0 == strcmp(ev->keyname, "Escape")) |
376 | { | 377 | { |
377 | } | 378 | } |
378 | else if (0 == strcmp(ev->key, "Left")) | 379 | else if (0 == strcmp(ev->key, "Left")) |
379 | gld->move->y = 1.0; | 380 | gld->move->r = 1.0; |
380 | else if (0 == strcmp(ev->key, "Right")) | 381 | else if (0 == strcmp(ev->key, "Right")) |
381 | gld->move->y = -1.0; | 382 | gld->move->r = -1.0; |
382 | else if (0 == strcmp(ev->key, "Up")) | 383 | else if (0 == strcmp(ev->key, "Up")) |
383 | gld->move->x = 1.0; | 384 | gld->move->x = 1.0; |
384 | else if (0 == strcmp(ev->key, "Down")) | 385 | else if (0 == strcmp(ev->key, "Down")) |
@@ -388,9 +389,9 @@ static Eina_Bool _on_camera_input(void *data, Evas_Object *obj, Evas_Object *src | |||
388 | else if (0 == strcmp(ev->key, "Next")) | 389 | else if (0 == strcmp(ev->key, "Next")) |
389 | gld->move->x = -1.0; | 390 | gld->move->x = -1.0; |
390 | else if (0 == strcmp(ev->key, "Home")) | 391 | else if (0 == strcmp(ev->key, "Home")) |
391 | gld->move->y = 1.0; | 392 | gld->move->r = 1.0; |
392 | else if (0 == strcmp(ev->key, "End")) | 393 | else if (0 == strcmp(ev->key, "End")) |
393 | gld->move->y = -1.0; | 394 | gld->move->r = -1.0; |
394 | else if (0 == strcmp(ev->key, "space")) | 395 | else if (0 == strcmp(ev->key, "space")) |
395 | gld->move->jump = 1.0; | 396 | gld->move->jump = 1.0; |
396 | else | 397 | else |
@@ -402,9 +403,9 @@ static Eina_Bool _on_camera_input(void *data, Evas_Object *obj, Evas_Object *src | |||
402 | { | 403 | { |
403 | } | 404 | } |
404 | else if (0 == strcmp(ev->key, "Left")) | 405 | else if (0 == strcmp(ev->key, "Left")) |
405 | gld->move->y = 0.0; | 406 | gld->move->r = 0.0; |
406 | else if (0 == strcmp(ev->key, "Right")) | 407 | else if (0 == strcmp(ev->key, "Right")) |
407 | gld->move->y = 0.0; | 408 | gld->move->r = 0.0; |
408 | else if (0 == strcmp(ev->key, "Up")) | 409 | else if (0 == strcmp(ev->key, "Up")) |
409 | gld->move->x = 0.0; | 410 | gld->move->x = 0.0; |
410 | else if (0 == strcmp(ev->key, "Down")) | 411 | else if (0 == strcmp(ev->key, "Down")) |
@@ -414,14 +415,15 @@ static Eina_Bool _on_camera_input(void *data, Evas_Object *obj, Evas_Object *src | |||
414 | else if (0 == strcmp(ev->key, "Next")) | 415 | else if (0 == strcmp(ev->key, "Next")) |
415 | gld->move->x = 0.0; | 416 | gld->move->x = 0.0; |
416 | else if (0 == strcmp(ev->key, "Home")) | 417 | else if (0 == strcmp(ev->key, "Home")) |
417 | gld->move->y = 0.0; | 418 | gld->move->r = 0.0; |
418 | else if (0 == strcmp(ev->key, "End")) | 419 | else if (0 == strcmp(ev->key, "End")) |
419 | gld->move->y = 0.0; | 420 | gld->move->r = 0.0; |
420 | else if (0 == strcmp(ev->key, "space")) | 421 | else if (0 == strcmp(ev->key, "space")) |
421 | gld->move->jump = 0.0; | 422 | gld->move->jump = 0.0; |
422 | else | 423 | else |
423 | printf("Unexpected up keystroke - %s\n", ev->key); | 424 | printf("Unexpected up keystroke - %s\n", ev->key); |
424 | } | 425 | } |
426 | return EINA_TRUE; | ||
425 | } | 427 | } |
426 | else | 428 | else |
427 | printf("Camera input not ready\n"); | 429 | printf("Camera input not ready\n"); |
diff --git a/ClientHamr/extantz/extantzCamera.cpp b/ClientHamr/extantz/extantzCamera.cpp index f4554be..8337f8c 100644 --- a/ClientHamr/extantz/extantzCamera.cpp +++ b/ClientHamr/extantz/extantzCamera.cpp | |||
@@ -171,6 +171,16 @@ void extantzCamera::animateNode(ISceneNode* node, u32 timeMs) | |||
171 | CursorPos = CenterCursor; | 171 | CursorPos = CenterCursor; |
172 | } | 172 | } |
173 | } | 173 | } |
174 | #else | ||
175 | relativeRotation.Y -= move.r * move.RotateSpeed; | ||
176 | relativeRotation.X -= move.s * move.RotateSpeed * MouseYDirection; | ||
177 | |||
178 | // X < MaxVerticalAngle or X > 360-MaxVerticalAngle | ||
179 | |||
180 | if ((relativeRotation.X > (MaxVerticalAngle * 2)) && (relativeRotation.X < (360.0f - MaxVerticalAngle))) | ||
181 | relativeRotation.X = 360.0f - MaxVerticalAngle; | ||
182 | else if ((relativeRotation.X > MaxVerticalAngle) && (relativeRotation.X < (360.0f - MaxVerticalAngle))) | ||
183 | relativeRotation.X = MaxVerticalAngle; | ||
174 | #endif | 184 | #endif |
175 | 185 | ||
176 | // set target | 186 | // set target |