//#include <openxdk.h>
// Small algorithm that draws simple circles
void
xbvDrawCircle( unsigned
int *pdwFramebuffer,
int nSizeStrideInDwords,
unsigned
int dwPixel, int
xC, int yC, int
r )
{
int x=0, y=r, u=1, v=2*r-1, e=0;
while( x < y ){
pdwFramebuffer[(xC+x)+((yC+y)* nSizeStrideInDwords)]=dwPixel;
pdwFramebuffer[(xC+y)+((yC-x)* nSizeStrideInDwords)]=dwPixel;
pdwFramebuffer[(xC-x)+((yC-y)* nSizeStrideInDwords)]=dwPixel;
pdwFramebuffer[(xC-y)+((yC+x)* nSizeStrideInDwords)]=dwPixel;
x++; e += u; u+= 2;
if( v < 2 * e ) { y--; e -= v; v
-= 2; }
if( x > y )
break;
pdwFramebuffer[(xC+y)+((yC+x)* nSizeStrideInDwords)]=dwPixel;
pdwFramebuffer[(xC+x)+((yC-y)* nSizeStrideInDwords)]=dwPixel;
pdwFramebuffer[(xC-y)+((yC-x)* nSizeStrideInDwords)]=dwPixel;
pdwFramebuffer[(xC-x)+((yC+y)* nSizeStrideInDwords)]=dwPixel;
}
}//
end of xbvDrawCircle(..)
// Program Entry Point
void
XBoxStartup()
{
while(true)
{
// Screen Memory
unsigned
int* pScr = (unsigned
int*)(0xF0000000 + *(unsigned
int*)0xFD600800);
// Display an output to show we caught
the error
xbvDrawCircle( pScr, 640, 0xffffff00, 640/2, 480/2, 10 );
xbvDrawCircle( pScr, 640, 0xffffff00, 640/2, 480/2, 50 );
xbvDrawCircle( pScr, 640, 0xffffff00, 640/2, 480/2, 100 );
}//
End while loop
}//
End
|