summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorRosyid Haryadi <rosyid_haryadi@protonmail.com>2023-12-22 22:08:32 +0700
committerRosyid Haryadi <rosyid_haryadi@protonmail.com>2023-12-22 22:08:32 +0700
commit4cc0f5953b4a8fd3552cb26393247f4e13c7033b (patch)
tree958bbfa53bde8696b3cf5fb869776b4327991629 /src/main.c
parentc91f0c68aa03451607bca6f9bbaa8fb4503b1494 (diff)
harmonics
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index eaf6d3d..17edaa7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,4 +1,6 @@
+#include <math.h>
#include "raylib.h"
+#include "raymath.h"
typedef struct InitConfig {
@@ -11,7 +13,7 @@ typedef struct InitConfig {
} InitConfig;
void doInitialization(InitConfig config);
-void doDrawing();
+void doDrawing(InitConfig config);
void doUpdate();
int main(void)
@@ -29,7 +31,7 @@ int main(void)
while (!WindowShouldClose())
{
doUpdate();
- doDrawing();
+ doDrawing(config);
}
CloseWindow();
@@ -46,10 +48,21 @@ void doUpdate() {
float dt = GetFrameTime();
}
-void doDrawing() {
+void doDrawing(InitConfig config) {
BeginDrawing();
ClearBackground(BLACK);
+ DrawLine(0, config.ORIGIN_Y, config.SCREEN_WIDTH, config.ORIGIN_Y, RED);
+ DrawLine(config.ORIGIN_X, 0, config.ORIGIN_X, config.SCREEN_HEIGHT, RED);
+
+ int end = config.SCREEN_WIDTH / 2;
+ int start = -1 * end;
+ for (int x = start; x < end; x++) {
+ float y1 = 100 * sinf((float)x/10);
+ float y2 = 100 * cosf((float)x/12);
+ float y = y1 + y2;
+ DrawPixelV(Vector2Add((Vector2){(float)x, y}, (Vector2){(float)config.ORIGIN_X, (float)config.ORIGIN_Y}), WHITE);
+ }
EndDrawing();
} \ No newline at end of file