// Load the tileset texture
const tilesetTexture = rl.LoadTexture("src/resources/green_tile.png");
defer rl.UnloadTexture(tilesetTexture);
// Main game loop
while (!rl.WindowShouldClose()) {
// Update
//----------------------------------------------------------------------------------
// TODO: Update game logic here
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
rl.BeginDrawing();
defer rl.EndDrawing();
rl.ClearBackground(rl.RAYWHITE);
for (comptime utils.i32Range(0, 16)) |x| {
for (comptime utils.i32Range(0, 3)) |y| {
// Define the source rectangle for the top face
const sourceRect = rl.Rectangle{
.x = 0,
.y = 0,
.width = tileWidth,
.height = tileHeight,
};
const isoCoords: rl.Vector2 = isoTransform(x, y);
// Define the destination rectangle for the top face (where to draw on screen)
const destRect = rl.Rectangle{
.x = isoCoords.x,
.y = isoCoords.y,
.width = tileWidth,
.height = tileHeight,
};
// Render the top face
rl.DrawTexturePro(tilesetTexture, sourceRect, destRect, rl.Vector2{ .x = 0, .y = 0 }, 0, rl.WHITE);
}
}
}
}```