text: #include "Renderer.h"
  
  Renderer::Renderer()
  {
  	lineData.reserve(2 * maxLines);
  	squareData.reserve(4 * maxSquares);
  
  	lineBuffer.SetData(nullptr, 2 * maxLines, sizeof(Vertex));
  	squareBuffer.SetData(nullptr, 4 * maxSquares, sizeof(Vertex));
  }
  
  Renderer::~Renderer()
  {
  
  }
  
  void Renderer::AddLine(float x1, float y1, float x2, float y2)
  {
  	lineData.emplace_back(x1, y1, 0, 1, 0, 0);
  	lineData.emplace_back(x2, y2, 0, 1, 0, 0);
  }
  
  void Renderer::AddSquare(float x, float y, float diameter)
  {
  	float r = diameter / 2;
  	squareData.emplace_back(x - r / 2, y - r / 2, 0, 1, 0, 0);
  	squareData.emplace_back(x - r / 2, y + r / 2, 0, 1, 0, 0);
  	squareData.emplace_back(x + r / 2, y + r / 2, 0, 1, 0, 0);
  
  	squareData.emplace_back(x + r / 2, y + r / 2, 0, 1, 0, 0);
  	squareData.emplace_back(x + r / 2, y - r / 2, 0, 1, 0, 0);
  	squareData.emplace_back(x - r / 2, y - r / 2, 0, 1, 0, 0);
  }
  
  void Renderer::Draw()
  {
  	GraphicsDevice::context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINELIST);
  	lineBuffer.SetData(lineData.data(), lineData.size(), sizeof(Vertex));
  	lineBuffer.Bind();
  	GraphicsDevice::context->Draw(lineData.size(), 0);
  	GraphicsDevice::context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
  
  	squareBuffer.SetData(squareData.data(), squareData.size(), sizeof(Vertex));
  	squareBuffer.Bind();
  	GraphicsDevice::context->Draw(squareData.size(), 0);
  
  	lineData.clear();
  	squareData.clear();
  }