#include <stdio.h>
#include "RectangleP.h"

static void init(Core p);
static void draw_rectangle(Shape shape);

RectangleClassDescriptor rectangle_class_descriptor = {
    /* Core part */
    {
        "Rectangle",            /* class_name */
        (CoreClassDescriptor*)&shape_class_descriptor,/* super_class */
        sizeof(RectangleObj),   /* size_of_instance */
        NULL,                   /* class_initializer */
        init,                   /* initializer */
        NULL,                   /* finalizer */
    },
    /* Shape part */
    {
        draw_rectangle,         /* draw */
    },
    /* Rectangle part */
    {
        0,                      /* dummy */
    },
};

CoreClassDescriptor *rectangleClass
    = (CoreClassDescriptor*)&rectangle_class_descriptor;

static void
init(Core p)
{
    Rectangle rectangle = (Rectangle)p;

    rectangle->rectangle.points[0].x = 0.0;
    rectangle->rectangle.points[0].y = 0.0;
    rectangle->rectangle.points[1].x = 0.0;
    rectangle->rectangle.points[1].y = 0.0;
    printf("rectangle initialized.\n");
}

static void
draw_rectangle(Shape shape)
{
    printf("draw rectangle!\n");
}