2024-09-10 20:58:46 +00:00
|
|
|
#include "unigi/main.h"
|
|
|
|
#include "unigi.platform.sdl1/main.c"
|
|
|
|
#include "unigi.ext/main.c"
|
2024-07-31 20:06:29 +00:00
|
|
|
|
|
|
|
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 = 320;
|
|
|
|
res.height = 240;
|
|
|
|
res.depth = 32;
|
|
|
|
|
|
|
|
unigi_ext_type_texture buf;
|
|
|
|
buf.width = res.width;
|
|
|
|
buf.height = res.height;
|
|
|
|
buf.lq_color = 0x0000;
|
|
|
|
unigi_type_color buf_pixels[res.width * res.height];
|
|
|
|
buf.pixels = buf_pixels;
|
|
|
|
|
|
|
|
|
|
|
|
unigi_ext_type_texture tex;
|
|
|
|
unigi_type_color tex_pixels[6];
|
|
|
|
tex.width = 3;
|
|
|
|
tex.height = 2;
|
|
|
|
tex.lq_color = 0x0000;
|
|
|
|
tex_pixels[0] = 0xFF00;
|
|
|
|
tex_pixels[1] = 0xF0F0;
|
|
|
|
tex_pixels[2] = 0xF00F;
|
|
|
|
tex_pixels[3] = 0xFFF0;
|
|
|
|
tex_pixels[4] = 0xF0FF;
|
|
|
|
tex_pixels[5] = 0xFF0F;
|
|
|
|
tex.pixels = tex_pixels;
|
|
|
|
|
|
|
|
unigi_ext_type_rect tex_bounds;
|
|
|
|
tex_bounds.x1 = 0;
|
|
|
|
tex_bounds.y1 = 0;
|
|
|
|
tex_bounds.x2 = 3;
|
|
|
|
tex_bounds.y2 = 2;
|
|
|
|
unigi_ext_type_rect buf_bounds;
|
|
|
|
buf_bounds.x1 = 10;
|
|
|
|
buf_bounds.y1 = 10;
|
|
|
|
buf_bounds.x2 = 61;
|
|
|
|
buf_bounds.y2 = 41;
|
|
|
|
|
|
|
|
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);
|
|
|
|
buf.pixels[(((y * res.width) + x) + t) % max] = (t + (x ^ y)) + y;
|
|
|
|
}
|
|
|
|
t2++;
|
|
|
|
}
|
|
|
|
|
|
|
|
unigi_ext_texture_draw(tex,buf,tex_bounds,buf_bounds);
|
|
|
|
unigi_graphics_blit(0,buf.pixels,res.width * res.height);
|
|
|
|
unigi_graphics_flush();
|
|
|
|
t++;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|