aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornathansmith117 <nathansmith117@sdf.org>2025-02-03 16:47:26 +0000
committernathansmith117 <nathansmith117@sdf.org>2025-02-03 16:47:26 +0000
commitb07e8d2baa70d6da287eaa555bc2bc5070c42c2f (patch)
treeb5f5fa48d045920de96b948bf279a08a2c29c9d6
parent7ecace4284edc98d48e12348372c2c2af4342ad8 (diff)
downloadsldj-b07e8d2baa70d6da287eaa555bc2bc5070c42c2f.tar.gz
sldj-b07e8d2baa70d6da287eaa555bc2bc5070c42c2f.tar.bz2
sldj-b07e8d2baa70d6da287eaa555bc2bc5070c42c2f.zip
Really cool stuff
-rw-r--r--src/scripting.c2
-rw-r--r--src/sldj.c2
-rw-r--r--test/scanTest1.c18
3 files changed, 20 insertions, 2 deletions
diff --git a/src/scripting.c b/src/scripting.c
index 9781f5f..f0a2582 100644
--- a/src/scripting.c
+++ b/src/scripting.c
@@ -17,6 +17,8 @@ void initScripting(SldjScripting* scripting)
void compileScript(SldjScripting* scripting, const char filePath[SLDJ_NAMEMAX])
{
+ scripting->lineScanner = NULL;
+
// Get file size.
struct stat fileState;
diff --git a/src/sldj.c b/src/sldj.c
index 2e40a00..349229b 100644
--- a/src/sldj.c
+++ b/src/sldj.c
@@ -58,7 +58,7 @@ void updateSldj(Sldj* sldj)
DrawTexturePro(
viewport,
(Rectangle){0.0, 0.0, viewport.width, viewport.height},
- (Rectangle){0.0, 0.0, viewport.width, viewport.height},
+ (Rectangle){0.0, 0.0, GetScreenWidth(), GetScreenHeight()},
(Vector2){0.0, 0.0},
0.0,
WHITE
diff --git a/test/scanTest1.c b/test/scanTest1.c
index 06057f2..32c4d86 100644
--- a/test/scanTest1.c
+++ b/test/scanTest1.c
@@ -1,5 +1,7 @@
#include <stdio.h>
#include <stdint.h>
+#include <stdlib.h>
+#include <math.h>
typedef struct Color {
unsigned char r;
@@ -10,6 +12,20 @@ typedef struct Color {
Color lineScanner(uint16_t x, uint16_t y, uint32_t frameNumber)
{
- return (Color){.r = random() % 255, .g = random() % 255, .b = random() % 255, .a = 255};
+ uint8_t c = 0;
+
+ if (frameNumber % 255 >= 127)
+ {
+ c = (x >> 8) + (uint8_t)(hypot(x >> 9, y >> 9) * (frameNumber % 255));
+ } else {
+ c = (x >> 8) + (uint8_t)(hypot(cos(x >> 9), sin(y >> 9)) * (frameNumber % 255));
+ }
+
+ return (Color){
+ .r = (uint8_t)(sin(c) * 127),
+ .g = c - 127,
+ .b = c,
+ .a = 255
+ };
}