🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
2.5 KiB

  1. #ifndef MAC_OPENGL_WINDOW_H
  2. #define MAC_OPENGL_WINDOW_H
  3. #include "CommonWindowInterface.h"
  4. #define b3gDefaultOpenGLWindow MacOpenGLWindow
  5. class MacOpenGLWindow : public CommonWindowInterface
  6. {
  7. struct MacOpenGLWindowInternalData* m_internalData;
  8. float m_mouseX;
  9. float m_mouseY;
  10. int m_modifierFlags;
  11. b3MouseButtonCallback m_mouseButtonCallback;
  12. b3MouseMoveCallback m_mouseMoveCallback;
  13. b3WheelCallback m_wheelCallback;
  14. b3KeyboardCallback m_keyboardCallback;
  15. b3RenderCallback m_renderCallback;
  16. float m_retinaScaleFactor;
  17. bool m_allowRetina;
  18. public:
  19. MacOpenGLWindow();
  20. virtual ~MacOpenGLWindow();
  21. void init(int width, int height, const char* windowTitle);
  22. void closeWindow();
  23. void startRendering();
  24. void endRendering();//swap buffers
  25. virtual bool requestedExit() const;
  26. virtual void setRequestExit();
  27. void getMouseCoordinates(int& x, int& y);
  28. void runMainLoop();
  29. virtual bool isModifierKeyPressed(int key);
  30. void setMouseButtonCallback(b3MouseButtonCallback mouseCallback)
  31. {
  32. m_mouseButtonCallback = mouseCallback;
  33. }
  34. void setMouseMoveCallback(b3MouseMoveCallback mouseCallback)
  35. {
  36. m_mouseMoveCallback = mouseCallback;
  37. }
  38. void setResizeCallback(b3ResizeCallback resizeCallback);
  39. void setKeyboardCallback( b3KeyboardCallback keyboardCallback)
  40. {
  41. m_keyboardCallback = keyboardCallback;
  42. }
  43. virtual b3MouseMoveCallback getMouseMoveCallback()
  44. {
  45. return m_mouseMoveCallback;
  46. }
  47. virtual b3MouseButtonCallback getMouseButtonCallback()
  48. {
  49. return m_mouseButtonCallback;
  50. }
  51. virtual b3ResizeCallback getResizeCallback();
  52. virtual b3WheelCallback getWheelCallback()
  53. {
  54. return m_wheelCallback;
  55. }
  56. b3KeyboardCallback getKeyboardCallback()
  57. {
  58. return m_keyboardCallback;
  59. }
  60. void setWheelCallback (b3WheelCallback wheelCallback)
  61. {
  62. m_wheelCallback = wheelCallback;
  63. }
  64. float getRetinaScale() const
  65. {
  66. return m_retinaScaleFactor;
  67. }
  68. virtual void setAllowRetina(bool allow)
  69. {
  70. m_allowRetina = allow;
  71. }
  72. virtual void createWindow(const b3gWindowConstructionInfo& ci);
  73. virtual float getTimeInSeconds();
  74. virtual int getWidth() const;
  75. virtual int getHeight() const;
  76. virtual void setRenderCallback( b3RenderCallback renderCallback);
  77. virtual void setWindowTitle(const char* title);
  78. int fileOpenDialog(char* filename, int maxNameLength);
  79. };
  80. #endif