PolyCoreInput.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * PolyCoreInput.h
  3. * Poly
  4. *
  5. * Created by Ivan Safrin on 3/27/08.
  6. * Copyright 2008 __MyCompanyName__. All rights reserved.
  7. *
  8. */
  9. // @package Core
  10. #pragma once
  11. #include "PolyString.h"
  12. #include "PolyLogger.h"
  13. #include "PolyGlobals.h"
  14. #include "PolyVector2.h"
  15. #include "PolyEventDispatcher.h"
  16. #include "PolyInputEvent.h"
  17. #include "PolyInputKeys.h"
  18. namespace Polycode {
  19. class _PolyExport CoreInput : public EventDispatcher {
  20. friend class PolyCore;
  21. public:
  22. CoreInput();
  23. ~CoreInput();
  24. static const int MOUSE_BUTTON1 = 0;
  25. static const int MOUSE_BUTTON2 = 1;
  26. static const int MOUSE_BUTTON3 = 2;
  27. void mouseWheelUp(int ticks);
  28. void mouseWheelDown(int ticks);
  29. bool getMouseButtonState(int mouseButton);
  30. void setMouseButtonState(int mouseButton, bool state, int ticks);
  31. void setMousePosition(int x, int y, int ticks);
  32. Vector2 getMousePosition();
  33. void setKeyState(TAUKey keyCode, wchar_t code, bool newState, int ticks);
  34. bool getKeyState(TAUKey keyCode);
  35. Vector2 getMouseDelta();
  36. void setDeltaPosition(int x, int y);
  37. static InputEvent *createEvent(Event *event){ return (InputEvent*)event; }
  38. protected:
  39. bool keyboardState[512];
  40. bool mouseButtons[3];
  41. Vector2 mousePosition;
  42. Vector2 deltaMousePosition;
  43. };
  44. }