Graphics.pkg 4.3 KB

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