diff options
-rw-r--r-- | src/sldj.c | 5 | ||||
-rw-r--r-- | test/scanTest1.c | 4 | ||||
-rw-r--r-- | test/scanTest3.c | 40 |
3 files changed, 44 insertions, 5 deletions
@@ -54,14 +54,13 @@ void updateSldj(Sldj* sldj) DrawTexturePro( viewport, (Rectangle){0.0, 0.0, viewport.width, viewport.height}, - (Rectangle){0.0, 0.0, GetScreenWidth(), GetScreenHeight()}, + (Rectangle){0.0, 0.0, viewport.width, viewport.height}, (Vector2){0.0, 0.0}, 0.0, WHITE ); - DrawFPS(0, 0); - //SetWindowTitle(TextFormat("Scanline DJ %dfps", GetFPS())); + DrawFPS(0, viewport.height); if (IsKeyPressed(KEY_R)) { diff --git a/test/scanTest1.c b/test/scanTest1.c index c673e04..b03060a 100644 --- a/test/scanTest1.c +++ b/test/scanTest1.c @@ -23,8 +23,8 @@ Color lineScanner(uint16_t x, uint16_t y, uint32_t frameNumber) c = frameNumber + hypot((x - 32768) >> scale, (y - 32768) >> scale); } } else { - uint8_t c1 = (x >> 8) + (uint8_t)(hypot(x >> 8, y >> 8) * (frameNumber % 255)); - uint8_t c2 = (x >> 8) + (uint8_t)(hypot(cos(x >> scale), sin(y >> scale)) * (frameNumber % 255)); + uint8_t c1 = (x >> 8) + (uint8_t)(hypot(x >> 8, y >> 8) * (frameNumber % 255)); + uint8_t c2 = (x >> 8) + (uint8_t)(hypot(cos(x >> scale), sin(y >> scale)) * (frameNumber % 255)); uint8_t c3 = frameNumber + hypot((x - 32768) >> scale, (y - 32768) >> scale); c = c1 & c2 & c3; diff --git a/test/scanTest3.c b/test/scanTest3.c new file mode 100644 index 0000000..1a0c3ec --- /dev/null +++ b/test/scanTest3.c @@ -0,0 +1,40 @@ +#include <stdio.h> +#include <stdint.h> +#include <stdlib.h> +#include <math.h> +#include <time.h> + +#include "libsldj/util.h" + +uint8_t lastValue = 200; + +// Rerendered noise. +#define VALUES_SIZE 65536 +uint8_t values[VALUES_SIZE]; + +void loadContext(SldjContext context) +{ + srandom(time(NULL)); + + for (int i = 0; i < VALUES_SIZE; ++i) + { + values[i] = random() % 256; + } +} + +int s = 100; + +Color lineScanner(uint16_t x, uint16_t y, uint32_t frameNumber) +{ + // Shifts around the noise to make it look better. + uint8_t c = values[((x + (frameNumber >> 2)) + (y << 1)) % VALUES_SIZE]; + uint8_t b = frameNumber + SLDJ_HYPOT2(((x - 32768) >> 6), ((y - 32768) >> 6)); + + return (Color){ + .r = (c + b) << 1, + .g = b, + .b = c, + .a = 255 + }; +} + |