Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

47 linhas
1.4 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2010-2013 Benjamin Litzelmann
  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 __LOL_INPUT_DEVICE_INTERNAL_H__
  11. #define __LOL_INPUT_DEVICE_H__
  12. #include "core.h"
  13. #if defined LOL_INPUT_V2
  14. namespace lol
  15. {
  16. /** Internal class (not public) that allows to construct an InputDevice dynamically, when the keys, axis and cursors are not known at compile time */
  17. class InputDeviceInternal : InputDevice
  18. {
  19. public:
  20. InputDeviceInternal(const char* name) : InputDevice(name) { }
  21. void AddKey(const char* name);
  22. void AddAxis(const char* name, float sensitivity = 1.0f);
  23. void AddCursor(const char* name);
  24. void SetKey(int index, bool state) { m_keys[index] = state; }
  25. void SetAxis(int index, float value) { m_axis[index].m1 = value; }
  26. void SetCursor(int index, const vec2& position, const ivec2& pixel) { m_cursors[index].m1 = position; m_cursors[index].m2 = pixel; }
  27. static bool GetMouseCapture() { return m_capturemouse; }
  28. static InputDeviceInternal* CreateStandardKeyboard();
  29. static InputDeviceInternal* CreateStandardMouse();
  30. };
  31. } /* namespace lol */
  32. #endif // LOL_INPUT_V2
  33. #endif // __LOL_INPUT_DEVICE_INTERNAL_H__