CapsAdmin

Untitled

Sep 13th, 2012
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. LUAMTA_FUNCTION(texture, SetData)
  2. {
  3.     auto self = my->ToTexture(1);
  4.  
  5.     auto buffer = (unsigned char *)my->ToString(2);
  6.     auto rect = my->ToRect(3, Rect(0, 0, self->GetWidth(), self->GetHeight()));
  7.  
  8.     if (buffer[2])
  9.     {
  10.         gEnv->pRenderer->UpdateTextureInVideoMemory(
  11.             self->GetTextureID(),
  12.             buffer,
  13.             rect.x,
  14.             rect.y,
  15.             rect.w,
  16.             rect.h,
  17.             my->ToEnum<ETEX_Format>(4, eTF_A8R8G8B8)
  18.         );
  19.        
  20.         my->Push(true);
  21.  
  22.         return 1;
  23.     }
  24.  
  25.     return 0;
  26. }
  27.  
  28. LUAMTA_FUNCTION(texture, GeteData)
  29. {
  30.     auto self = my->ToTexture(1);
  31.  
  32.     my->Push((const char *)self->GetSystemCopy());
  33.  
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment