
// OvalShape.java
// Andrew Davison, Jan 2023, ad@coe.psu.ac.th

/* Represents an oval. 
   Implements the Shape class by defining drawShape().

   This class corresponds to the OvalShape class in the 
   Java SimplePaint application.

*/ 

package com.mygdx.game;


// import java.awt.*;
import com.badlogic.gdx.graphics.*;
import com.badlogic.gdx.math.*;    // Point --> Vector2

import com.badlogic.gdx.graphics.glutils.*;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;



public class OvalShape extends Shape 
{
  public OvalShape(float x1, float y1, float x2, float y2,
	                   boolean isFilled, Color color) 
  {  super(x1, y1, x2, y2, isFilled, color);  }
  

  public void drawShape(ShapeRenderer sr) 
  // draw an oval
  {
    sr.setColor(shapeColor);
    float width = endPt.x - startPt.x;
    float height = endPt.y - startPt.y;

    if (!isFilled) {
      sr.begin(ShapeType.Line);
      sr.ellipse(startPt.x, startPt.y, width, height, 50);
    }
    else {
      sr.begin(ShapeType.Filled);
      sr.ellipse(startPt.x, startPt.y, width, height, 50);
    }
    sr.end();
  } // end of drawShape()
  
} // end of OvalShape class
