Skip to content

Commit c003bc5

Browse files
committed
JETRIS Version 1.2
- Add Launch4J configuration and a new Gradle taks launch4j for generating an Windows exe file - Use a Gradle plugin to create MAC OS X app package and a dmg file - Remove the publish HiScores functionality, as it did not work - Remove the webapp source folder, since there is no web page anymore - Small code improvements - Update Gradle wrapper to version 2.5 - Update the documentation
1 parent 0515934 commit c003bc5

25 files changed

+172
-97
lines changed

CHANGES.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
2015-08-06
1+
2015-08-07
22
----------
33
* JETRIS Version 1.2
4-
* Add Launch4J configuration
4+
* Add Launch4J configuration and a new Gradle taks launch4j for generating an Windows exe file
5+
* Use a Gradle plugin to create MAC OS X app package and a dmg file
56
* Remove the publish HiScores functionality, as it did not work
67
* Remove the webapp source folder, since there is no web page anymore
8+
* Small code improvements
9+
* Update Gradle wrapper to version 2.5
10+
* Update the documentation
711

812
2015-08-05
913
----------

JETRIS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22

3-
java -jar build/libs/jetris.jar
3+
java -jar build/libs/jetris-1.2.jar -Xdock:name="JETRIS"
44

JETRIS.DAT

5 Bytes
Binary file not shown.

JETRIS.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
rem Batch file to run JETRIS on Windows
22

3-
start javaw -jar build\libs\JETRIS.jar
3+
start javaw -jar build\libs\jetris-1.2.jar
44

README.md

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
# Jetris - A Java-Based Tetris Clone
1+
# JETRIS - A Java-Based Tetris Clone
22

33
## TL;DR
44

5-
Jetris is a Java-based Tetris clone for the desktop. Jetris is focused on a fast gaming, so a game usually takes about 10 min.
5+
JETRIS is a Java-based Tetris clone for the desktop. JETRIS is focused on a fast gaming, so a game usually takes about 10 min.
66

77
![](screenshot.png?raw=true)
88

99
### This Readme includes:
1010

1111
1. System Requirements
1212
2. How to Build JETRIS
13+
* How to build an Windows EXE
14+
* How to build a Mac OS APP and DMG
15+
* How to extend JETRIS
1316
3. Running JETRIS on Your System
1417
4. How to Play
1518
5. Scoring System
@@ -20,11 +23,11 @@ Jetris is a Java-based Tetris clone for the desktop. Jetris is focused on a fast
2023

2124
JETRIS is written in the JAVA programming language, this means that it can be run on any Operating System which has JAVA Runtime Environment (JRE).
2225

23-
You need JRE 1.6.0 or above. You can download JRE for free at www.java.com
26+
You need JRE 1.7.0 or above. You can download JRE for free at www.java.com
2427

2528
2. How to Build JETRIS
2629
----------------------
27-
If you want to build JETRIS on your local machine you need to install the Java Development Kit (JDK). You need JDK 1.6.0 or above.
30+
If you want to build JETRIS on your local machine you need to install the Java Development Kit (JDK). You need JDK 1.7.0 or above.
2831

2932
JETRIS uses the Gradle build system, you can build the project locally just by typing the following in the console:
3033

@@ -37,20 +40,53 @@ On Windows use:
3740
./gradlew.bat build
3841
```
3942

40-
The generated jar file can be found in the folder _build/libs_
43+
The generated jar file can be found in the folder _build/libs_.
44+
45+
### How to build an Windows EXE
46+
The Gradle build script provides a way to build an Windows executable. You can even do this on a non-Windows machine. For that purpose you need an external application called
47+
[Launch4j](http://launch4j.sourceforge.net/). Download it and install it on your local machine. The version used to test this feature is 3.8, but it will probably work with
48+
other versions too. In addition to this, you need to create an environment variable called `LAUNCH4J_HOME` which points to the folder where you have installed the application.
49+
50+
After that you can build the exe file by running:
51+
```
52+
./gradlew launch4j
53+
```
54+
55+
The generated exe file can be found in the folder _build/launch4j_.
56+
57+
### How to build a Mac OS APP and DMG
58+
The JETRIS Gradle build script uses [MacAppBundle Plugin](https://github.com/crotwell/gradle-macappbundle) to generate Mac OS X app packages _and_ a _dmg_ distribution file.
59+
This is done automatically with each Gradle build.
60+
61+
The generated app package can be found in the folder _build/macApp_ and the dmg file in _build/distributions_.
62+
63+
### How to extend JETRIS
64+
If you want to import the project in an IDE such as Eclipse or IntelliJ IDEA then Gradle provides a way to generate all the necessary project files.
65+
66+
Generate Eclipse project:
67+
```
68+
./gradlew eclipse
69+
```
70+
71+
Generate IntelliJ IDEA project:
72+
```
73+
./gradlew idea
74+
```
4175

4276
3. Running JETRIS on Your System
4377
--------------------------------
4478

4579
To start JETRIS try one of the following options:
4680

47-
* Double click on the JAR File to start JETRIS. If this didn't work, then you didn't associate your JAR Files with your JRE.
81+
* Double click on the JAR File to start JETRIS. If this didn't work, then you didn't associate your JAR Files with your JRE.
82+
83+
* For Windows users we also provide an exe file, which ist just a wrapper for the JAR file. Double click on the exe file to start the application.
4884

49-
* Double click on JETRIS.bat for Windows users or on JETRIS for Linux/OS X users.
85+
* Double click on `JETRIS.bat` for Windows users or on `JETRIS` for Linux users. This will start the application, but only if you have built it with Gradle first.
5086

5187
* Open the console go to your JETRIS folder and type:
5288
```
53-
java -jar JETRIS.jar
89+
java -jar jetris-1.2.jar
5490
```
5591

5692
4. How to Play
@@ -83,4 +119,4 @@ The current level is 20 (the highest level) and You clear 4 Lines at once, then
83119
6. Saving Your Old HiScores
84120
---------------------------
85121

86-
Copy the old JETRIS.dat File to your new version of Jetris folder.
122+
Copy the old `JETRIS.DAT` File to your new version of JETRIS folder.

build.gradle

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,58 @@
1-
apply plugin: 'java'
2-
apply plugin: 'eclipse'
3-
apply plugin: 'idea'
1+
plugins {
2+
id 'java'
3+
id "edu.sc.seis.macAppBundle" version "2.1.1"
4+
id 'eclipse'
5+
id 'idea'
6+
}
47

58
task wrapper(type: Wrapper) {
6-
gradleVersion = '2.4.0'
9+
gradleVersion = '2.5'
710
}
811

9-
// Keep this in sync with JetrisMainFrame.NAME
12+
// Keep this in sync with GV.VERSION
1013
version='1.2'
1114

12-
repositories {
13-
mavenCentral()
14-
}
15-
1615
sourceCompatibility = 1.7
1716
targetCompatibility = 1.7
1817

1918
jar {
2019
manifest {
21-
attributes 'Main-Class': 'JetrisMain'
20+
attributes 'Implementation-Title': 'JETRIS',
21+
'Implementation-Version': version,
22+
'Main-Class': "JetrisMain"
2223
}
2324
}
2425

25-
// Windows wrapper configuration to generate "jetris.exe" //
26+
macAppBundle {
27+
mainClassName = "JetrisMain"
28+
icon = "src/main/resources/osx/jetris.icns"
29+
bundleJRE = false
30+
javaProperties.put("apple.laf.useScreenMenuBar", "true")
31+
}
32+
33+
// Windows wrapper configuration to generate "jetris.exe"
2634
task launch4jConfig(type: Copy) {
27-
from 'src/main/resources/launch4j.xml'
35+
from 'src/main/resources/launch4j/launch4j.xml'
2836
into 'build/launch4j'
2937
expand(
3038
JAR_FILE: project.jar.archivePath,
3139
VERSION: project.version,
32-
ICON: file('src/main/resources/jetris.ico')
40+
ICON: file('src/main/resources/launch4j/jetris.ico')
3341
)
3442
}
3543

36-
build.dependsOn 'launch4jConfig'
44+
task launch4j(type: Exec, dependsOn: [':jar', ':launch4jConfig']) {
45+
def launch4jCfg = file('build/launch4j/launch4j.xml')
46+
def isWindows = System.properties['os.name'].startsWith('Windows')
47+
def launch4jDir = System.getenv('LAUNCH4J_HOME')
48+
49+
if (launch4jDir == null || !(new File(launch4jDir).exists())) {
50+
throw new GradleException("'LAUNCH4J_HOME' not defined or invalid. Launch4j (http://launch4j.sourceforge.net) is required to generare the JETRIS Windows EXE file.")
51+
}
52+
53+
if (isWindows) {
54+
commandLine 'cmd', '/c', launch4jDir + "/launch4j.exe", launch4jCfg
55+
} else {
56+
commandLine launch4jDir + "/launch4j", launch4jCfg
57+
}
58+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Mon Aug 03 08:24:05 CEST 2015
1+
#Fri Aug 07 05:42:51 CEST 2015
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-bin.zip

gradlew

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,3 @@ eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162162
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163163

164164
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165-

gradlew.bat

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,3 @@ exit /b 1
8888
if "%OS%"=="Windows_NT" endlocal
8989

9090
:omega
91-

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'JETRIS'

0 commit comments

Comments
 (0)