add floor

This commit is contained in:
2026-07-04 17:07:43 +03:00
parent 700ccaeff0
commit d146abbc05
3 changed files with 45 additions and 24 deletions
+34
View File
@@ -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);
}
+3 -24
View File
@@ -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);
+8
View File
@@ -0,0 +1,8 @@
#ifndef SCREEN_H
#define SCREEN_H
#define GAME_FPS 60
void DrawLevel00();
#endif