6b30baa7e4
* update documentation * Fix typo * Added some examples * changed window names * Minor fix * Added mfb_update_events to all platforms. Checked on Windows, X11 and Wayland * simplify CMake * Upgrade to CMake 3.5, simplify script and generalize it Now the users only have to add_directory and link_libraries(minifb) in CMake * Renamed typo scrool by scroll Added some checks Removed some warnings * working Windows, X11 and Wayland * fix issue 32 Co-authored-by: Carlos Aragones <> Co-authored-by: caragones <carlos.aragonesmartinez-external@gemalto.com>
47 lines
1.0 KiB
C
47 lines
1.0 KiB
C
#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;
|
|
|
|
for (;;)
|
|
{
|
|
int i;
|
|
mfb_update_state 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;
|
|
g_buffer[i] = MFB_RGB(noise, noise, noise);
|
|
}
|
|
|
|
state = mfb_update(window, g_buffer);
|
|
if (state != STATE_OK) {
|
|
window = 0x0;
|
|
break;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|