Пример #1
0
int rollDice(int row, int col, int duration) //Rolls and Animates Dice
{
	int n;
	int d1;
	int d2;
	for(n = 0; n < duration; n++)
	{
		drawDice(row, col, rand()%6+1);
		drawDice(row, col+3, rand()%6+1);
		waitForVblank();
	}
	d1 = rand()%6+1;
	d2 = rand()%6+1;
	drawDice(row, col, d1);
	drawDice(row, col+3, d2);
	waitForVblank();
	return d1 + d2;
}
Пример #2
0
void pt_dices(bitmap_t dest, const struct timeval_t time,
              const enum CLOCK_MODE clock_mode)
{
    clearBuffer(dest, 0x00);
	drawDice(dest, time.seconds % 10, point(1,6));
	drawDice(dest, time.seconds / 10, point(1,2));

	drawDice(dest, time.minutes % 10, point(5,6));
	drawDice(dest, time.minutes / 10, point(5,2));

	drawDice(dest, time.hours % 10, point(9,6));
	drawDice(dest, time.hours / 10, point(9,2));

	switch(clock_mode) {
        case MODE_NONE:
            break;
        case MODE_SECOND:
            dest[9] = 0x0002;
            break;
        case MODE_MINUTE:
            dest[9] = 0x0020;
            break;
        case MODE_HOUR:
            dest[9] = 0x0200;
            break;
        default: break;
	}
};