Graphics.pkg 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. $#include "File.h"
  2. $#include "Graphics.h"
  3. class Graphics : public Object
  4. {
  5. void SetWindowTitle(const String windowTitle);
  6. void SetWindowIcon(Image* windowIcon);
  7. void SetWindowPosition(const IntVector2& position);
  8. void SetWindowPosition(int x, int y);
  9. bool SetMode(int width, int height, bool fullscreen, bool borderless, bool resizable, bool vsync, bool tripleBuffer, int multiSample);
  10. bool SetMode(int width, int height);
  11. void SetSRGB(bool enable);
  12. void SetFlushGPU(bool enable);
  13. void SetOrientations(const String orientations);
  14. bool ToggleFullscreen();
  15. void Maximize();
  16. void Minimize();
  17. void Close();
  18. bool TakeScreenShot(Image& destImage);
  19. void BeginDumpShaders(const String fileName);
  20. void EndDumpShaders();
  21. void PrecacheShaders(Deserializer& source);
  22. tolua_outside void GraphicsPrecacheShaders @ PrecacheShaders(const String fileName);
  23. bool IsInitialized() const;
  24. void* GetExternalWindow() const;
  25. const String GetWindowTitle() const;
  26. IntVector2 GetWindowPosition() const;
  27. int GetWidth() const;
  28. int GetHeight() const;
  29. int GetMultiSample() const;
  30. bool GetFullscreen() const;
  31. bool GetResizable() const;
  32. bool GetBorderless() const;
  33. bool GetVSync() const;
  34. bool GetTripleBuffer() const;
  35. bool GetSRGB() const;
  36. bool GetFlushGPU() const;
  37. const String GetOrientations() const;
  38. bool IsDeviceLost() const;
  39. unsigned GetNumPrimitives() const;
  40. unsigned GetNumBatches() const;
  41. unsigned GetDummyColorFormat() const;
  42. unsigned GetShadowMapFormat() const;
  43. unsigned GetHiresShadowMapFormat() const;
  44. bool GetSM3Support() const;
  45. bool GetInstancingSupport() const;
  46. bool GetLightPrepassSupport() const;
  47. bool GetDeferredSupport() const;
  48. bool GetHardwareShadowSupport() const;
  49. bool GetStreamOffsetSupport() const;
  50. bool GetSRGBSupport() const;
  51. bool GetSRGBWriteSupport() const;
  52. IntVector2 GetDesktopResolution() const;
  53. static unsigned GetRGBFormat();
  54. tolua_readonly tolua_property__is_set bool initialized;
  55. tolua_property__get_set String windowTitle;
  56. tolua_property__get_set IntVector2 windowPosition;
  57. tolua_readonly tolua_property__get_set int width;
  58. tolua_readonly tolua_property__get_set int height;
  59. tolua_readonly tolua_property__get_set int multiSample;
  60. tolua_readonly tolua_property__get_set bool fullscreen;
  61. tolua_readonly tolua_property__get_set bool resizable;
  62. tolua_readonly tolua_property__get_set bool borderless;
  63. tolua_readonly tolua_property__get_set bool vSync;
  64. tolua_readonly tolua_property__get_set bool tripleBuffer;
  65. tolua_property__get_set bool sRGB;
  66. tolua_property__get_set bool flushGPU;
  67. tolua_property__get_set String orientations;
  68. tolua_readonly tolua_property__is_set bool deviceLost;
  69. tolua_readonly tolua_property__get_set unsigned numPrimitives;
  70. tolua_readonly tolua_property__get_set unsigned numBatches;
  71. tolua_readonly tolua_property__get_set unsigned dummyColorFormat;
  72. tolua_readonly tolua_property__get_set unsigned shadowMapFormat;
  73. tolua_readonly tolua_property__get_set unsigned hiresShadowMapFormat;
  74. tolua_readonly tolua_property__get_set bool SM3Support;
  75. tolua_readonly tolua_property__get_set bool instancingSupport;
  76. tolua_readonly tolua_property__get_set bool lightPrepassSupport;
  77. tolua_readonly tolua_property__get_set bool deferredSupport;
  78. tolua_readonly tolua_property__get_set bool hardwareShadowSupport;
  79. tolua_readonly tolua_property__get_set bool streamOffsetSupport;
  80. tolua_readonly tolua_property__get_set bool sRGBSupport;
  81. tolua_readonly tolua_property__get_set bool sRGBWriteSupport;
  82. tolua_readonly tolua_property__get_set IntVector2 desktopResolution;
  83. };
  84. Graphics* GetGraphics();
  85. tolua_readonly tolua_property__get_set Graphics* graphics;
  86. ${
  87. static void GraphicsPrecacheShaders(Graphics* graphics, const String& fileName)
  88. {
  89. if (!graphics)
  90. return;
  91. File file(graphics->GetContext());
  92. if (file.Open(fileName, FILE_READ))
  93. graphics->PrecacheShaders(file);
  94. }
  95. #define TOLUA_DISABLE_tolua_GraphicsLuaAPI_GetGraphics00
  96. static int tolua_GraphicsLuaAPI_GetGraphics00(lua_State* tolua_S)
  97. {
  98. return ToluaGetSubsystem<Graphics>(tolua_S);
  99. }
  100. #define TOLUA_DISABLE_tolua_get_graphics_ptr
  101. #define tolua_get_graphics_ptr tolua_GraphicsLuaAPI_GetGraphics00
  102. $}