2014-06-06 08:13:51 +00:00
|
|
|
#include <MiniFB.h>
|
|
|
|
|
|
|
|
#define WIDTH 800
|
|
|
|
#define HEIGHT 600
|
|
|
|
static unsigned int s_buffer[WIDTH * HEIGHT];
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
int noise, carry, seed = 0xbeef;
|
|
|
|
|
|
|
|
if (!mfb_open("Noise Test", WIDTH, HEIGHT))
|
|
|
|
return 0;
|
|
|
|
|
2014-06-06 12:39:09 +00:00
|
|
|
for (;;)
|
2014-06-06 08:13:51 +00:00
|
|
|
{
|
|
|
|
int i, state;
|
|
|
|
|
|
|
|
for (i = 0; i < WIDTH * HEIGHT; ++i)
|
|
|
|
{
|
|
|
|
noise = seed;
|
|
|
|
noise >>= 3;
|
|
|
|
noise ^= seed;
|
|
|
|
carry = noise & 1;
|
|
|
|
noise >>= 1;
|
|
|
|
seed >>= 1;
|
|
|
|
seed |= (carry << 30);
|
|
|
|
noise &= 0xFF;
|
2014-06-06 12:39:09 +00:00
|
|
|
s_buffer[i] = MFB_RGB(noise, noise, noise);
|
2014-06-06 08:13:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
state = mfb_update(s_buffer);
|
|
|
|
|
2014-06-06 16:28:39 +00:00
|
|
|
if (state < 0)
|
2014-06-06 08:13:51 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
mfb_close();
|
2014-06-06 16:28:39 +00:00
|
|
|
|
|
|
|
return 0;
|
2014-06-06 08:13:51 +00:00
|
|
|
}
|