unigi/test/graphics.c
2024-07-20 19:39:02 +02:00

47 lines
1.1 KiB
C

#include "../../unigi.headers/src/main.h"
#include "../../unigi.platform.sdl1/src/main.c"
uint32_t seed = 1337;
uint32_t example_random() {
seed = (seed * 1103515245 + 12345) & 0x7FFFFFFF;
return seed;
}
int main(int argc, char *argv[]) {
unigi_init();
unigi_type_event event;
unigi_type_resolution res;
res.width = 640;
res.height = 480;
res.depth = 32;
unigi_type_color pixels[res.width * res.height];
unigi_type_resolution_2d_coord x;
unigi_type_resolution_2d_coord y;
unigi_type_resolution_1d_coord max = res.width * res.height;
uint32_t t = 0;
uint32_t t2 = 0;
unigi_graphics_init();
unigi_window_create(res,"game");
while (1) {
unigi_event_get(&event);
if (event.type == unigi_enum_event_input_keyboard) {
exit(0);
}
for (y = 0; y < res.height; y++) {
for (x = 0; x < res.width; x++) {
//unigi_graphics_draw((y * res.width) + x,(t + (x ^ y)) + y);
//unigi_graphics_draw((((y * res.width) + x) + t) % max,(t + (x ^ y)) + y);
pixels[(((y * res.width) + x) + t) % max] = (t + (x ^ y)) + y;
}
t2++;
}
unigi_graphics_blit(0,&pixels,res.width * res.height);
unigi_graphics_flush();
t++;
}
return 0;
}