-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include<cmath> | ||
|
||
extern "C" void pixel(int x, int y, unsigned char *pix); | ||
extern "C" void drawn(); | ||
|
||
static double scale_r = 1.0, scale_g = 10.0, scale_b = 1.0; | ||
|
||
// pixel operation here, called once for every pixel each frame | ||
void pixel(int x, int y, unsigned char *pix) { | ||
pix[0] *= scale_r; | ||
pix[1] *= scale_g; | ||
pix[2] *= scale_b; | ||
} | ||
// called when frame is done drawing | ||
void drawn() { | ||
|
||
scale_r += 0.01f; | ||
scale_g -= 0.01f; | ||
scale_b += 0.05f; | ||
|
||
if(scale_r >= 10) scale_r = 1.0; | ||
if(scale_g <= 1) scale_g = 10.0; | ||
if(scale_b >= 5) scale_b = 1.0; | ||
|
||
} | ||
|
Binary file not shown.