unigi/test/graphics.c

43 lines
990 B
C
Raw Normal View History

2024-06-30 20:20:07 +00:00
#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();
2024-06-30 21:25:02 +00:00
unigi_type_event event;
2024-06-30 20:20:07 +00:00
unigi_type_resolution res;
res.width = 640;
res.height = 480;
res.depth = 32;
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) {
2024-06-30 21:25:02 +00:00
unigi_event_get(&event);
if (event.type == unigi_enum_event_input_keyboard) {
exit(0);
}
2024-06-30 20:20:07 +00:00
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);
}
t2++;
}
unigi_graphics_flush();
t++;
}
return 0;
}