PolyCoreInput.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 "PolyLogger.h"
  12. #include "PolyGlobals.h"
  13. #include "PolyVector2.h"
  14. #include "PolyEventDispatcher.h"
  15. #include "PolyInputEvent.h"
  16. #include "PolyInputKeys.h"
  17. namespace Polycode {
  18. class _PolyExport CoreInput : public EventDispatcher {
  19. friend class PolyCore;
  20. public:
  21. CoreInput();
  22. ~CoreInput();
  23. static const int MOUSE_BUTTON1 = 0;
  24. static const int MOUSE_BUTTON2 = 1;
  25. static const int MOUSE_BUTTON3 = 2;
  26. void mouseWheelUp(int ticks);
  27. void mouseWheelDown(int ticks);
  28. bool getMouseButtonState(int mouseButton);
  29. void setMouseButtonState(int mouseButton, bool state, int ticks);
  30. void setMousePosition(int x, int y, int ticks);
  31. Vector2 getMousePosition();
  32. void setKeyState(TAUKey keyCode, wchar_t code, bool newState, int ticks);
  33. bool getKeyState(TAUKey keyCode);
  34. Vector2 getMouseDelta();
  35. void setDeltaPosition(int x, int y);
  36. static InputEvent *createEvent(Event *event){ return (InputEvent*)event; }
  37. protected:
  38. bool keyboardState[512];
  39. bool mouseButtons[3];
  40. Vector2 mousePosition;
  41. Vector2 deltaMousePosition;
  42. };
  43. }