dd_mouse.h 980 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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_MOVE,
  11. DD_INPUT_MOUSE_TYPE_RELEASED,
  12. };
  13. /* mouse
  14. *
  15. * `dd_mouse_?` functions return the exact pixel the mouse is on
  16. * `dd_mouse_?Proportion` functions return the position
  17. * of the mouse, compared to the window width
  18. * and ranges from 0 to 1.
  19. */
  20. int dd_mouse_x();
  21. int dd_mouse_y();
  22. float dd_mouse_xProportion();
  23. float dd_mouse_yProportion();
  24. #if DD_PLATFORM_ANDROID
  25. #define DD_MOUSE_SHAPE_INHERIT 0
  26. #define DD_MOUSE_SHAPE_NONE 0
  27. #define dd_mouse_shape(shape)
  28. #define dd_mouse_position(x, y)
  29. #elif DD_PLATFORM_NATIVE
  30. #define DD_MOUSE_SHAPE_INHERIT GLUT_CURSOR_INHERIT
  31. #define DD_MOUSE_SHAPE_NONE GLUT_CURSOR_NONE
  32. #define dd_mouse_shape(shape) glutSetCursor(shape)
  33. #define dd_mouse_position(x, y) glutWarpPointer(x, y)
  34. #endif
  35. #endif