#include "empire.h"

int mouse_type;

void draw_mouse();
int mouse_clicked();
int mouse_rclicked();

int mouse_clicked()
{
  static int mousedown = 0;
  if (mouse_b & 1)
  {
    mousedown = 1;
  }
  else
  {
    if (mousedown == 1)
    {
      mousedown = 0;
      return 1;
    }
  }
  return 0;
}

int mouse_rclicked()
{
  static int mousedown = 0;
  if (mouse_b & 2)
  {
    mousedown = 1;
  }
  else
  {
    if (mousedown == 1)
    {
      mousedown = 0;
      return 1;
    }
  }
  return 0;
}

void draw_mouse()
{
  static float frame = 0;
  switch(mouse_type)
  {
    case MOUSE_NORMAL:
      frame += 0.2;
      if (frame >= 4)
      {
        frame = 0;
      }
      mouse.draw(int(frame), mouse_x, mouse_y, 0.7);
      break;
    case MOUSE_TARGET:
      mouse.draw(4, mouse_x, mouse_y, 0.7);
      break;
  }
}
