2020-03-06 06:06:54 +00:00
|
|
|
#include <MiniFB.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#define WIDTH 800
|
|
|
|
#define HEIGHT 600
|
|
|
|
static unsigned int g_buffer[WIDTH * HEIGHT];
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
int
|
|
|
|
main()
|
|
|
|
{
|
|
|
|
int noise, carry, seed = 0xbeef;
|
|
|
|
|
|
|
|
struct mfb_window *window = mfb_open_ex("Noise Test", WIDTH, HEIGHT, WF_RESIZABLE);
|
|
|
|
if (!window)
|
|
|
|
return 0;
|
|
|
|
|
2020-04-22 11:00:15 +00:00
|
|
|
do {
|
2020-03-06 06:06:54 +00:00
|
|
|
int i;
|
|
|
|
mfb_update_state state;
|
|
|
|
|
2020-04-22 11:00:15 +00:00
|
|
|
for (i = 0; i < WIDTH * HEIGHT; ++i) {
|
2020-03-06 06:06:54 +00:00
|
|
|
noise = seed;
|
|
|
|
noise >>= 3;
|
|
|
|
noise ^= seed;
|
|
|
|
carry = noise & 1;
|
|
|
|
noise >>= 1;
|
|
|
|
seed >>= 1;
|
|
|
|
seed |= (carry << 30);
|
|
|
|
noise &= 0xFF;
|
|
|
|
g_buffer[i] = MFB_RGB(noise, noise, noise);
|
|
|
|
}
|
|
|
|
|
|
|
|
state = mfb_update(window, g_buffer);
|
|
|
|
if (state != STATE_OK) {
|
|
|
|
window = 0x0;
|
|
|
|
break;
|
|
|
|
}
|
2020-04-22 11:00:15 +00:00
|
|
|
} while(mfb_wait_sync(window));
|
2020-03-06 06:06:54 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|