PolyAGLCore.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * PolyAGLCore.h
  3. * TAU
  4. *
  5. * Created by Ivan Safrin on 3/12/08.
  6. * Copyright 2008 __MyCompanyName__. All rights reserved.
  7. *
  8. */
  9. // @package Core
  10. #pragma once
  11. #include "PolyGlobals.h"
  12. #include "PolyCore.h"
  13. #include "PolyRectangle.h"
  14. #include <vector>
  15. #include <OpenGL/gl.h>
  16. #include <OpenGL/OpenGL.h>
  17. #include "PolyGLRenderer.h"
  18. #include <AGL/agl.h>
  19. #include <AGL/aglRenderers.h>
  20. #include <mach/mach_time.h>
  21. using std::vector;
  22. namespace Polycode {
  23. class _PolyExport PosixMutex : public CoreMutex {
  24. public:
  25. pthread_mutex_t pMutex;
  26. };
  27. class OSXEvent {
  28. public:
  29. int eventGroup;
  30. int eventCode;
  31. int mouseX;
  32. int mouseY;
  33. TAUKey keyCode;
  34. wchar_t unicodeChar;
  35. char mouseButton;
  36. static const int INPUT_EVENT = 0;
  37. };
  38. class _PolyExport AGLCore : public Core {
  39. public:
  40. AGLCore(WindowRef window, Polycode::Rectangle *clippingArea, int xRes, int yRes, bool fullScreen, int aaLevel, int frameRate);
  41. virtual ~AGLCore();
  42. void enableMouse(bool newval);
  43. unsigned int getTicks();
  44. bool Update();
  45. void setVideoMode(int xRes, int yRes, bool fullScreen, int aaLevel);
  46. void createThread(Threaded *target);
  47. static pascal OSStatus coreEventHandler (EventHandlerCallRef next, EventRef event, void *data);
  48. void lockMutex(CoreMutex *mutex);
  49. void unlockMutex(CoreMutex *mutex);
  50. CoreMutex *createMutex();
  51. void checkEvents();
  52. vector<Rectangle> getVideoModes();
  53. int lastMouseY;
  54. int lastMouseX;
  55. CoreMutex *eventMutex;
  56. vector<OSXEvent> osxEvents;
  57. private:
  58. uint64_t initTime;
  59. WindowRef mainWindow;
  60. AGLContext aglContext;
  61. };
  62. }