There’s a fun challenge on Twitter at the moment with the hashtag #8bit snow. They want people to make little demos on their 8bit computer for Christmas and post it to Twitter with this hashtag. I whipped up something quickly in Z88dk today.
I used my FOXGLOVZ library for the proportional font text and programmed some snow to fall above it. The code is below if you’re interested.
#include <games.h>
#include <vz.h>
#include <stdlib.h>
#include <string.h>
#include <balloc.h>
#include <sys/ioctl.h>
#include "foxglovz.c"
int main(void)
{
#asm
di
#endasm
// Set graphics MODE(1)
int mode = 1;
console_ioctl(IOCTL_GENCON_SET_MODE, &mode);
struct myfontspecs myfont;
strcpy(myfont.name, "SansSerif5x9p");
myfont.xpos = 0;
myfont.ypos = 0;
myfont.spacing = 1;
myfont.colour = _vzred;
myfont.ypos = 5;
myfont.fx = _fxnormal;
myfont.ypos = 33;
fox_textat(&myfont,"Merry Christmas from");
myfont.ypos = 43;
fox_textat(&myfont,"@WauloK of BlueBilby.com");
myfont.ypos = 53;
fox_textat(&myfont,"VZ200&VZ300 computers");
int snowx[100],snowy[100],i,t;
for(i=0;i<100;i++) {
snowx[i]=rand()%127;snowy[i]=rand()%30;
}
while(1) {
for(i=0;i<100;i++) {
textcolor(3);
plot(snowx[i],snowy[i]);
}
msleep(50);
for(i=0;i<100;i++) {
unplot(snowx[i],snowy[i]);
snowx[i]+=rand()%3-1;
snowy[i]++;
if (snowx[i] < 0) snowx[i]=0;
if (snowx[i] > 127) snowx[i]=127;
if (snowy[i] > 32) { snowy[i]=0; snowx[i]=rand()%127; }
}
}
while(1) {}
}
0 Comments.