InputSample.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  1. #include "InputSample.h"
  2. #include "SamplesGame.h"
  3. #if defined(ADD_SAMPLE)
  4. ADD_SAMPLE("Input", "Basic Input", InputSample, 1);
  5. #endif
  6. /**
  7. * Returns the string representation of the given key.
  8. */
  9. static const char* keyString(int key);
  10. InputSample::InputSample()
  11. : _mouseString("No Mouse"), _font(NULL), _inputSampleControls(NULL), _mouseWheel(0), _crosshair(NULL)
  12. {
  13. }
  14. void InputSample::initialize()
  15. {
  16. setMultiTouch(true);
  17. // Load font
  18. _font = Font::create("res/common/arial18.gpb");
  19. assert(_font);
  20. // Reuse part of the gamepad texture as the crosshair in this sample.
  21. _crosshair = SpriteBatch::create("res/png/gamepad.png");
  22. _crosshairDstRect.set(0, 0, 256, 256);
  23. _crosshairSrcRect.set(256, 0, 256, 256);
  24. _crosshairLowerLimit.set(-_crosshairSrcRect.width / 2.0f, -_crosshairSrcRect.height / 2.0f);
  25. _crosshairUpperLimit.set((float)getWidth(), (float)getHeight());
  26. _crosshairUpperLimit += _crosshairLowerLimit;
  27. // Create input sample controls
  28. _keyboardState = false;
  29. _inputSampleControls = Form::create("res/common/inputs.form");
  30. static_cast<Button*>(_inputSampleControls->getControl("showKeyboardButton"))->addListener(this, Listener::CLICK);
  31. static_cast<Button*>(_inputSampleControls->getControl("captureMouseButton"))->addListener(this, Listener::CLICK);
  32. if (!hasMouse())
  33. {
  34. static_cast<Button*>(_inputSampleControls->getControl("captureMouseButton"))->setVisible(false);
  35. }
  36. _inputSampleControls->getControl("restoreMouseLabel")->setVisible(false);
  37. _mousePoint.set(-100, -100);
  38. }
  39. void InputSample::finalize()
  40. {
  41. setMouseCaptured(false);
  42. if (_keyboardState)
  43. {
  44. displayKeyboard(false);
  45. }
  46. SAFE_RELEASE(_inputSampleControls);
  47. SAFE_DELETE(_crosshair);
  48. SAFE_RELEASE(_font);
  49. }
  50. void InputSample::update(float elapsedTime)
  51. {
  52. }
  53. void InputSample::render(float elapsedTime)
  54. {
  55. // Clear the color and depth buffers
  56. clear(CLEAR_COLOR_DEPTH, Vector4::zero(), 1.0f, 0);
  57. _inputSampleControls->draw();
  58. // Draw text
  59. Vector4 fontColor(1.0f, 1.0f, 1.0f, 1.0f);
  60. unsigned int width, height;
  61. char buffer[50];
  62. _font->start();
  63. if (isMouseCaptured())
  64. {
  65. // Draw crosshair at current offest w.r.t. center of screen
  66. _crosshair->start();
  67. _crosshair->draw(_crosshairDstRect, _crosshairSrcRect);
  68. _crosshair->finish();
  69. }
  70. else
  71. {
  72. for (std::list<TouchPoint>::const_iterator it = _touchPoints.begin(); it != _touchPoints.end(); ++it)
  73. {
  74. sprintf(buffer, "T_%u(%d,%d)", it->_id, (int)it->_coord.x, (int)it->_coord.y);
  75. _font->measureText(buffer, _font->getSize(), &width, &height);
  76. int x = it->_coord.x - (int)(width>>1);
  77. int y = it->_coord.y - (int)(height>>1);
  78. _font->drawText(buffer, x, y, fontColor, _font->getSize());
  79. }
  80. // Mouse
  81. sprintf(buffer, "M(%d,%d)", (int)_mousePoint.x, (int)_mousePoint.y);
  82. _font->measureText(buffer, _font->getSize(), &width, &height);
  83. int x = _mousePoint.x - (int)(width>>1);
  84. int y = _mousePoint.y - (int)(height>>1);
  85. _font->drawText(buffer, x, y, fontColor, _font->getSize());
  86. if (!_keyboardState && _mouseString.length() > 0)
  87. {
  88. int y = getHeight() - _font->getSize();
  89. _font->drawText(_mouseString.c_str(), 0, y, fontColor, _font->getSize());
  90. }
  91. if (_mouseWheel)
  92. {
  93. sprintf(buffer, "%d", _mouseWheel);
  94. _font->measureText(buffer, _font->getSize(), &width, &height);
  95. int x = _mouseWheelPoint.x - (int)(width>>1);
  96. int y = _mouseWheelPoint.y + 4;
  97. _font->drawText(buffer, x, y, fontColor, _font->getSize());
  98. }
  99. }
  100. // Pressed keys
  101. if (_keyboardString.length() > 0)
  102. {
  103. _font->drawText(_keyboardString.c_str(), 0, 0, fontColor, _font->getSize());
  104. }
  105. // Printable symbols typed
  106. if (_symbolsString.length() > 0)
  107. {
  108. _font->drawText(_symbolsString.c_str(), 0, _font->getSize(), fontColor, _font->getSize());
  109. }
  110. // Held keys
  111. if (!_downKeys.empty())
  112. {
  113. std::string displayKeys;
  114. for (std::set<int>::const_iterator i = _downKeys.begin(); i != _downKeys.end(); ++i)
  115. {
  116. const char* str = keyString(*i);
  117. displayKeys.append(str);
  118. }
  119. if (!displayKeys.empty())
  120. {
  121. _font->measureText(displayKeys.c_str(), _font->getSize(), &width, &height);
  122. int x = Game::getInstance()->getWidth() - width;
  123. int y = 0;
  124. _font->drawText(displayKeys.c_str(), x, y, fontColor, _font->getSize());
  125. }
  126. }
  127. // Draw the accelerometer values in the bottom right corner.
  128. static float pitch, roll;
  129. static float accelerometerDrawRate = 1000.0f;
  130. accelerometerDrawRate += elapsedTime;
  131. if (accelerometerDrawRate > 100.0f)
  132. {
  133. accelerometerDrawRate = 0.0f;
  134. getAccelerometerValues(&pitch, &roll);
  135. }
  136. if (!_keyboardState)
  137. {
  138. sprintf(buffer, "Pitch: %f Roll: %f", pitch, roll);
  139. _font->measureText(buffer, _font->getSize(), &width, &height);
  140. _font->drawText(buffer, getWidth() - width, getHeight() - height, fontColor, _font->getSize());
  141. }
  142. _font->finish();
  143. }
  144. bool InputSample::drawScene(Node* node)
  145. {
  146. // If the node visited contains a model, draw it
  147. Model* model = node->getModel();
  148. if (model)
  149. {
  150. model->draw();
  151. }
  152. return true;
  153. }
  154. void InputSample::touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex)
  155. {
  156. TouchPoint* tp = NULL;
  157. // Not optimal, however we expect the list size to be very small (<10)
  158. for (std::list<TouchPoint>::iterator it = _touchPoints.begin(); it != _touchPoints.end(); ++it)
  159. {
  160. if (it->_id == contactIndex)
  161. {
  162. tp = &(*it); // (seems redundant, however due to STD)
  163. break;
  164. }
  165. }
  166. // Add a new touch point if not found above
  167. if (!tp)
  168. {
  169. tp = new TouchPoint();
  170. tp->_id = contactIndex;
  171. _touchPoints.push_back(*tp);
  172. }
  173. // Update the touch point
  174. tp->_coord.x = x;
  175. tp->_coord.y = y;
  176. tp->_isStale = false; // (could be overwritten below)
  177. switch (evt)
  178. {
  179. case Touch::TOUCH_PRESS:
  180. // Purge all stale touch points
  181. for (std::list<TouchPoint>::iterator it = _touchPoints.begin(); it != _touchPoints.end(); )
  182. {
  183. if (it->_isStale)
  184. {
  185. it = _touchPoints.erase(it);
  186. }
  187. else
  188. {
  189. ++it;
  190. }
  191. }
  192. if (x < 30 && y < 30)
  193. {
  194. displayKeyboard(true);
  195. }
  196. break;
  197. case Touch::TOUCH_RELEASE:
  198. // Mark the current touch point as stale
  199. if (tp)
  200. {
  201. tp->_isStale = true;
  202. }
  203. break;
  204. case Touch::TOUCH_MOVE:
  205. break;
  206. };
  207. }
  208. bool InputSample::mouseEvent(Mouse::MouseEvent evt, int x, int y, int wheelDelta)
  209. {
  210. _mousePoint.set(x, y);
  211. _mouseString.clear();
  212. switch (evt)
  213. {
  214. case Mouse::MOUSE_PRESS_LEFT_BUTTON:
  215. _mouseString.append("MOUSE_PRESS_LEFT_BUTTON");
  216. break;
  217. case Mouse::MOUSE_RELEASE_LEFT_BUTTON:
  218. _mouseString.append("MOUSE_RELEASE_LEFT_BUTTON");
  219. break;
  220. case Mouse::MOUSE_PRESS_MIDDLE_BUTTON:
  221. _mouseString.append("MOUSE_PRESS_MIDDLE_BUTTON");
  222. break;
  223. case Mouse::MOUSE_RELEASE_MIDDLE_BUTTON:
  224. _mouseString.append("MOUSE_RELEASE_MIDDLE_BUTTON");
  225. break;
  226. case Mouse::MOUSE_PRESS_RIGHT_BUTTON:
  227. _mouseString.append("MOUSE_PRESS_RIGHT_BUTTON");
  228. break;
  229. case Mouse::MOUSE_RELEASE_RIGHT_BUTTON:
  230. _mouseString.append("MOUSE_RELEASE_RIGHT_BUTTON");
  231. break;
  232. case Mouse::MOUSE_MOVE:
  233. _mouseString.append("MOUSE_MOVE");
  234. if (isMouseCaptured())
  235. {
  236. // Control crosshair from captured mouse
  237. _crosshairDstRect.setPosition(_crosshairDstRect.x + x, _crosshairDstRect.y + y);
  238. // Use screen limits to clamp the crosshair position
  239. Vector2 pos(_crosshairDstRect.x, _crosshairDstRect.y);
  240. pos.clamp(_crosshairLowerLimit, _crosshairUpperLimit);
  241. _crosshairDstRect.setPosition(pos.x, pos.y);
  242. }
  243. break;
  244. case Mouse::MOUSE_WHEEL:
  245. _mouseString.append("MOUSE_WHEEL");
  246. _mouseWheelPoint.x = x;
  247. _mouseWheelPoint.y = y;
  248. _mouseWheel = wheelDelta;
  249. break;
  250. }
  251. return true;
  252. }
  253. void InputSample::keyEvent(Keyboard::KeyEvent evt, int key)
  254. {
  255. switch (evt)
  256. {
  257. case Keyboard::KEY_PRESS:
  258. _keyboardString.clear();
  259. _keyboardString.append(keyString(key));
  260. _keyboardString.append(" pressed");
  261. _downKeys.insert(key);
  262. if (key == Keyboard::KEY_ESCAPE)
  263. {
  264. _symbolsString.clear();
  265. }
  266. if (key == Keyboard::KEY_SPACE && hasMouse())
  267. {
  268. setCaptured(false);
  269. }
  270. break;
  271. case Keyboard::KEY_RELEASE:
  272. _keyboardString.clear();
  273. _keyboardString.append(keyString(key));
  274. _keyboardString.append(" released");
  275. _downKeys.erase(key);
  276. break;
  277. case Keyboard::KEY_CHAR:
  278. if (key == Keyboard::KEY_BACKSPACE)
  279. {
  280. if (_symbolsString.size() > 0)
  281. _symbolsString.resize((_symbolsString.size() - 1));
  282. }
  283. else
  284. {
  285. _symbolsString.append(1, (char)(0xFF & key));
  286. }
  287. break;
  288. };
  289. }
  290. void InputSample::controlEvent(Control* control, EventType evt)
  291. {
  292. if (strcmp(control->getId(), "showKeyboardButton") == 0)
  293. {
  294. _keyboardState = !_keyboardState;
  295. displayKeyboard(_keyboardState);
  296. static_cast<Button*>(_inputSampleControls->getControl("showKeyboardButton"))->setText(_keyboardState ? "Hide virtual keyboard" : "Show virtual keyboard");
  297. }
  298. else if (strcmp(control->getId(), "captureMouseButton") == 0 && hasMouse())
  299. {
  300. setCaptured(true);
  301. }
  302. }
  303. void InputSample::setCaptured(bool captured)
  304. {
  305. setMouseCaptured(captured);
  306. if (!captured || isMouseCaptured())
  307. {
  308. _inputSampleControls->getControl("showKeyboardButton")->setVisible(!captured);
  309. _inputSampleControls->getControl("captureMouseButton")->setVisible(!captured);
  310. _inputSampleControls->getControl("restoreMouseLabel")->setVisible(captured);
  311. }
  312. if (captured)
  313. {
  314. _crosshairDstRect.setPosition(
  315. (float)getWidth()/2.0f + _crosshairLowerLimit.x,
  316. (float)getHeight()/2.0f + _crosshairLowerLimit.y);
  317. }
  318. }
  319. const char* keyString(int key)
  320. {
  321. // This function is helpful for finding collisions in the Keyboard::Key enum.
  322. switch (key)
  323. {
  324. case Keyboard::KEY_NONE:
  325. return "NONE";
  326. case Keyboard::KEY_PAUSE:
  327. return "PAUSE";
  328. case Keyboard::KEY_SCROLL_LOCK:
  329. return "SCROLL_LOCK";
  330. case Keyboard::KEY_PRINT:
  331. return "PRINT";
  332. case Keyboard::KEY_SYSREQ:
  333. return "SYSREQ";
  334. case Keyboard::KEY_BREAK:
  335. return "BREAK";
  336. case Keyboard::KEY_ESCAPE:
  337. return "ESCAPE";
  338. case Keyboard::KEY_BACKSPACE:
  339. return "BACKSPACE";
  340. case Keyboard::KEY_TAB:
  341. return "TAB";
  342. case Keyboard::KEY_BACK_TAB:
  343. return "BACK_TAB";
  344. case Keyboard::KEY_RETURN:
  345. return "RETURN";
  346. case Keyboard::KEY_CAPS_LOCK:
  347. return "CAPS_LOCK";
  348. case Keyboard::KEY_SHIFT:
  349. return "SHIFT";
  350. case Keyboard::KEY_CTRL:
  351. return "CTRL";
  352. case Keyboard::KEY_ALT:
  353. return "ALT";
  354. case Keyboard::KEY_MENU:
  355. return "MENU";
  356. case Keyboard::KEY_HYPER:
  357. return "HYPER";
  358. case Keyboard::KEY_INSERT:
  359. return "INSERT";
  360. case Keyboard::KEY_HOME:
  361. return "HOME";
  362. case Keyboard::KEY_PG_UP:
  363. return "PG_UP";
  364. case Keyboard::KEY_DELETE:
  365. return "DELETE";
  366. case Keyboard::KEY_END:
  367. return "END";
  368. case Keyboard::KEY_PG_DOWN:
  369. return "PG_DOWN";
  370. case Keyboard::KEY_LEFT_ARROW:
  371. return "LEFT_ARROW";
  372. case Keyboard::KEY_RIGHT_ARROW:
  373. return "RIGHT_ARROW";
  374. case Keyboard::KEY_UP_ARROW:
  375. return "UP_ARROW";
  376. case Keyboard::KEY_DOWN_ARROW:
  377. return "DOWN_ARROW";
  378. case Keyboard::KEY_NUM_LOCK:
  379. return "NUM_LOCK";
  380. case Keyboard::KEY_KP_PLUS:
  381. return "KP_PLUS";
  382. case Keyboard::KEY_KP_MINUS:
  383. return "KP_MINUS";
  384. case Keyboard::KEY_KP_MULTIPLY:
  385. return "KP_MULTIPLY";
  386. case Keyboard::KEY_KP_DIVIDE:
  387. return "KP_DIVIDE";
  388. case Keyboard::KEY_KP_ENTER:
  389. return "KP_ENTER";
  390. case Keyboard::KEY_KP_HOME:
  391. return "KP_HOME";
  392. case Keyboard::KEY_KP_UP:
  393. return "KP_UP";
  394. case Keyboard::KEY_KP_PG_UP:
  395. return "KP_PG_UP";
  396. case Keyboard::KEY_KP_LEFT:
  397. return "KP_LEFT";
  398. case Keyboard::KEY_KP_FIVE:
  399. return "KP_FIVE";
  400. case Keyboard::KEY_KP_RIGHT:
  401. return "KP_RIGHT";
  402. case Keyboard::KEY_KP_END:
  403. return "KP_END";
  404. case Keyboard::KEY_KP_DOWN:
  405. return "KP_DOWN";
  406. case Keyboard::KEY_KP_PG_DOWN:
  407. return "KP_PG_DOWN";
  408. case Keyboard::KEY_KP_INSERT:
  409. return "KP_INSERT";
  410. case Keyboard::KEY_KP_DELETE:
  411. return "KP_DELETE";
  412. case Keyboard::KEY_F1:
  413. return "F1";
  414. case Keyboard::KEY_F2:
  415. return "F2";
  416. case Keyboard::KEY_F3:
  417. return "F3";
  418. case Keyboard::KEY_F4:
  419. return "F4";
  420. case Keyboard::KEY_F5:
  421. return "F5";
  422. case Keyboard::KEY_F6:
  423. return "F6";
  424. case Keyboard::KEY_F7:
  425. return "F7";
  426. case Keyboard::KEY_F8:
  427. return "F8";
  428. case Keyboard::KEY_F9:
  429. return "F9";
  430. case Keyboard::KEY_F10:
  431. return "F10";
  432. case Keyboard::KEY_F11:
  433. return "F11";
  434. case Keyboard::KEY_F12:
  435. return "F12";
  436. case Keyboard::KEY_SPACE:
  437. return "SPACE";
  438. case Keyboard::KEY_EXCLAM:
  439. return "!";
  440. case Keyboard::KEY_QUOTE:
  441. return "\"";
  442. case Keyboard::KEY_NUMBER:
  443. return "#";
  444. case Keyboard::KEY_DOLLAR:
  445. return "$";
  446. case Keyboard::KEY_PERCENT:
  447. return "%";
  448. case Keyboard::KEY_CIRCUMFLEX:
  449. return "^";
  450. case Keyboard::KEY_AMPERSAND:
  451. return "&";
  452. case Keyboard::KEY_APOSTROPHE:
  453. return "'";
  454. case Keyboard::KEY_LEFT_PARENTHESIS:
  455. return "(";
  456. case Keyboard::KEY_RIGHT_PARENTHESIS:
  457. return ")";
  458. case Keyboard::KEY_ASTERISK:
  459. return "*";
  460. case Keyboard::KEY_PLUS:
  461. return "+";
  462. case Keyboard::KEY_COMMA:
  463. return ",";
  464. case Keyboard::KEY_MINUS:
  465. return "-";
  466. case Keyboard::KEY_PERIOD:
  467. return ".";
  468. case Keyboard::KEY_SLASH:
  469. return "/";
  470. case Keyboard::KEY_ZERO:
  471. return "0";
  472. case Keyboard::KEY_ONE:
  473. return "1";
  474. case Keyboard::KEY_TWO:
  475. return "2";
  476. case Keyboard::KEY_THREE:
  477. return "3";
  478. case Keyboard::KEY_FOUR:
  479. return "4";
  480. case Keyboard::KEY_FIVE:
  481. return "5";
  482. case Keyboard::KEY_SIX:
  483. return "6";
  484. case Keyboard::KEY_SEVEN:
  485. return "7";
  486. case Keyboard::KEY_EIGHT:
  487. return "8";
  488. case Keyboard::KEY_NINE:
  489. return "9";
  490. case Keyboard::KEY_COLON:
  491. return ":";
  492. case Keyboard::KEY_SEMICOLON:
  493. return ";";
  494. case Keyboard::KEY_LESS_THAN:
  495. return "<";
  496. case Keyboard::KEY_EQUAL:
  497. return "=";
  498. case Keyboard::KEY_GREATER_THAN:
  499. return ">";
  500. case Keyboard::KEY_QUESTION:
  501. return "?";
  502. case Keyboard::KEY_AT:
  503. return "@";
  504. case Keyboard::KEY_CAPITAL_A:
  505. return "A";
  506. case Keyboard::KEY_CAPITAL_B:
  507. return "B";
  508. case Keyboard::KEY_CAPITAL_C:
  509. return "C";
  510. case Keyboard::KEY_CAPITAL_D:
  511. return "D";
  512. case Keyboard::KEY_CAPITAL_E:
  513. return "E";
  514. case Keyboard::KEY_CAPITAL_F:
  515. return "F";
  516. case Keyboard::KEY_CAPITAL_G:
  517. return "G";
  518. case Keyboard::KEY_CAPITAL_H:
  519. return "H";
  520. case Keyboard::KEY_CAPITAL_I:
  521. return "I";
  522. case Keyboard::KEY_CAPITAL_J:
  523. return "J";
  524. case Keyboard::KEY_CAPITAL_K:
  525. return "K";
  526. case Keyboard::KEY_CAPITAL_L:
  527. return "L";
  528. case Keyboard::KEY_CAPITAL_M:
  529. return "M";
  530. case Keyboard::KEY_CAPITAL_N:
  531. return "N";
  532. case Keyboard::KEY_CAPITAL_O:
  533. return "O";
  534. case Keyboard::KEY_CAPITAL_P:
  535. return "P";
  536. case Keyboard::KEY_CAPITAL_Q:
  537. return "Q";
  538. case Keyboard::KEY_CAPITAL_R:
  539. return "R";
  540. case Keyboard::KEY_CAPITAL_S:
  541. return "S";
  542. case Keyboard::KEY_CAPITAL_T:
  543. return "T";
  544. case Keyboard::KEY_CAPITAL_U:
  545. return "U";
  546. case Keyboard::KEY_CAPITAL_V:
  547. return "V";
  548. case Keyboard::KEY_CAPITAL_W:
  549. return "W";
  550. case Keyboard::KEY_CAPITAL_X:
  551. return "X";
  552. case Keyboard::KEY_CAPITAL_Y:
  553. return "Y";
  554. case Keyboard::KEY_CAPITAL_Z:
  555. return "Z";
  556. case Keyboard::KEY_LEFT_BRACKET:
  557. return "[";
  558. case Keyboard::KEY_BACK_SLASH:
  559. return "\\";
  560. case Keyboard::KEY_RIGHT_BRACKET:
  561. return "]";
  562. case Keyboard::KEY_UNDERSCORE:
  563. return "_";
  564. case Keyboard::KEY_GRAVE:
  565. return "`";
  566. case Keyboard::KEY_A:
  567. return "a";
  568. case Keyboard::KEY_B:
  569. return "b";
  570. case Keyboard::KEY_C:
  571. return "c";
  572. case Keyboard::KEY_D:
  573. return "d";
  574. case Keyboard::KEY_E:
  575. return "e";
  576. case Keyboard::KEY_F:
  577. return "f";
  578. case Keyboard::KEY_G:
  579. return "g";
  580. case Keyboard::KEY_H:
  581. return "h";
  582. case Keyboard::KEY_I:
  583. return "i";
  584. case Keyboard::KEY_J:
  585. return "j";
  586. case Keyboard::KEY_K:
  587. return "k";
  588. case Keyboard::KEY_L:
  589. return "l";
  590. case Keyboard::KEY_M:
  591. return "m";
  592. case Keyboard::KEY_N:
  593. return "n";
  594. case Keyboard::KEY_O:
  595. return "o";
  596. case Keyboard::KEY_P:
  597. return "p";
  598. case Keyboard::KEY_Q:
  599. return "q";
  600. case Keyboard::KEY_R:
  601. return "r";
  602. case Keyboard::KEY_S:
  603. return "s";
  604. case Keyboard::KEY_T:
  605. return "t";
  606. case Keyboard::KEY_U:
  607. return "u";
  608. case Keyboard::KEY_V:
  609. return "v";
  610. case Keyboard::KEY_W:
  611. return "w";
  612. case Keyboard::KEY_X:
  613. return "x";
  614. case Keyboard::KEY_Y:
  615. return "y";
  616. case Keyboard::KEY_Z:
  617. return "z";
  618. case Keyboard::KEY_LEFT_BRACE:
  619. return "{";
  620. case Keyboard::KEY_BAR:
  621. return "|";
  622. case Keyboard::KEY_RIGHT_BRACE:
  623. return "}";
  624. case Keyboard::KEY_TILDE:
  625. return "~";
  626. case Keyboard::KEY_EURO:
  627. return "EURO";
  628. case Keyboard::KEY_POUND:
  629. return "POUND";
  630. case Keyboard::KEY_YEN:
  631. return "YEN";
  632. case Keyboard::KEY_MIDDLE_DOT:
  633. return "MIDDLE DOT";
  634. case Keyboard::KEY_SEARCH:
  635. return "SEARCH";
  636. default:
  637. return "";
  638. };
  639. return "";
  640. }