[–]▶ No.1086640[Watch Thread][Show All Posts]
As my gift to all Anons, here's my 'hello world' in graphics programming.
#define N 10
int charge[N], xc[N], yc[N];
{
for (int i = 0; i < N; i++)
{
charge[i] = -50 + random() % 100;
xc[i] = random() % 320;
yc[i] = random() % 240;
}
Address_set (0, 0, 239, 319);
for (int x = 0; x < 320; x++)
{
for (int y = 0; y < 240; y++)
{
int ch = 1023;
for (int i = 0; i < N; i++)
{
int dx = x - xc[i];
int dy = y - yc[i];
ch += charge[i] * sqrtf(dx*dx + dy*dy);
}
Lcd_Write_Data16 ((unsigned short)ch);
}
}
delay (5000);
}
____________________________
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.