#pragma once
#include "list.h"
#include "gb_math.h"
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include "asteroids_font.h"
#include "xtimer.h"

typedef struct{
    struct {int16_t x, y; };
    int16_t e[2];
} point_t;

typedef enum{
    PATH_MOVE = 0x0,
    PATH_DRAW = 0x1
} path_modus_t;

typedef struct{
    list_node_t list;
    point_t point;
    path_modus_t modus;
} path_node_t;

typedef struct{
    list_node_t list;
    int16_t step_pos_a;
    int16_t step_pos_b;
} step_pos_node_t;

typedef struct{
    list_node_t set_point_start;
    list_node_t start;
    list_node_t current;
    uint8_t char_count;
} path_t;

void path_add(path_t *path, path_node_t *point);

void path_add_vec(path_t *node, point_t *point, path_modus_t modus);

//void path_add_rect(path_t *node, gbRect2 *rect);

void path_generate(path_t *path);

void path_reset(path_t *path);

void path_add_circle(path_t *node, gbVec2 *point, float radius, uint8_t division);

void path_reverse(path_t *node);

void path_increment(path_t *path);

void path_init(path_t *path);

void path_add_char(path_t *path, char character);

path_node_t* path_next_point(path_t *path);

path_node_t* path_next(path_node_t *point);
    
path_node_t* path_pop(path_node_t *point);

point_t point_sub(point_t *a, point_t *b);

point_t point_add(point_t *a, point_t *b);

point_t point_interval(point_t *a, point_t*b);

int16_t point_mag2(point_t *a);
