La punanay

This commit is contained in:
Nabil Ould Hamou 2024-10-14 22:15:14 +02:00
parent 8cc8dfc0b1
commit 805f2f11fe

View file

@ -1,3 +1,4 @@
import com.raylib.Jaylib;
import logique.Maze; import logique.Maze;
import logique.Population; import logique.Population;
@ -10,7 +11,7 @@ import static com.raylib.Jaylib.RAYWHITE;
public class Main { public class Main {
public static void main(String[] args) { public static void main(String[] args) {
InitWindow(500, 500, "Labyrinthe"); InitWindow(500, 600, "Labyrinthe");
SetTargetFPS(100); SetTargetFPS(100);
@ -26,6 +27,21 @@ public class Main {
BeginDrawing(); BeginDrawing();
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
// Draw UI
DrawText("Generation: 1", 10, 510, 24, BLACK);
Jaylib.Rectangle r1 = new Jaylib.Rectangle(200, 510, 150, 25);
int btn = GuiButton(r1, "Next generation");
GuiSetStyle(btn, TEXT_SIZE, 16);
Jaylib.Rectangle r2 = new Jaylib.Rectangle(200, 550, 150, 25);
int btn2 = GuiButton(r2, "Replay");
GuiSetStyle(btn2, TEXT_SIZE, 16);
if (btn == 1) {
System.out.println("next gen?");
}
// Draw Maze
for (int i = 0; i < Maze.MAZE[0].length; i++) { for (int i = 0; i < Maze.MAZE[0].length; i++) {
for (int j = 0; j < Maze.MAZE.length; j++) { for (int j = 0; j < Maze.MAZE.length; j++) {
if (Maze.MAZE[j][i] == 1) { if (Maze.MAZE[j][i] == 1) {
@ -40,8 +56,6 @@ public class Main {
moves.removeFirst(); moves.removeFirst();
lastTime = System.currentTimeMillis(); lastTime = System.currentTimeMillis();
} }
DrawFPS(20, 20);
EndDrawing(); EndDrawing();
} }