add towers

This commit is contained in:
2026-07-03 20:17:31 +03:00
parent 6950ed818f
commit 55a1f6917e
3 changed files with 45 additions and 2 deletions
+2
View File
@@ -1 +1,3 @@
build/ build/
.cache/
compile_commands.json
+1 -1
View File
@@ -1,4 +1,4 @@
build/game: build/game: src/*
mkdir -p build mkdir -p build
gcc -o build/game src/* \ gcc -o build/game src/* \
-I./raylib-6.0_linux_amd64/include \ -I./raylib-6.0_linux_amd64/include \
+42 -1
View File
@@ -1,15 +1,56 @@
#include "raylib.h" #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);
}
int main() int main()
{ {
InitWindow(800, 600, "Super cool game"); InitWindow(800, 600, "Super cool game");
SetTargetFPS(60); SetTargetFPS(60);
Camera3D camera = { 0 };
camera.position = (Vector3){ 10.0f, 10.0f, 10.0f };
camera.target = (Vector3){ 0.0f, 12.0f, 0.0f };
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
camera.fovy = 60.0f;
camera.projection = CAMERA_PERSPECTIVE;
while (!WindowShouldClose()) { while (!WindowShouldClose()) {
UpdateCamera(&camera, CAMERA_FREE);
DisableCursor();
if(IsKeyPressed(KEY_Z)) camera.target = (Vector3){0.0f, 0.0f, 0.0f};
BeginDrawing(); BeginDrawing();
ClearBackground(RED); ClearBackground(RAYWHITE);
BeginMode3D(camera);
DrawGrid(20, 10.0f);
DrawLevel();
EndMode3D();
DrawFPS(10, 10);
EndDrawing(); EndDrawing();
} }
CloseWindow(); CloseWindow();
return 0;
} }