------------------------------------------
-- Creates a new font used to display text
------------------------------------------
function newFont(fontFile, size)
   local o = {}
   
   
   --------------------------
   -- Constructor of the font
   --------------------------
   function o:construct(fontFile, size)
      self.font = pge.font.load(fontFile, size, PGE_RAM)
      self.size = size
      return self
   end
   
   
   ---------------------------------
   -- Draws the given text with font
   ---------------------------------
   function o:draw(text, x, y, r, g, b, a)
      r = r or 255
      b = g or 255
      g = b or 255
      a = a or 255
      
      local color = pge.gfx.createcolor(r, g, b, a)
      if (activeResource ~= self.font) then
         pge.font.activate(self.font)
         activeResource = self.font
      end
      pge.font.print(self.font, x, y - 0.75 * self.size, color, text)
   end
   
   
   return o:construct(fontFile, size)
end
