diff options
author | Rosyid Haryadi <rosyid_haryadi@protonmail.com> | 2023-12-22 22:08:32 +0700 |
---|---|---|
committer | Rosyid Haryadi <rosyid_haryadi@protonmail.com> | 2023-12-22 22:08:32 +0700 |
commit | 4cc0f5953b4a8fd3552cb26393247f4e13c7033b (patch) | |
tree | 958bbfa53bde8696b3cf5fb869776b4327991629 /src | |
parent | c91f0c68aa03451607bca6f9bbaa8fb4503b1494 (diff) |
harmonics
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 19 |
1 files changed, 16 insertions, 3 deletions
@@ -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 |