Texture2D.pkg 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. $#include "Texture2D.h"
  2. enum TextureUsage{};
  3. class Texture2D : public Texture
  4. {
  5. Texture2D();
  6. ~Texture2D();
  7. bool SetSize(int width, int height, unsigned format, TextureUsage usage = TEXTURE_STATIC);
  8. // bool SetData(SharedPtr<Image> image, bool useAlpha = false);
  9. tolua_outside bool Texture2DSetData @ SetData(Image* image, bool useAlpha = false);
  10. RenderSurface* GetRenderSurface() const;
  11. tolua_readonly tolua_property__get_set RenderSurface* renderSurface;
  12. };
  13. ${
  14. #define TOLUA_DISABLE_tolua_GraphicsLuaAPI_Texture2D_new00
  15. static int tolua_GraphicsLuaAPI_Texture2D_new00(lua_State* tolua_S)
  16. {
  17. return ToluaNewObject<Texture2D>(tolua_S);
  18. }
  19. #define TOLUA_DISABLE_tolua_GraphicsLuaAPI_Texture2D_new00_local
  20. static int tolua_GraphicsLuaAPI_Texture2D_new00_local(lua_State* tolua_S)
  21. {
  22. return ToluaNewObjectGC<Texture2D>(tolua_S);
  23. }
  24. static bool Texture2DSetData(Texture2D* texture, Image* image, bool useAlpha)
  25. {
  26. SharedPtr<Image> imagePtr(image);
  27. bool ret = texture->SetData(imagePtr, useAlpha);
  28. // Need to safely detach the object from the shared pointer so that the Lua script can manually
  29. // delete the object once done
  30. imagePtr.Detach();
  31. return ret;
  32. }
  33. $}