#ifndef level_h
#define level_h


#include "glness.h"

#include <stdlib.h>
#include <stdio.h>

#include "player.h"
#include "line2d.h"
#include "poly2d.h"

class level
{
public:
    float mx,my;
    int vertnum, linenum, polynum;
    vector2d *lvlvert;
    line2d *lvlline;
    poly2d *lvlpoly;
    vector2d *tlvlvert;
    line2d *tlvlline;
    int linestage, tlili;//for adding lines
    //level* self;

    float winpush;

    float wateronleft;
    float winlimit;

    float watergrav;
    float waterdrag;


    int dudenum;
    player *dude;

    int gridtexid;

    int winner;


    bool mmb; //middle mouse button
    int dragpoint;

    vector2d camavg;

    Uint8*  key;

    void init(Uint8* keys);
    void update(float mx, float my);
    void draw();
    void close();


    void save(char *FileName);
    void load(char *FileName);


    void mmd(bool press,float x,float y);
    void addvert(float x, float y);
    void addline(float x, float y);
    void delvert(float x, float y);
    void delline(int lid);




};

#endif
