generated from sigonasr2/CPlusPlusProjectTemplate
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
878 B
23 lines
878 B
2 years ago
|
#include "pixelGameEngine.h"
|
||
|
#include <random>
|
||
|
|
||
|
class Star{
|
||
|
vf2d pos;
|
||
|
vf2d spd;
|
||
|
vf2d size={1,1};
|
||
|
Pixel minBrightness;
|
||
|
Pixel maxBrightness;
|
||
|
Pixel brightness=minBrightness;
|
||
|
int flickerRate=10; //Number of frames between each flicker.
|
||
|
int flickerTimer=0;
|
||
|
std::uniform_int_distribution<uint8_t>redDistribution,greenDistribution,blueDistribution;
|
||
|
public:
|
||
|
Star(vf2d pos,vf2d spd,Pixel minBrightness,Pixel maxBrightness)
|
||
|
:pos(pos),spd(spd),minBrightness(minBrightness),maxBrightness(maxBrightness){
|
||
|
redDistribution=std::uniform_int_distribution<uint8_t>(minBrightness.r,maxBrightness.r);
|
||
|
greenDistribution=std::uniform_int_distribution<uint8_t>(minBrightness.g,maxBrightness.g);
|
||
|
blueDistribution=std::uniform_int_distribution<uint8_t>(minBrightness.b,maxBrightness.b);
|
||
|
}
|
||
|
void Update();
|
||
|
void Draw();
|
||
|
};
|