2026-07-07 14:28:31 +07:00
|
|
|
#include "button.h"
|
2026-07-05 22:37:41 +07:00
|
|
|
#include "cube.h"
|
|
|
|
|
#include "player.h"
|
2026-07-06 13:12:17 +07:00
|
|
|
#include "raylib.h"
|
2026-07-04 17:07:43 +03:00
|
|
|
#include "screen.h"
|
2026-07-06 13:12:17 +07:00
|
|
|
#include <stddef.h>
|
|
|
|
|
#include <stdio.h>
|
2026-07-04 17:07:43 +03:00
|
|
|
|
2026-07-07 14:28:31 +07:00
|
|
|
Button button = {
|
|
|
|
|
.position = (Vector3){0.0f, 0.0f, 0.0f},
|
|
|
|
|
.length = 1.0f,
|
|
|
|
|
.height = 0.1f,
|
|
|
|
|
.color = BLUE,
|
|
|
|
|
.pressed = false,
|
|
|
|
|
};
|
|
|
|
|
|
2026-07-05 22:37:41 +07:00
|
|
|
Cube cube = {
|
|
|
|
|
.initialized = false,
|
2026-07-06 13:12:17 +07:00
|
|
|
.position = (Vector3){0.0f, 0.5f, 0.0f},
|
2026-07-07 14:28:31 +07:00
|
|
|
.edge = 0.8f,
|
2026-07-05 22:37:41 +07:00
|
|
|
.color = RED,
|
|
|
|
|
.wiresColor = BLACK,
|
|
|
|
|
.grabbed = false,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void DrawLevel00(Player *player)
|
2026-07-04 17:07:43 +03:00
|
|
|
{
|
2026-07-05 22:37:41 +07:00
|
|
|
if (!cube.initialized)
|
|
|
|
|
{
|
2026-07-07 14:28:31 +07:00
|
|
|
cube.model = LoadModelFromMesh(GenMeshCube(cube.edge, cube.edge, cube.edge));
|
2026-07-05 22:37:41 +07:00
|
|
|
cube.initialized = true;
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-04 17:07:43 +03:00
|
|
|
const int floorExtent = 25;
|
|
|
|
|
const float tileSize = 5.0f;
|
2026-07-05 22:37:41 +07:00
|
|
|
|
2026-07-05 12:42:34 +03:00
|
|
|
// Draw floor
|
2026-07-05 22:37:41 +07:00
|
|
|
for (int y = -floorExtent; y < floorExtent; y++)
|
|
|
|
|
{
|
|
|
|
|
for (int x = -floorExtent; x < floorExtent; x++)
|
|
|
|
|
{
|
|
|
|
|
if ((y & 1) ^ (x & 1))
|
|
|
|
|
{
|
2026-07-06 13:12:17 +07:00
|
|
|
DrawPlane((Vector3){x * tileSize, 0.0f, y * tileSize}, (Vector2){tileSize, tileSize}, LIGHTGRAY);
|
2026-07-05 22:37:41 +07:00
|
|
|
}
|
2026-07-04 17:07:43 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-06 13:12:17 +07:00
|
|
|
DrawCube((Vector3){-16.0f, 2.5f, 0.0f}, 1.0f, 5.0f, 32.0f, BLUE); // Draw a blue wall
|
|
|
|
|
DrawCube((Vector3){16.0f, 2.5f, 0.0f}, 1.0f, 5.0f, 32.0f, GREEN); // Draw a green wall
|
|
|
|
|
DrawCube((Vector3){0.0f, 2.5f, 16.0f}, 32.0f, 5.0f, 1.0f, YELLOW); // Draw a yellow wall
|
2026-07-05 22:37:41 +07:00
|
|
|
|
2026-07-06 13:12:17 +07:00
|
|
|
UpdateGrab(player, &cube); // Check if we grabbed a cube
|
2026-07-05 22:37:41 +07:00
|
|
|
|
2026-07-07 14:28:31 +07:00
|
|
|
MyDrawCube(&cube); // Draw a cube
|
|
|
|
|
DrawButton(&button, &cube); // Draw a button
|
2026-07-04 17:07:43 +03:00
|
|
|
}
|