-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathgame.xml
238 lines (207 loc) · 9.27 KB
/
game.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<!--
Welcome into MarteEngine ant Game buildfile. For more information about ant see http://ant.apache.org/
Main objective of this build configuration is to distribute your game as:
- lwjgl applet
- fatjar
- webstart
-->
<project name="Game Distribution" basedir="." default="webstart">
<taskdef name="jnlp" classname="com.orangevolt.tools.ant.JNLPTask">
<classpath location="./external/jnlp-ant-task.jar"/>
</taskdef>
<!-- Game properties, don't use spaces in game.name -->
<property name="game.name" value="game-name"/>
<property name="game.main.class" value="main.java.it.marteEngine.test.fuzzy.FuzzyMain"/>
<property name="game.java.version" value="1.7"/>
<property name="webstart.title" value="game-name"/>
<property name="webstart.description" value="Platformer test game"/>
<property name="webstart.vendor" value="your name"/>
<property name="webstart.homepage" value="http://yourwebsite.com"/>
<!-- To run webstart online, change . to the location of the jnlp file on your website. -->
<property name="webstart.codebase" value="."/>
<property name="applet.title" value="${game.name}"/>
<property name="applet.width" value="800"/>
<property name="applet.height" value="600"/>
<property name="src.dir" value="src"/>
<property name="res.dir" value="data"/>
<property name="lib.dir" value="lib"/>
<property name="dist.dir" value="dist"/>
<property name="build.dir" value="bin"/>
<property name="keystore.file.name" value="${user.home}/.keystore"/>
<path id="build.path">
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</path>
<target name="clean" description="Clean distribution and output directories">
<delete includeEmptyDirs="true" failonerror="false" quiet="true">
<fileset dir="${build.dir}"/>
<fileset dir="${dist.dir}"/>
</delete>
<fail message="Unable to delete previous build directories">
<condition>
<or>
<available file="${dist.dir}" type="dir"/>
<available file="${build.dir}" type="dir"/>
</or>
</condition>
</fail>
</target>
<target name="dir" depends="clean" description="Create directories">
<mkdir dir="${build.dir}"/>
<mkdir dir="${dist.dir}"/>
</target>
<target name="compile" depends="dir" description="Compile source code">
<javac srcdir="${src.dir}"
destdir="${build.dir}"
classpathref="build.path"
includeantruntime="false"
debug="on"
fork="true"
source="${game.java.version}"
target="${game.java.version}">
</javac>
</target>
<target name="jar-source" depends="compile" description="Create distribution jar">
<!-- Jar the compiled source -->
<jar destfile="${dist.dir}/${game.name}.jar">
<fileset dir="${build.dir}"/>
</jar>
<!-- Delete the compiled source files -->
<delete dir="${build.dir}" includeEmptyDirs="true" quiet="true"/>
</target>
<target name="jar-resources" description="Jar and copy the resources to dist as resources.jar">
<!-- Copy the resources, maintaining the directory structure res.dir is the root directory. -->
<copy todir="${dist.dir}/tmp/${res.dir}">
<fileset dir="${res.dir}"/>
</copy>
<!-- jar and delete the resource files -->
<jar destfile="${dist.dir}/resources.jar" basedir="${dist.dir}/tmp/"/>
<delete dir="${dist.dir}/tmp" includeEmptyDirs="true" quiet="true"/>
</target>
<target name="webstart" depends="jar-source, jar-resources" description="Deploy as jnlp webstart">
<!--
Copy all required jars from lib to dist
Skip jars already provided by the slick extension
-->
<copy todir="${dist.dir}">
<fileset dir="${lib.dir}" includes="*.jar">
<exclude name="slick.jar"/>
<exclude name="ibxm.jar"/>
<exclude name="jogg-0.0.7.jar"/>
<exclude name="jorbis-0.0.15.jar"/>
<exclude name="lwjgl.jar"/>
<exclude name="lwjgl_util.jar"/>
<exclude name="jinput.jar"/>
</fileset>
</copy>
<!-- Sign all the jars in the dist dir -->
<antcall target="signjars"/>
<!--
Use the JNLPTask to create a jnlp file
see http://ovanttasks.sourceforge.net/rat/chapter-N104F5.html
-->
<jnlp tofile="${dist.dir}/${game.name}.jnlp" codebase="${webstart.codebase}">
<information>
<title>${webstart.title}</title>
<vendor>${webstart.vendor}</vendor>
<homepage href="${webstart.homepage}"/>
<description kind="short">${webstart.description}</description>
<shortcut online="true">
<desktop />
</shortcut>
</information>
<security>
<all_permissions/>
</security>
<resources>
<jar>
<fileset dir="${dist.dir}">
<include name="*.jar"/>
</fileset>
</jar>
<extension href="http://slick.cokeandcode.com/demos/slick.jnlp"/>
</resources>
<application_desc main_class="${game.main.class}"/>
</jnlp>
</target>
<target name="applet" depends="jar-source, jar-resources" description="Create a lwjgl Applet">
<!--
Copy all required jars from lib to dist
Skip jars already provided by the lwjgl applet
-->
<copy todir="${dist.dir}">
<fileset dir="${lib.dir}" includes="*.jar">
<exclude name="jinput.jar"/>
</fileset>
</copy>
<!-- Sign all the jars in the dist dir -->
<antcall target="signjars"/>
<!-- Separate each jar file name by a ',' and store in game_jars -->
<fileset id="game_jars_fileset" dir="${dist.dir}" includes="*.jar"/>
<pathconvert pathsep=", " property="game_jars" refid="game_jars_fileset">
<mapper type="flatten"/>
</pathconvert>
<!-- Copy the lwjgl applet launcher + natives to dist -->
<copy todir="${dist.dir}">
<fileset dir="external/lwjglApplet">
<include name="*.lzma"/>
<include name="*.jar"/>
</fileset>
</copy>
<copy file="external/lwjglApplet/appletloader.html" tofile="${dist.dir}/appletloader.html">
<filterchain>
<replacetokens>
<token key="title" value="${applet.title}"/>
<token key="game_name" value="${game.name}"/>
<token key="width" value="${applet.width}"/>
<token key="height" value="${applet.height}"/>
<token key="mainclass" value="${game.main.class}"/>
<token key="game_jars" value="${game_jars}"/>
</replacetokens>
</filterchain>
</copy>
</target>
<target name="fatjar" description="Prepare jar files to be used with the fatjar tool."
depends="jar-source, jar-resources">
<!-- Copy all required jars from lib to dist -->
<copy todir="${dist.dir}">
<fileset dir="${lib.dir}" includes="*.jar"/>
</copy>
</target>
<target name="signjars" depends="create-keystore"
description="Sign's all the jars in the dist dir">
<input message="Username:" addproperty="keystore.username" defaultvalue="${user.name}"/>
<input message="Password:" addproperty="keystore.pass"/>
<signjar keystore="${keystore.file.name}"
storepass="${keystore.pass}"
alias="${keystore.username}"
preservelastmodified="true">
<path>
<fileset dir="${dist.dir}" includes="*.jar"/>
</path>
</signjar>
</target>
<target name="create-keystore" depends="check-for-keystore" unless="keystore.present"
description="Create a key store, unless it already exists">
<input message="Keystore Username:" addproperty="keystore.username"/>
<input message="Keystore Password:" addproperty="keystore.pass"/>
<input message="City/Location:" addproperty="keystore.location"/>
<input message="2 Letter Country code:" addproperty="keystore.country"/>
<genkey keystore="${keystore.file.name}"
alias="${keystore.username}"
storepass="${keystore.pass}">
<dname>
<param name="CN" value="${keystore.username}"/>
<param name="OU" value=""/>
<param name="O" value=""/>
<param name="L" value="${keystore.location}"/>
<param name="ST" value=""/>
<param name="C" value="${keystore.country}"/>
</dname>
</genkey>
</target>
<target name="check-for-keystore" description="Determines whether the keystore exists.">
<available file="${keystore.file.name}" type="file" property="keystore.present"/>
</target>
</project>