// 動畫Delay迴圈
void delay_ms(uint16_t x)
{
uint8_t y, z;
for ( ; x > 0 ; x--){
for ( y = 0 ; y < 90 ; y++){
for ( z = 0 ; z < 6 ; z++){
asm volatile ("nop");
}
}
}
}
//Z axiz的下雨動畫
void shift (char axis, int direction)
{
int i, x ,y;
int ii, iii;
int state;
for (i = 0; i < 8; i++)
{
if (direction == -1)
{
ii = i;
} else
{
ii = (7-i);
}
for (x = 0; x < 8; x++)
{
for (y = 0; y < 8; y++)
{
if (direction == -1)
{
iii = ii+1;
} else
{
iii = ii-1;
}
if (axis == AXIS_Z)
{
state = getvoxel(x,y,iii);
altervoxel(x,y,ii,state);
}
if (axis == AXIS_Y)
{
state = getvoxel(x,iii,y);
altervoxel(x,ii,y,state);
}
if (axis == AXIS_X)
{
state = getvoxel(iii,y,x);
altervoxel(ii,y,x,state);
}
}
}
}
if (direction == -1)
{
i = 7;
} else
{
i = 0;
}
for (x = 0; x < 8; x++)
{
for (y = 0; y < 8; y++)
{
if (axis == AXIS_Z)
clrvoxel(x,y,i);
if (axis == AXIS_Y)
clrvoxel(x,i,y);
if (axis == AXIS_X)
clrvoxel(i,y,x);
}
}
}
[/pre] |