mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-26 15:26:43 +00:00
Add Stars wallpaper to graphics demos
This commit is contained in:
parent
d0789782c9
commit
3fb0501604
2 changed files with 62 additions and 0 deletions
Binary file not shown.
62
src/Demo/Graphics/WallPaperStars.CC
Normal file
62
src/Demo/Graphics/WallPaperStars.CC
Normal file
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
You "Zenith include" this because you want the wallpaper
|
||||
routine to stay in mem even if this task is killed.
|
||||
*/
|
||||
|
||||
#define NUM_STARS GR_WIDTH * GR_HEIGHT / 2160
|
||||
// Derived from ratio for 600 for 1440x900
|
||||
|
||||
class Star
|
||||
{
|
||||
U16 x, y;
|
||||
|
||||
} wall_stars[NUM_STARS];
|
||||
|
||||
U0 (*old_wall_paper)(CTask *task);
|
||||
|
||||
U0 WallPaperStars(CTask *task)
|
||||
{
|
||||
I64 i;
|
||||
CDC *dc = DCAlias(gr.dc2, task);
|
||||
|
||||
dc->color = YELLOW;
|
||||
|
||||
for (i = 0; i < NUM_STARS; i++)
|
||||
{
|
||||
GrPlot(dc, wall_stars[i].x, wall_stars[i].y);
|
||||
|
||||
if (++wall_stars[i].y > GR_HEIGHT)
|
||||
{
|
||||
wall_stars[i].y = 0;
|
||||
wall_stars[i].x = RandU16 % GR_WIDTH;
|
||||
}
|
||||
}
|
||||
|
||||
//Uncomment the following if you wish. Will draw the old wallpaper over this one.
|
||||
//old_wall_paper(task);
|
||||
|
||||
task->text_attr = WHITE << 4 + WHITE;
|
||||
|
||||
}
|
||||
|
||||
U0 WallInit()
|
||||
{
|
||||
I64 i;
|
||||
|
||||
if (Fs != zenith_task)
|
||||
{
|
||||
"\nMust be Zenith Included. (SHIFT-F5 / RightClick->Zenith Include) \n";
|
||||
return;
|
||||
}
|
||||
old_wall_paper=gr.fp_wall_paper;
|
||||
|
||||
for (i = 0; i < NUM_STARS; i++)
|
||||
{
|
||||
wall_stars[i].x = RandU16 % GR_WIDTH;
|
||||
wall_stars[i].y = RandU16 % GR_HEIGHT;
|
||||
}
|
||||
|
||||
gr.fp_wall_paper = &WallPaperStars;
|
||||
}
|
||||
|
||||
WallInit;
|
Loading…
Reference in a new issue