Skip to content

Commit 5326b84

Browse files
committed
feat(JPro): add config to run game on the web and improved documentation
1 parent 5d7318f commit 5326b84

File tree

7 files changed

+149
-69
lines changed

7 files changed

+149
-69
lines changed

.idea/jarRepositories.xml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+24-10
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
# 📃 Table of content
1818

19+
- [🚀 Goal of the project](#-goal-of-the-project)
1920
- [🧑‍💻 Installation](#-installation)
2021
- [🛠 Installation on Windows / Linux](#-installation-on-windows--linux)
2122
- [🛠 Installation Locally](#-installation-locally)
@@ -25,10 +26,16 @@
2526
- [✍️ Licence](#️-licence)
2627
- [👨 Creators](#-creators)
2728

29+
# 🚀 Goal of the project
30+
31+
> [!NOTE]
32+
> I initially developed a very basic game in 2022 and created multiple issues to encourage contributions from the community. The main goal of this repository is not just to build a game, but to provide an open-source project where everyone can contribute step by step.
33+
2834
# 🧑‍💻 Installation
2935

30-
> Be aware to download the version of [Open JDK 21](https://jdk.java.net/archive/) before installing.
31-
> Run the command `java --version` to make sure it is installed.
36+
[!IMPORTANT]
37+
> Be aware to download the version of [Open JDK 21](https://jdk.java.net/archive/) before installing. I bet you can download any JDK you want, it just needs to be version 21.
38+
> Run the command `java --version` to make sure Java 21 is installed.
3239
3340
## 🛠 Installation on Windows / Linux
3441

@@ -43,13 +50,20 @@ $> java -jar dinosaur-exploder.jar
4350

4451
> You should not need to download [Java FX](https://openjfx.io/openjfx-docs/#introduction) and FXGL on your local computer because it should be downloaded when syncing the Maven project.
4552
46-
- To install our project locally, `fork` our repository, and in an empty directory,
53+
- To install the project locally, [`fork` our repository](https://github.com/jvondermarck/dinosaur-exploder/fork), and in an empty directory,
4754
type the following command to `clone` your fork :
4855

4956
```console
5057
$> git clone [email protected]: <user>/dinosaur-exploder.git
5158
```
5259

60+
- Make sure to sync the Maven project in your IDE (you could use IntelliJ IDEA)
61+
62+
- Run the game :
63+
- On your IDE : hit play on your IDE and select the `com.dinosaur.dinosaurexploder.DinosaurApp` target where it contains the main.
64+
- With an executable : generate a `jar` file with the command `mvn package` and then `java -jar target/dinosaur-exploder-1.0.jar`
65+
- On the web : run the command `mvn jpro:run` and the game should be available at `http://localhost:8080/`
66+
5367
# 🎮 How to Play
5468

5569
Play the game with these controls:
@@ -68,7 +82,8 @@ https://github.com/user-attachments/assets/9dbad492-b600-4a14-9367-11eef2a7834a
6882

6983
# 🙏Contributing
7084

71-
> We are very much open to contributions - please read our [code of conduct](https://github.com/jvondermarck/dinosaur-exploder/blob/main/CODE_OF_CONDUCT.md) and [contribution guidelines](https://github.com/jvondermarck/dinosaur-exploder/blob/main/CONTRIBUTING.md) first.
85+
> [!TIP]
86+
> I am very much open to contributions - please read our [code of conduct](https://github.com/jvondermarck/dinosaur-exploder/blob/main/CODE_OF_CONDUCT.md) and [contribution guidelines](https://github.com/jvondermarck/dinosaur-exploder/blob/main/CONTRIBUTING.md) first.
7287
7388
# 🌍 Support
7489

@@ -78,21 +93,20 @@ https://github.com/user-attachments/assets/9dbad492-b600-4a14-9367-11eef2a7834a
7893
- To be updated of everything, follow us on [Twitter](https://twitter.com/DinosaurExplod1).
7994
- You can post an article on our [Website blog](https://dinosaur-exploder.freecluster.eu/forum).
8095
- For quick communication, feel free to join our [Discord server](https://discord.com/invite/nkmCRnXbWm).
81-
- For any issues relating to harassment, please contact us on our [Mail]([email protected]).
8296

8397
# ✍️ Licence
8498

8599
> This project is licensed under the MIT License - see the [LICENSE.md](https://github.com/jvondermarck/dinosaur-exploder/blob/main/LICENSE) file for details.
86100
87-
# 👨 Creators
101+
# 👨 Author
88102

89-
<p align="center"> We are a group of three creators, but since 2023, Julien is taking care of everything.
103+
<p align="center"> At first we are a group of three creators (Dylan, Maxime and I), but since 2023, I am taking care of everything.
90104

91105
<table align="center">
92106
<tr>
93-
<th><img src="https://avatars.githubusercontent.com/u/62793491?v=4?size=115" width="115"><br><strong>@jvondermarck</strong></th>
107+
<th><img src="https://avatars.githubusercontent.com/u/62793491?v=4?size=115" width="115"><br><strong>@jvondermarck</strong></th>
94108
</tr>
95109
<tr align="center">
96-
<td><b>@jvondermarck</b> I am responsible for all aspects of the project, including project management, documentation, web development, and game programming.</td>
110+
<td>I am responsible for all aspects of the project, including project management, documentation, web development, and game programming.</td>
97111
</tr>
98-
</table>
112+
</table>

pom.xml

+77-59
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,24 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
56
<modelVersion>4.0.0</modelVersion>
6-
77
<groupId>com.dinosaur</groupId>
88
<artifactId>dinosaur-exploder</artifactId>
99
<version>1.0</version>
10-
1110
<properties>
1211
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1312
<source.version>11</source.version>
14-
15-
<!-- plugins -->
1613
<maven.compiler.version>3.8.0</maven.compiler.version>
1714
<maven.shade.version>3.0.0</maven.shade.version>
1815
<jfx.maven.plugin.version>0.0.6</jfx.maven.plugin.version>
19-
16+
<jpro.version>2025.1.0</jpro.version>
2017
<fxgl.version>21</fxgl.version>
2118
<junit.version>5.12.1</junit.version>
22-
2319
<mainClassName>com.dinosaur.dinosaurexploder.DinosaurApp</mainClassName>
20+
<mainClassJProName>com.dinosaur.dinosaurexploder.DinosaurWebApp</mainClassJProName>
2421
</properties>
25-
2622
<dependencies>
2723
<dependency>
2824
<groupId>com.github.almasb</groupId>
@@ -41,63 +37,85 @@
4137
<version>${junit.version}</version>
4238
<scope>test</scope>
4339
</dependency>
40+
<dependency>
41+
<groupId>one.jpro</groupId>
42+
<artifactId>jpro-webapi</artifactId>
43+
<version>${jpro.version}</version>
44+
<scope>compile</scope>
45+
</dependency>
4446
</dependencies>
45-
4647
<repositories>
4748
<repository>
4849
<id>oss.sonatype.org-snapshot</id>
4950
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
5051
</repository>
52+
<repository>
53+
<id>jpro - sandec repository</id>
54+
<url>https://sandec.jfrog.io/artifactory/repo</url>
55+
</repository>
5156
</repositories>
52-
57+
<pluginRepositories>
58+
<pluginRepository>
59+
<id>jpro - sandec repository</id>
60+
<url>https://sandec.jfrog.io/artifactory/repo</url>
61+
</pluginRepository>
62+
</pluginRepositories>
5363
<build>
5464
<plugins>
55-
<plugin>
56-
<artifactId>maven-compiler-plugin</artifactId>
57-
<version>${maven.compiler.version}</version>
58-
<configuration>
59-
<release>${source.version}</release>
60-
</configuration>
61-
</plugin>
62-
<plugin>
63-
<groupId>org.openjfx</groupId>
64-
<artifactId>javafx-maven-plugin</artifactId>
65-
<version>${jfx.maven.plugin.version}</version>
66-
<configuration>
67-
<stripDebug>true</stripDebug>
68-
<compress>2</compress>
69-
<noHeaderFiles>true</noHeaderFiles>
70-
<noManPages>true</noManPages>
71-
<launcher>Start-game</launcher>
72-
<jlinkImageName>game</jlinkImageName>
73-
<jlinkZipName>fxgl-game</jlinkZipName>
74-
<mainClass>${mainClassName}</mainClass>
75-
</configuration>
76-
</plugin>
77-
78-
<!-- Maven Shade Plugin for creating a fat JAR -->
79-
<plugin>
80-
<groupId>org.apache.maven.plugins</groupId>
81-
<artifactId>maven-shade-plugin</artifactId>
82-
<version>${maven.shade.version}</version>
83-
<executions>
84-
<execution>
85-
<phase>package</phase>
86-
<goals>
87-
<goal>shade</goal>
88-
</goals>
89-
<configuration>
90-
<createDependencyReducedPom>false</createDependencyReducedPom>
91-
<transformers>
92-
<!-- Add Main-Class to the manifest -->
93-
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
94-
<mainClass>${mainClassName}</mainClass>
95-
</transformer>
96-
</transformers>
97-
</configuration>
98-
</execution>
99-
</executions>
100-
</plugin>
101-
</plugins>
65+
<plugin>
66+
<artifactId>maven-compiler-plugin</artifactId>
67+
<version>${maven.compiler.version}</version>
68+
<configuration>
69+
<release>${source.version}</release>
70+
</configuration>
71+
</plugin>
72+
<plugin>
73+
<groupId>org.openjfx</groupId>
74+
<artifactId>javafx-maven-plugin</artifactId>
75+
<version>${jfx.maven.plugin.version}</version>
76+
<configuration>
77+
<stripDebug>true</stripDebug>
78+
<compress>2</compress>
79+
<noHeaderFiles>true</noHeaderFiles>
80+
<noManPages>true</noManPages>
81+
<launcher>Start-game</launcher>
82+
<jlinkImageName>game</jlinkImageName>
83+
<jlinkZipName>fxgl-game</jlinkZipName>
84+
<mainClass>${mainClassName}</mainClass>
85+
</configuration>
86+
</plugin>
87+
<!-- Maven Shade Plugin for creating a fat JAR -->
88+
<plugin>
89+
<groupId>org.apache.maven.plugins</groupId>
90+
<artifactId>maven-shade-plugin</artifactId>
91+
<version>${maven.shade.version}</version>
92+
<executions>
93+
<execution>
94+
<phase>package</phase>
95+
<goals>
96+
<goal>shade</goal>
97+
</goals>
98+
<configuration>
99+
<createDependencyReducedPom>false</createDependencyReducedPom>
100+
<transformers>
101+
<!-- Add Main-Class to the manifest -->
102+
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
103+
<mainClass>${mainClassName}</mainClass>
104+
</transformer>
105+
</transformers>
106+
</configuration>
107+
</execution>
108+
</executions>
109+
</plugin>
110+
<!-- JPro to run game on the browser -->
111+
<plugin>
112+
<groupId>one.jpro</groupId>
113+
<artifactId>jpro-maven-plugin</artifactId>
114+
<version>${jpro.version}</version>
115+
<configuration>
116+
<mainClassName>${mainClassJProName}</mainClassName>
117+
</configuration>
118+
</plugin>
119+
</plugins>
102120
</build>
103121
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.dinosaur.dinosaurexploder;
2+
3+
import com.almasb.fxgl.app.GameApplication;
4+
import com.jpro.webapi.JProApplication;
5+
import javafx.stage.Stage;
6+
import javafx.scene.Scene;
7+
import javafx.scene.layout.StackPane;
8+
9+
public class DinosaurWebApp extends JProApplication {
10+
11+
@Override
12+
public void start(Stage stage) {
13+
System.setProperty("fxgl.isBrowser", "true");
14+
15+
GameApplication app = new DinosaurApp();
16+
var fxglRoot = GameApplication.embeddedLaunch(app);
17+
18+
stage.setScene(new Scene(new StackPane(fxglRoot)));
19+
}
20+
21+
public static void main(String[] args) {
22+
launch(args);
23+
}
24+
}

src/main/java/module-info.java

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module com.dinosaur.dinosaurexploder {
22
requires javafx.controls;
33
requires com.almasb.fxgl.all;
4+
requires jpro.webapi;
45

56
exports com.dinosaur.dinosaurexploder;
67

src/main/resources/jpro.conf

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
jpro.applications {
2+
//jpro apps
3+
"hellojpro" = com.dinosaur.dinosaurexploder.DinosaurWebApp
4+
}
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Dinosaur Exploder</title>
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
6+
<link rel="stylesheet" type="text/css" href="/jpro/css/jpro-fullscreen.css">
7+
<link rel="stylesheet" type="text/css" href="/jpro/css/jpro.css">
8+
<script src="/jpro/js/jpro.js" type="text/javascript"></script>
9+
</head>
10+
<body>
11+
<h1>Dinosaur exploder</h1>
12+
<jpro-app href="/app/hellojpro" fullscreen="true"></jpro-app>
13+
</body>
14+
</html>

0 commit comments

Comments
 (0)