diff options
author | kdx <kikoodx@paranoici.org> | 2023-04-17 19:32:27 +0200 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2023-04-17 19:34:14 +0200 |
commit | aac91f728e15a58eccab50e35893105173c6e855 (patch) | |
tree | 7cefd4bda2dc8e92351f5ce58ae5769b8312c2b4 | |
parent | 4f98ee228648cc122cd8b883f8480f967ca92c8c (diff) | |
download | px-aac91f728e15a58eccab50e35893105173c6e855.tar.gz |
acid
-rw-r--r-- | src/main.c | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -1,15 +1,18 @@ #include "TZR.h" #include "px.h" +#include <stdlib.h> +#include <time.h> int main(void) { - if (TZR_Init(128, 128, 60, true, false, false, false, false, "indexed")) + if (TZR_Init(128, 128, 60, true, false, false, false, false, "px")) return 1; if (atexit(TZR_Quit)) { TZR_Quit(); return 1; } + srand(time(NULL)); PxSpr spr = { 8, 8, @@ -26,6 +29,7 @@ main(void) }; int x = 8, y = 8; + while (!TZR_ShouldQuit()) { TZR_CycleEvents(); x -= TZR_IsKeyDown(SDL_SCANCODE_A); @@ -54,8 +58,19 @@ main(void) if (TZR_GetTick() / 60 % 2) pxSpal(1, 0); else { - pxSpal(10, 11); - pxSpal(11, 10); + PxCol cols[16] ={ 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15}; + for (int i = 0; i < 1024; i++) { + const int i = rand() % 16; + const int k = rand() % 16; + if (i == k) + continue; + cols[i] ^= cols[k]; + cols[k] ^= cols[i]; + cols[i] ^= cols[k]; + } + for (int i = 0; i < 16; i++) + pxSpal(i, cols[i]); } TZR_DrawBegin(); |