text: #include "pearlpch.h"
  #include "Texture.h"
  #include "Pearl/Core/Core.h"
  
  namespace Pearl
  {
  	Texture::Texture()
  	{
  		image = NULL;
  		width = 0;
  		height = 0;
  	}
  
  	Texture::~Texture()
  	{
  		Dispose();
  	}
  
  	void Texture::Render(Vec2 position, SDL_Rect* clip, double angle, SDL_FPoint* center, SDL_RendererFlip flip)
  	{
  		// Check if we changed color since last frame
  		if (colorDelta.r != color.r || colorDelta.g != color.g || colorDelta.b != color.b)
  			SDL_SetTextureColorMod(image, color.r, color.g, color.b);
  
  		// Check if alpha changed
  		if (alphaDelta != alpha)
  			SDL_SetTextureAlphaMod(image, alpha);
  
  		// Quad we will render to
  		SDL_FRect renderQuad = { position.x, position.y, (float) width, (float) height };
  
  		// Set the renderQuad width and height from clip rect
  		if (clip != NULL)
  		{
  			renderQuad.w = (float) clip->w;
  			renderQuad.h = (float) clip->h;
  		}
  
  		// Set previous values
  		colorDelta = color;
  		alphaDelta = alpha;
  
  		// Render the image
  		SDL_RenderCopyExF(PL_RENDERER, image, clip, &renderQuad, angle, center, flip);
  	}
  
  	void Texture::Dispose()
  	{
  		if (image != NULL)
  		{
  			SDL_DestroyTexture(image);
  			image = NULL;
  			width = 0;
  			height = 0;
  		}
  	}
  }