Graphics.pkg 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. $#include "IO/File.h"
  2. $#include "Graphics/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 highDPI, bool vsync, bool tripleBuffer, int multiSample, int monitor, int refreshRate);
  10. bool SetMode(int width, int height);
  11. void SetSRGB(bool enable);
  12. void SetDither(bool enable);
  13. void SetFlushGPU(bool enable);
  14. void SetOrientations(const String orientations);
  15. bool ToggleFullscreen();
  16. void Maximize();
  17. void Minimize();
  18. void Close();
  19. bool TakeScreenShot(Image& destImage);
  20. void BeginDumpShaders(const String fileName);
  21. void EndDumpShaders();
  22. void PrecacheShaders(Deserializer& source);
  23. tolua_outside void GraphicsPrecacheShaders @ PrecacheShaders(const String fileName);
  24. void SetShaderCacheDir(const String path);
  25. bool IsInitialized() const;
  26. void* GetExternalWindow() const;
  27. const String GetWindowTitle() const;
  28. const String GetApiName() const;
  29. IntVector2 GetWindowPosition() const;
  30. int GetWidth() const;
  31. int GetHeight() const;
  32. int GetMultiSample() const;
  33. IntVector2 GetSize() const;
  34. bool GetFullscreen() const;
  35. bool GetResizable() const;
  36. bool GetBorderless() const;
  37. bool GetVSync() const;
  38. int GetMonitor() const;
  39. int GetRefreshRate() const;
  40. bool GetTripleBuffer() const;
  41. bool GetSRGB() const;
  42. bool GetDither() const;
  43. bool GetFlushGPU() const;
  44. const String GetOrientations() const;
  45. bool IsDeviceLost() const;
  46. unsigned GetNumPrimitives() const;
  47. unsigned GetNumBatches() const;
  48. unsigned GetDummyColorFormat() const;
  49. unsigned GetShadowMapFormat() const;
  50. unsigned GetHiresShadowMapFormat() const;
  51. bool GetInstancingSupport() const;
  52. bool GetLightPrepassSupport() const;
  53. bool GetDeferredSupport() const;
  54. bool GetHardwareShadowSupport() const;
  55. bool GetReadableDepthSupport() const;
  56. bool GetSRGBSupport() const;
  57. bool GetSRGBWriteSupport() const;
  58. IntVector2 GetDesktopResolution(int monitor) const;
  59. int GetMonitorCount() const;
  60. const String GetShaderCacheDir() const;
  61. static unsigned GetAlphaFormat();
  62. static unsigned GetLuminanceFormat();
  63. static unsigned GetLuminanceAlphaFormat();
  64. static unsigned GetRGBFormat();
  65. static unsigned GetRGBAFormat();
  66. static unsigned GetRGBA16Format();
  67. static unsigned GetRGBAFloat16Format();
  68. static unsigned GetRGBAFloat32Format();
  69. static unsigned GetRG16Format();
  70. static unsigned GetRGFloat16Format();
  71. static unsigned GetRGFloat32Format();
  72. static unsigned GetFloat16Format();
  73. static unsigned GetFloat32Format();
  74. static unsigned GetLinearDepthFormat();
  75. static unsigned GetDepthStencilFormat();
  76. static unsigned GetReadableDepthFormat();
  77. static unsigned GetFormat(const String formatName);
  78. static unsigned GetMaxBones();
  79. tolua_readonly tolua_property__is_set bool initialized;
  80. tolua_property__get_set String windowTitle;
  81. tolua_readonly tolua_property__get_set String apiName;
  82. tolua_property__get_set IntVector2 windowPosition;
  83. tolua_readonly tolua_property__get_set int width;
  84. tolua_readonly tolua_property__get_set int height;
  85. tolua_readonly tolua_property__get_set int multiSample;
  86. tolua_readonly tolua_property__get_set IntVector2 size;
  87. tolua_readonly tolua_property__get_set bool fullscreen;
  88. tolua_readonly tolua_property__get_set bool resizable;
  89. tolua_readonly tolua_property__get_set bool borderless;
  90. tolua_readonly tolua_property__get_set bool vSync;
  91. tolua_readonly tolua_property__get_set int refreshRate;
  92. tolua_readonly tolua_property__get_set int monitor;
  93. tolua_readonly tolua_property__get_set bool tripleBuffer;
  94. tolua_property__get_set bool sRGB;
  95. tolua_property__get_set bool dither;
  96. tolua_property__get_set bool flushGPU;
  97. tolua_property__get_set String orientations;
  98. tolua_readonly tolua_property__is_set bool deviceLost;
  99. tolua_readonly tolua_property__get_set unsigned numPrimitives;
  100. tolua_readonly tolua_property__get_set unsigned numBatches;
  101. tolua_readonly tolua_property__get_set unsigned dummyColorFormat;
  102. tolua_readonly tolua_property__get_set unsigned shadowMapFormat;
  103. tolua_readonly tolua_property__get_set unsigned hiresShadowMapFormat;
  104. tolua_readonly tolua_property__get_set bool instancingSupport;
  105. tolua_readonly tolua_property__get_set bool lightPrepassSupport;
  106. tolua_readonly tolua_property__get_set bool deferredSupport;
  107. tolua_readonly tolua_property__get_set bool hardwareShadowSupport;
  108. tolua_readonly tolua_property__get_set bool readableDepthSupport;
  109. tolua_readonly tolua_property__get_set bool sRGBSupport;
  110. tolua_readonly tolua_property__get_set bool sRGBWriteSupport;
  111. tolua_readonly tolua_property__get_set int monitorCount;
  112. tolua_property__get_set String shaderCacheDir;
  113. };
  114. Graphics* GetGraphics();
  115. tolua_readonly tolua_property__get_set Graphics* graphics;
  116. ${
  117. static void GraphicsPrecacheShaders(Graphics* graphics, const String& fileName)
  118. {
  119. if (!graphics)
  120. return;
  121. File file(graphics->GetContext());
  122. if (file.Open(fileName, FILE_READ))
  123. graphics->PrecacheShaders(file);
  124. }
  125. #define TOLUA_DISABLE_tolua_GraphicsLuaAPI_GetGraphics00
  126. static int tolua_GraphicsLuaAPI_GetGraphics00(lua_State* tolua_S)
  127. {
  128. return ToluaGetSubsystem<Graphics>(tolua_S);
  129. }
  130. #define TOLUA_DISABLE_tolua_get_graphics_ptr
  131. #define tolua_get_graphics_ptr tolua_GraphicsLuaAPI_GetGraphics00
  132. $}