dd_mouse.h 953 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef DD_MOUSE_H
  2. #define DD_MOUSE_H
  3. enum DD_INPUT_MOUSE_BUTTON {
  4. DD_INPUT_MOUSE_BUTTON_LEFT,
  5. DD_INPUT_MOUSE_BUTTON_MIDDLE,
  6. DD_INPUT_MOUSE_BUTTON_RIGHT,
  7. };
  8. enum DD_INPUT_MOUSE_TYPE {
  9. DD_INPUT_MOUSE_TYPE_PRESSED,
  10. DD_INPUT_MOUSE_TYPE_RELEASED,
  11. };
  12. /* mouse
  13. *
  14. * `dd_mouse_?` functions return the exact pixel the mouse is on
  15. * `dd_mouse_?Proportion` functions return the position
  16. * of the mouse, compared to the window width
  17. * and ranges from 0 to 1.
  18. */
  19. int dd_mouse_x();
  20. int dd_mouse_y();
  21. float dd_mouse_xProportion();
  22. float dd_mouse_yProportion();
  23. #if DD_PLATFORM_ANDROID
  24. #define DD_MOUSE_SHAPE_INHERIT 0
  25. #define DD_MOUSE_SHAPE_NONE 0
  26. #define dd_mouse_shape(shape)
  27. #define dd_mouse_position(x, y)
  28. #elif DD_PLATFORM_NATIVE
  29. #define DD_MOUSE_SHAPE_INHERIT GLUT_CURSOR_INHERIT
  30. #define DD_MOUSE_SHAPE_NONE GLUT_CURSOR_NONE
  31. #define dd_mouse_shape(shape) glutSetCursor(shape)
  32. #define dd_mouse_position(x, y) glutWarpPointer(x, y)
  33. #endif
  34. #endif