
一段给C程序,大致的翻译一下 cube[z][0] = (pgm_read_byte(&spinning_line[(i+z)%6][0]) >> 4);解释下 5
voideffect_spiral(INTdirection,INTiterations,INTdelay){INTi;INTz;//cubelevelfor(i=0;i...
void effect_spiral(INT direction, INT iterations, INT delay)
{
INT i;
INT z; // cube level
for (i=0;i<iterations;i++)
{
// LOOP cube levels
for (z=0;z<4;z++)
{
// Read the animation from program memory AND put it IN the cube buffer.
// y=0 AND y=2 is stored IN the upper nibble of the BYTE, AND must be bitshifted INTO place.
cube[z][0] = (pgm_read_byte(&spinning_line[(i+z)%6][0]) >> 4);
cube[z][1] = pgm_read_byte(&spinning_line[(i+z)%6][0]);
cube[z][2] = (pgm_read_byte(&spinning_line[(i+z)%6][1]) >> 4);
cube[z][3] = pgm_read_byte(&spinning_line[(i+z)%6][1]);
// the +z makes the animation iterate one step for each plane
// making it INTO a spiral
}
delay_ms(delay);
}
} 展开
{
INT i;
INT z; // cube level
for (i=0;i<iterations;i++)
{
// LOOP cube levels
for (z=0;z<4;z++)
{
// Read the animation from program memory AND put it IN the cube buffer.
// y=0 AND y=2 is stored IN the upper nibble of the BYTE, AND must be bitshifted INTO place.
cube[z][0] = (pgm_read_byte(&spinning_line[(i+z)%6][0]) >> 4);
cube[z][1] = pgm_read_byte(&spinning_line[(i+z)%6][0]);
cube[z][2] = (pgm_read_byte(&spinning_line[(i+z)%6][1]) >> 4);
cube[z][3] = pgm_read_byte(&spinning_line[(i+z)%6][1]);
// the +z makes the animation iterate one step for each plane
// making it INTO a spiral
}
delay_ms(delay);
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询