ws2812-achterbahn/wagon.h

44 lines
1007 B
C
Raw Normal View History

#ifndef WAGON_H
#define WAGON_H
#include <Adafruit_NeoPixel.h>
#include <math.h>
class Wagon
{
public:
int _id;
Wagon(int id,int numpixels,Adafruit_NeoPixel *strip,uint8_t *height, float pos, float wagonlength, float startvel,float startacc, float wagonmass, uint32_t wagoncolor);
Wagon();
bool operator==(const Wagon &r) const;
void updatePhysics(float updatedelayms);
void updateGraphics();
float getHeight(int p);
2018-04-08 17:47:34 +00:00
uint32_t Wheel(byte WheelPos,float brightness);
int pos();
int id();
2018-04-08 17:47:34 +00:00
long spawntime();
bool alive();
2018-06-10 17:59:01 +00:00
void setType(uint8_t t);
void setLength(float l);
private:
int _numpixels;
Adafruit_NeoPixel *_strip;
float _pos;
float _vel;
float _acc;
float _wagonmass;
2018-05-06 16:14:11 +00:00
float _trainlength;
uint8_t *_height;
2018-04-08 17:47:34 +00:00
long _spawntime;
float _lastvel;
float _lastpositivedirchangepos;
float _lastpositivedirchangePosDifference;
uint32_t _wagoncolor;
float _health;
2018-06-10 17:59:01 +00:00
uint8_t _type;
};
#endif