36 lines
815 B
C++
36 lines
815 B
C++
#ifndef RICOCHETHELPER_H
|
|
#define RICOCHETHELPER_H
|
|
|
|
#include "Arduino.h"
|
|
#include "FastLED.h"
|
|
|
|
class RicochetHelper {
|
|
public:
|
|
RicochetHelper() {}
|
|
RicochetHelper(int16_t _startPosX, int16_t _startPosY, int16_t _width, int16_t _height,
|
|
CRGB _color) : currentX(_startPosX), currentY(_startPosY), width(_width),
|
|
height(_height), xDir(random(0, 101) > 51 ? -1 : 1), yDir(random(0, 100) > 51 ? -1 : 1) {}
|
|
|
|
int16_t getCurrentXPos() { return currentX; }
|
|
int16_t getCurrentYPos() { return currentY; }
|
|
|
|
CRGB getCurrentColor() { return color; }
|
|
|
|
void setCurrentColor(uint16_t _color) { color = _color; }
|
|
|
|
void updatePositions();
|
|
|
|
private:
|
|
int16_t
|
|
currentX,
|
|
currentY,
|
|
width,
|
|
height;
|
|
int8_t
|
|
xDir,
|
|
yDir;
|
|
CRGB
|
|
color;
|
|
};
|
|
|
|
#endif |