#include "pvr.h"

// todo ewww....
extern PVR::cRenderMgr *g_pvrRenderer;

PVR::cGuiChar::cGuiChar(uint16_t usCharacterId, int16_t sX, int16_t sY, int16_t sW, int16_t sH, PVR::cTexture *pTexture)
{
   m_sWidth = sW;
   m_sHeight = sH;
   m_usCharacterId = usCharacterId;
   m_pTexture = pTexture;
   m_sX = sX;
   m_sY = sY;
};

PVR::cGuiChar::~cGuiChar(){
    // todo don't delete textire
};

void PVR::cGuiChar::Print(int16_t offsetX, int16_t offsetY)
{
   // todo: DOn't like gloab
   //if (mode == cRenderMgr::Batched)
   if (g_pvrRenderer->m_szDrawMode == cRenderMgr::Batched)
   {    
         g_pvrRenderer->DrawQuadDeferred(
          m_pTexture,
          m_sX + offsetX,
          m_sY + offsetY,
          m_sWidth,
          m_sHeight,
          cRenderMgr::LayerAlpha1, // todo magic number
          1.0f,
          m_ulColour);
   }
   else
   {        
      // todo: colour;
      g_pvrRenderer->DrawQuadDirect(
          m_pTexture,
          m_sX + offsetX,
          m_sY + offsetY,
          m_sWidth,
          m_sHeight,
          45 + m_cLayerOffset, // todo magic number
          1.0f,
          m_ulColour);
   }
};