#include "SystemDisplay.h"

SystemDisplay::SystemDisplay(const u8g2_cb_t *rotation, uint8_t reset, uint8_t clock, uint8_t data)
    : DEFAULT_CLASS(rotation, reset, clock, data)
{
}

SystemDisplay::~SystemDisplay()
{
}

void SystemDisplay::close()
{
  clearBuffer();
  drawFilledEllipse(32, 19, 20, 20, U8G2_DRAW_LOWER_RIGHT|U8G2_DRAW_LOWER_LEFT);
  drawFilledEllipse(32+64, 19, 20, 20, U8G2_DRAW_LOWER_RIGHT|U8G2_DRAW_LOWER_LEFT);
  setDrawColor(0);
  drawFilledEllipse(32, 19, 20, 12, U8G2_DRAW_LOWER_RIGHT|U8G2_DRAW_LOWER_LEFT);
  drawFilledEllipse(32+64, 19, 20, 12, U8G2_DRAW_LOWER_RIGHT|U8G2_DRAW_LOWER_LEFT);
  setDrawColor(1);
  sendBuffer();
}

void SystemDisplay::normal()
{
  clearBuffer();
  drawFilledEllipse(32, 32, 15, 20);
  drawFilledEllipse(32+64, 32, 15, 20);
  setDrawColor(0);
  drawFilledEllipse(32, 32, 6, 11);
  drawFilledEllipse(32+64, 32, 6, 11);
  setDrawColor(1);
  sendBuffer();
}

void SystemDisplay::happy()
{
  clearBuffer();
  drawFilledEllipse(32, 45, 20, 20, U8G2_DRAW_UPPER_RIGHT|U8G2_DRAW_UPPER_LEFT);
  drawFilledEllipse(32+64, 45, 20, 20, U8G2_DRAW_UPPER_RIGHT|U8G2_DRAW_UPPER_LEFT);
  setDrawColor(0);
  drawFilledEllipse(32, 45, 20, 12, U8G2_DRAW_UPPER_RIGHT|U8G2_DRAW_UPPER_LEFT);
  drawFilledEllipse(32+64, 45, 20, 12, U8G2_DRAW_UPPER_RIGHT|U8G2_DRAW_UPPER_LEFT);
  setDrawColor(1);
  sendBuffer();
}

// angry expression
void SystemDisplay::angry()
{
  clearBuffer();
  drawFilledEllipse(32, 32, 15, 20);
  drawFilledEllipse(32+64, 32, 15, 20);
  setDrawColor(0);
  drawFilledEllipse(32, 32, 8, 13);
  drawFilledEllipse(32+64, 32, 8, 13);
  drawTriangle(3, 10, 64, 50, 124, 10);
  setDrawColor(1);
  sendBuffer();
}

// angry expression
void SystemDisplay::love()
{
  clearBuffer();
  setFont(u8g2_font_open_iconic_all_4x_t); // Width 32, Height 32
  drawGlyph(32-16, 32+16, 0xB7);   // Coeur
  drawGlyph(32-16+64, 32+16, 0xB7);   // Coeur
  sendBuffer();
}

void SystemDisplay::sleep()
{
  clearBuffer();
  drawFilledEllipse(32, 32, 20, 20, U8G2_DRAW_LOWER_LEFT|U8G2_DRAW_LOWER_RIGHT);
  drawFilledEllipse(32+64, 32, 20, 20, U8G2_DRAW_LOWER_LEFT|U8G2_DRAW_LOWER_RIGHT);
  setDrawColor(0);
  drawFilledEllipse(32, 32, 20, 12, U8G2_DRAW_LOWER_LEFT|U8G2_DRAW_LOWER_RIGHT);
  drawFilledEllipse(32+64, 32, 20, 12, U8G2_DRAW_LOWER_LEFT|U8G2_DRAW_LOWER_RIGHT);
  setDrawColor(1);
  setFont(u8g2_font_fub14_tr);
  drawUTF8(20, 30, "zZ");
  drawUTF8(64+20, 30, "zZ");
  sendBuffer();
}