diff --git a/src/level00.c b/src/level00.c new file mode 100644 index 0000000..ffd2f7f --- /dev/null +++ b/src/level00.c @@ -0,0 +1,34 @@ +#include "raylib.h" +#include "screen.h" + +void DrawLevel00() +{ + const int floorExtent = 25; + const float tileSize = 5.0f; + + for (int y = -floorExtent; y < floorExtent; y++) { + for (int x = -floorExtent; x < floorExtent; x++) { + if ((y & 1) ^ (x & 1)) { + DrawPlane((Vector3){ x*tileSize, 0.0f, y*tileSize}, (Vector2){ tileSize, tileSize }, LIGHTGRAY); + } + } + } + + const Vector3 towerSize = (Vector3){ 16.0f, 32.0f, 16.0f }; + + Vector3 towerPos = (Vector3){ 16.0f, 16.0f, 16.0f }; + DrawCubeV(towerPos, towerSize, RED); + DrawCubeWiresV(towerPos, towerSize, BLACK); + + towerPos.x *= -1; + DrawCubeV(towerPos, towerSize, RED); + DrawCubeWiresV(towerPos, towerSize, BLACK); + + towerPos.z *= -1; + DrawCubeV(towerPos, towerSize, RED); + DrawCubeWiresV(towerPos, towerSize, BLACK); + + towerPos.x *= -1; + DrawCubeV(towerPos, towerSize, RED); + DrawCubeWiresV(towerPos, towerSize, BLACK); +} diff --git a/src/main.c b/src/main.c index 888b4bd..224f618 100644 --- a/src/main.c +++ b/src/main.c @@ -1,30 +1,10 @@ #include "raylib.h" - -static void DrawLevel() -{ - const Vector3 towerSize = (Vector3){ 16.0f, 32.0f, 16.0f }; - - Vector3 towerPos = (Vector3){ 16.0f, 16.0f, 16.0f }; - DrawCubeV(towerPos, towerSize, RED); - DrawCubeWiresV(towerPos, towerSize, BLACK); - - towerPos.x *= -1; - DrawCubeV(towerPos, towerSize, RED); - DrawCubeWiresV(towerPos, towerSize, BLACK); - - towerPos.z *= -1; - DrawCubeV(towerPos, towerSize, RED); - DrawCubeWiresV(towerPos, towerSize, BLACK); - - towerPos.x *= -1; - DrawCubeV(towerPos, towerSize, RED); - DrawCubeWiresV(towerPos, towerSize, BLACK); -} +#include "screen.h" int main() { InitWindow(800, 600, "Super cool game"); - SetTargetFPS(60); + SetTargetFPS(GAME_FPS); Camera3D camera = { 0 }; camera.position = (Vector3){ 10.0f, 10.0f, 10.0f }; @@ -41,8 +21,7 @@ int main() ClearBackground(RAYWHITE); BeginMode3D(camera); - DrawGrid(20, 10.0f); - DrawLevel(); + DrawLevel00(); EndMode3D(); DrawFPS(10, 10); diff --git a/src/screen.h b/src/screen.h new file mode 100644 index 0000000..3608cab --- /dev/null +++ b/src/screen.h @@ -0,0 +1,8 @@ +#ifndef SCREEN_H +#define SCREEN_H + +#define GAME_FPS 60 + +void DrawLevel00(); + +#endif