initial commit

master
rocaly 2 months ago
commit 63a50259cb

38
.gitignore vendored

@ -0,0 +1,38 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
.idea/
*.iws
*.iml
*.ipr
.mvn/
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.uca.towerdefense</groupId>
<artifactId>towerdefense</artifactId>
<version>1.0-SNAPSHOT</version>
<name>towerdefense-jfx</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>5.10.2</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>17.0.6</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>17.0.6</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<executions>
<execution>
<!-- Default configuration for running with: mvn clean javafx:run -->
<id>default-cli</id>
<configuration>
<mainClass>
fr.uca.towerdefense.towerdefense/fr.uca.towerdefense.TowerDefenseApplication
</mainClass>
<launcher>app</launcher>
<jlinkZipName>app</jlinkZipName>
<jlinkImageName>app</jlinkImageName>
<noManPages>true</noManPages>
<stripDebug>true</stripDebug>
<noHeaderFiles>true</noHeaderFiles>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,24 @@
package fr.uca.towerdefense;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.io.IOException;
public class TowerDefenseApplication extends Application {
@Override
public void start(Stage stage) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(TowerDefenseApplication.class.getResource("/fxml/tower-game.fxml"));
Scene scene = new Scene(fxmlLoader.load());
scene.getStylesheets().add(this.getClass().getResource("/fxml/tower-game.css").toExternalForm());
stage.setTitle("Tower Defense - UCA Edition");
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch();
}
}

@ -0,0 +1,6 @@
package fr.uca.towerdefense.constants;
public class TowerDefenseConstants {
public static int CANVAS_WIDTH = 700;
public static int CANVAS_HEIGHT = 700;
}

@ -0,0 +1,19 @@
package fr.uca.towerdefense.view.controllerFxml;
import fr.uca.towerdefense.constants.TowerDefenseConstants;
import javafx.fxml.FXML;
import javafx.scene.canvas.Canvas;
public class TowerDefenseController {
@FXML
private Canvas canvas;
public void initialize() {
canvas.setWidth(TowerDefenseConstants.CANVAS_WIDTH);
canvas.setHeight(TowerDefenseConstants.CANVAS_HEIGHT);
}
}

@ -0,0 +1,10 @@
module fr.uca.towerdefense {
requires javafx.controls;
requires javafx.fxml;
requires java.desktop;
opens fr.uca.towerdefense to javafx.fxml;
opens fr.uca.towerdefense.view.controllerFxml to javafx.fxml;
exports fr.uca.towerdefense;
}

@ -0,0 +1,11 @@
.topBar {
-fx-background-color: black;
-fx-pref-height: 40;
-fx-padding: 0 10 0 100;
}
.leftBar {
-fx-background-color: black;
-fx-pref-width: 100;
}

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.canvas.Canvas?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.VBox?>
<BorderPane xmlns:fx="http://javafx.com/fxml"
fx:controller="fr.uca.towerdefense.view.controllerFxml.TowerDefenseController">
<top>
<HBox styleClass="topBar" alignment="CENTER_LEFT">
<Label text="Tower Defense"/>
</HBox>
</top>
<left>
<VBox styleClass="leftBar" alignment="TOP_CENTER" spacing="20">
</VBox>
</left>
<center>
<Pane fx:id="gamePane">
<Canvas fx:id="canvas"/>
</Pane>
</center>
</BorderPane>
Loading…
Cancel
Save