diff --git a/README.md b/README.md index bb40367..418f141 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ A unigi app is built from different layers: * **[Headers](https://git.lumen.sh/Fierelier/unigi.headers)** - The functions to be implemented by the Platform * **[Platform](#official-platforms)** - Implements the functions from Headers to work on a particular system * **...** - Optionally, more layers -* **App** - Your code, uses other layers for input/output +* **App** - Your code, uses other layers for input/output. You can find examples in test/\* # Platforms Platforms act as the translation layer for different systems. The idea is to minimize the amount of work it takes to port graphical applications. diff --git a/test/graphics.c b/test/graphics.c new file mode 100644 index 0000000..da0c818 --- /dev/null +++ b/test/graphics.c @@ -0,0 +1,36 @@ +#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_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) { + 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; +}