No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

69 líneas
1.0 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the Do What The Fuck You Want To
  7. // Public License, Version 2, as published by Sam Hocevar. See
  8. // http://www.wtfpl.net/ for more details.
  9. //
  10. #if defined HAVE_CONFIG_H
  11. # include "config.h"
  12. #endif
  13. #include <cstdlib>
  14. #include "core.h"
  15. namespace lol
  16. {
  17. /*
  18. * Keyboard implementation class
  19. */
  20. static class KeyboardData
  21. {
  22. friend class Keyboard;
  23. public:
  24. KeyboardData() { }
  25. private:
  26. Array<uint32_t> m_chars;
  27. }
  28. keyboarddata;
  29. /*
  30. * Public Keyboard class
  31. */
  32. Keyboard::Keyboard()
  33. : m_data(new KeyboardData())
  34. {
  35. }
  36. Keyboard::~Keyboard()
  37. {
  38. delete m_data;
  39. }
  40. void Keyboard::PushChar(uint32_t ch)
  41. {
  42. m_data->m_chars.Push(ch);
  43. }
  44. uint32_t Keyboard::PopChar()
  45. {
  46. if (!m_data->m_chars.Count())
  47. return 0;
  48. uint32_t ret = m_data->m_chars[0];
  49. m_data->m_chars.Remove(0);
  50. return ret;
  51. }
  52. } /* namespace lol */