Graphics.pkg 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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 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. const String GetApiName() const;
  27. IntVector2 GetWindowPosition() const;
  28. int GetWidth() const;
  29. int GetHeight() const;
  30. int GetMultiSample() const;
  31. bool GetFullscreen() const;
  32. bool GetResizable() const;
  33. bool GetBorderless() const;
  34. bool GetVSync() const;
  35. bool GetTripleBuffer() const;
  36. bool GetSRGB() const;
  37. bool GetFlushGPU() const;
  38. const String GetOrientations() const;
  39. bool IsDeviceLost() const;
  40. unsigned GetNumPrimitives() const;
  41. unsigned GetNumBatches() const;
  42. unsigned GetDummyColorFormat() const;
  43. unsigned GetShadowMapFormat() const;
  44. unsigned GetHiresShadowMapFormat() const;
  45. bool GetInstancingSupport() const;
  46. bool GetLightPrepassSupport() const;
  47. bool GetDeferredSupport() const;
  48. bool GetHardwareShadowSupport() const;
  49. bool GetReadableDepthSupport() const;
  50. bool GetSRGBSupport() const;
  51. bool GetSRGBWriteSupport() const;
  52. IntVector2 GetDesktopResolution() const;
  53. static unsigned GetAlphaFormat();
  54. static unsigned GetLuminanceFormat();
  55. static unsigned GetLuminanceAlphaFormat();
  56. static unsigned GetRGBFormat();
  57. static unsigned GetRGBAFormat();
  58. static unsigned GetRGBA16Format();
  59. static unsigned GetRGBAFloat16Format();
  60. static unsigned GetRGBAFloat32Format();
  61. static unsigned GetRG16Format();
  62. static unsigned GetRGFloat16Format();
  63. static unsigned GetRGFloat32Format();
  64. static unsigned GetFloat16Format();
  65. static unsigned GetFloat32Format();
  66. static unsigned GetLinearDepthFormat();
  67. static unsigned GetDepthStencilFormat();
  68. static unsigned GetReadableDepthFormat();
  69. static unsigned GetFormat(const String formatName);
  70. static unsigned GetMaxBones();
  71. tolua_readonly tolua_property__is_set bool initialized;
  72. tolua_property__get_set String windowTitle;
  73. tolua_readonly tolua_property__get_set String apiName;
  74. tolua_property__get_set IntVector2 windowPosition;
  75. tolua_readonly tolua_property__get_set int width;
  76. tolua_readonly tolua_property__get_set int height;
  77. tolua_readonly tolua_property__get_set int multiSample;
  78. tolua_readonly tolua_property__get_set bool fullscreen;
  79. tolua_readonly tolua_property__get_set bool resizable;
  80. tolua_readonly tolua_property__get_set bool borderless;
  81. tolua_readonly tolua_property__get_set bool vSync;
  82. tolua_readonly tolua_property__get_set bool tripleBuffer;
  83. tolua_property__get_set bool sRGB;
  84. tolua_property__get_set bool flushGPU;
  85. tolua_property__get_set String orientations;
  86. tolua_readonly tolua_property__is_set bool deviceLost;
  87. tolua_readonly tolua_property__get_set unsigned numPrimitives;
  88. tolua_readonly tolua_property__get_set unsigned numBatches;
  89. tolua_readonly tolua_property__get_set unsigned dummyColorFormat;
  90. tolua_readonly tolua_property__get_set unsigned shadowMapFormat;
  91. tolua_readonly tolua_property__get_set unsigned hiresShadowMapFormat;
  92. tolua_readonly tolua_property__get_set bool instancingSupport;
  93. tolua_readonly tolua_property__get_set bool lightPrepassSupport;
  94. tolua_readonly tolua_property__get_set bool deferredSupport;
  95. tolua_readonly tolua_property__get_set bool hardwareShadowSupport;
  96. tolua_readonly tolua_property__get_set bool readableDepthSupport;
  97. tolua_readonly tolua_property__get_set bool sRGBSupport;
  98. tolua_readonly tolua_property__get_set bool sRGBWriteSupport;
  99. tolua_readonly tolua_property__get_set IntVector2 desktopResolution;
  100. };
  101. Graphics* GetGraphics();
  102. tolua_readonly tolua_property__get_set Graphics* graphics;
  103. ${
  104. static void GraphicsPrecacheShaders(Graphics* graphics, const String& fileName)
  105. {
  106. if (!graphics)
  107. return;
  108. File file(graphics->GetContext());
  109. if (file.Open(fileName, FILE_READ))
  110. graphics->PrecacheShaders(file);
  111. }
  112. #define TOLUA_DISABLE_tolua_GraphicsLuaAPI_GetGraphics00
  113. static int tolua_GraphicsLuaAPI_GetGraphics00(lua_State* tolua_S)
  114. {
  115. return ToluaGetSubsystem<Graphics>(tolua_S);
  116. }
  117. #define TOLUA_DISABLE_tolua_get_graphics_ptr
  118. #define tolua_get_graphics_ptr tolua_GraphicsLuaAPI_GetGraphics00
  119. $}