diff --git a/README.md b/README.md new file mode 100644 index 0000000..424b150 --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +# WrldBox Engine + +## 🧊Introduction + +**WrldBox** is a work-in-progress sandbox simulator made by Team wholeworldcoding. It is currently in a pretty developed experimental stage. + +It consists of several components: + +- `src/main.c`, Main script. Takes all other src and actually renders the engine. + +- `ray.c`, rendering the simulation with raylib. (in OLD) + +- And a bunch of new files in `src/` that compose the working physics simulation. + +- OLD contains the original logic this came from. + +This project *is* the next major `wholeworldcoding` project. + +## 🛠️ Build and Compile + +Clone the repository. Once you have navigated to the folder, you can run: + +- `make` + +## 🏅Credits + +This project was impossible without the support of all three `wholeworldcoding` members. diff --git a/src/main.c b/src/main.c index 476fdb9..f4a9fc0 100644 --- a/src/main.c +++ b/src/main.c @@ -1,7 +1,6 @@ #include - +// add all the shit from the other shit #include "raylib.h" - #include "world.h" #include "physics.h" #include "player.h" @@ -10,6 +9,7 @@ int main(void) { + // Let's make a window const int screenWidth = 1000; const int screenHeight = 600; @@ -20,27 +20,33 @@ int main(void) SetTargetFPS(60); + // Now we actually start the code InitWorld(); - printf("WrldBox Sandbox Started\n"); + printf("WrldBox engine started\n"); printf("Gravity = %.2f\n", g); + // until we close the window, expect inputs while (!WindowShouldClose()) { float dt = GetFrameTime(); if (IsKeyPressed(KEY_P)) { + // If it's simulating, stop simulating. If it isn't simulating, start simulating. isSimulating = !isSimulating; } if (IsKeyPressed(KEY_R)) { + // VERY complicated reset logic InitWorld(); } if (IsKeyPressed(KEY_Q)) { + // We're gonna have to rewrite the entity logic at some point. Because an actual game doesn't just contain a bunch of blocks. But whatever for now... + // Q key pressed? -> Poof, box, random position, random size, random color. SpawnEntity( GetRandomValue(50, 950), GetRandomValue(20, 150), @@ -57,6 +63,7 @@ int main(void) if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) { + // Spawn cube where the mouse is when it clicks! Vector2 m = GetMousePosition(); SpawnEntity( @@ -69,12 +76,14 @@ int main(void) if (isSimulating) { + // allow player to be controlled, fit everything within the size of the screen UpdatePlayerControls(); UpdateEntities(dt, screenWidth); simTime += dt; } + // UI shenanigans BeginDrawing(); ClearBackground(RAYWHITE); @@ -167,6 +176,7 @@ int main(void) EndDrawing(); } + // When the window wants to close, close it. What a surprise. CloseWindow(); return 0; }