ws2812-achterbahn/wagon.h

38 lines
831 B
C++

#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);
uint32_t Wheel(byte WheelPos,float brightness);
int pos();
int id();
long spawntime();
bool alive();
private:
int _numpixels;
Adafruit_NeoPixel *_strip;
float _pos;
float _vel;
float _acc;
float _wagonmass;
float _wagonlength;
uint8_t *_height;
long _spawntime;
long _lasttimefast;
uint32_t _wagoncolor;
};
#endif