generated from sigonasr2/CPlusPlusProjectTemplate
parent
b246dac938
commit
58a89798d7
@ -1,7 +1,7 @@ |
||||
build.sh:d5e4e98a6f677aa0a9759ba0afb2fb77 - |
||||
build.sh:f7da5b6f54c56658f5410e0df797b5a7 - |
||||
commit.sh:d03a46e721060c22ccb146e19d27e70a - |
||||
debug.sh:849488515cab075948653c15eec4177b - |
||||
lines.sh:3b907786f7fc9204025993016c9080de - |
||||
release.sh:6a96fb84ba64ed60d31be436ec069f05 - |
||||
release.sh:0ab321c3fa2f1a1b2f03b1aec3bce816 - |
||||
temp:d41d8cd98f00b204e9800998ecf8427e - |
||||
web.sh:b982212b88b80a59ad607b47d2ff3e94 - |
||||
web.sh:e317e1d492d00517a0ac0e460239daa0 - |
||||
|
Binary file not shown.
@ -0,0 +1,29 @@ |
||||
#include "pixelGameEngine.h" |
||||
#include "Meteos.h" |
||||
|
||||
extern Meteos*game; |
||||
|
||||
void Star::Update(){ |
||||
pos+=spd; |
||||
if (pos.x<0){ |
||||
pos.x+=game->ScreenWidth(); |
||||
} |
||||
if (pos.x>game->ScreenWidth()){ |
||||
pos.x-=game->ScreenWidth(); |
||||
} |
||||
if (pos.y<0){ |
||||
pos.y+=game->ScreenHeight(); |
||||
} |
||||
if (pos.y>game->ScreenHeight()){ |
||||
pos.y-=game->ScreenHeight(); |
||||
} |
||||
|
||||
if (flickerTimer++>=flickerRate){ |
||||
flickerTimer=0; |
||||
brightness={redDistribution(game->gen),greenDistribution(game->gen),blueDistribution(game->gen)}; |
||||
} |
||||
}; |
||||
|
||||
void Star::Draw(){ |
||||
game->FillRectDecal(pos,size,brightness); |
||||
}; |
@ -0,0 +1,23 @@ |
||||
#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(); |
||||
}; |
@ -0,0 +1,3 @@ |
||||
#define OLC_PGE_HEADLESS |
||||
#define OLC_PGE_APPLICATION |
||||
#include "pixelGameEngine.h" |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Loading…
Reference in new issue