migration to new JMonkey Engine

This commit is contained in:
Chris@DESKTOP-4T2L6FG 2017-06-28 17:15:33 +02:00
parent e2f0b72331
commit fb0d6f9d08
52 changed files with 868 additions and 182 deletions

View File

@ -28,7 +28,7 @@
<property name="scrollAreaPadding" type="float" value="0" /> <property name="scrollAreaPadding" type="float" value="0" />
</attributes> </attributes>
<images> <images>
<property name="defaultImg" type="String" value="Gui/Window/panel_x_inner.png" /> <property name="defaultImg" type="String" value="Gui/Window/panel_x.png" />
</images> </images>
<effects></effects> <effects></effects>
</element> </element>
@ -62,11 +62,12 @@
</property> </property>
<property name="useBtnUpArrowIcon" type="boolean" value="true" /> <property name="useBtnUpArrowIcon" type="boolean" value="true" />
<property name="useBtnDownArrowIcon" type="boolean" value="true" /> <property name="useBtnDownArrowIcon" type="boolean" value="true" />
<property name="gap" type="float" value="0" />
</attributes> </attributes>
<images> <images>
<property name="trackImg" type="String" value="Gui/Scrolling/scroll_track_x.png" /> <property name="trackImg" type="String" value="Gui/Scrolling/scroll_track_x.png" />
<property name="thumbImg" type="String" value="Gui/Button/buttonTransparent.png" /> <property name="thumbImg" type="String" value="Gui/Scrolling/thumb.png" />
<property name="thumbHoverImg" type="String" value="Gui/Button/buttonTransparentHover.png" /> <property name="thumbHoverImg" type="String" value="Gui/Scrolling/thumbHover.png" />
<property name="btnUpImg" type="String" value="Gui/Button/buttonTransparent.png" /> <property name="btnUpImg" type="String" value="Gui/Button/buttonTransparent.png" />
<property name="btnUpHoverImg" type="String" value="Gui/Button/buttonTransparentHover.png" /> <property name="btnUpHoverImg" type="String" value="Gui/Button/buttonTransparentHover.png" />
<property name="btnDownImg" type="String" value="Gui/Button/buttonTransparent.png" /> <property name="btnDownImg" type="String" value="Gui/Button/buttonTransparent.png" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 B

View File

@ -0,0 +1,154 @@
<?xml version="1.0" encoding="UTF-8"?>
<root>
<element name="Table">
<font>
</font>
<attributes>
<property name="highlightColor" type="ColorRGBA">
<r value="0.7" />
<g value="0.7" />
<b value="0.7" />
<a value="0.5" />
</property>
<property name="resizeBorders" type="Vector4f">
<x value="14" />
<y value="14" />
<z value="14" />
<w value="14" />
</property>
<property name="minSize" type="Vector2f">
<x value="150" />
<y value="50" />
</property>
<property name="defaultSize" type="Vector2f">
<x value="350" />
<y value="200" />
</property>
<property name="tablePadding" type="float" value="4" />
<property name="headerGap" type="float" value="0" />
</attributes>
<images>
<property name="defaultImg" type="String" value="Gui/Window/panel_x.png" />
</images>
<effects>
</effects>
</element>
<element name="Table#Row">
<font>
</font>
<attributes>
<property name="defaultSize" type="Vector2f">
<x value="100" />
<y value="24" />
</property>
<property name="resizeBorders" type="Vector4f">
<x value="0" />
<y value="0" />
<z value="0" />
<w value="0" />
</property>
</attributes>
<images>
</images>
<effects>
</effects>
</element>
<element name="Table#Header">
<font>
<property name="fontSize" type="float" value="20" />
<property name="fontColor" type="ColorRGBA">
<r value="1" />
<g value="1" />
<b value="1" />
<a value="1" />
</property>
<property name="textAlign" type="String" value="Center" />
<property name="textVAlign" type="String" value="Center" />
<property name="textWrap" type="String" value="Word" />
<property name="textPadding" type="float" value="0" />
</font>
<attributes>
<property name="defaultSize" type="Vector2f">
<x value="200" />
<y value="50" />
</property>
<property name="resizeBorders" type="Vector4f">
<x value="5" />
<y value="5" />
<z value="5" />
<w value="5" />
</property>
<property name="hoverColor" type="ColorRGBA">
<r value="1.0" />
<g value="1.0" />
<b value="1.0" />
<a value="1.0" />
</property>
<property name="pressedColor" type="ColorRGBA">
<r value="0.6" />
<g value="0.6" />
<b value="0.6" />
<a value="1.0" />
</property>
<property name="arrowSize" type="Vector2f">
<x value="20" />
<y value="20" />
</property>
</attributes>
<images>
<property name="defaultImg" type="String" value="Gui/Scrolling/thumb.png" />
<property name="hoverImg" type="String" value="Gui/Scrolling/thumbHover.png" />
<property name="arrowUpImg" type="String" value="tonegod/gui/style/def/Common/Arrows/arrow_up.png" />
<property name="arrowDownImg" type="String" value="tonegod/gui/style/def/Common/Arrows/arrow_down.png" />
<property name="noArrowImg" type="String" value="tonegod/gui/style/def/Blank.png" />
</images>
<effects>
</effects>
</element>
<element name="Table#Cell">
<font>
<property name="fontSize" type="float" value="20" />
<property name="fontColor" type="ColorRGBA">
<r value="0.8" />
<g value="0.8" />
<b value="0.8" />
<a value="1.0" />
</property>
<property name="textAlign" type="String" value="Left" />
<property name="textVAlign" type="String" value="Center" />
<property name="textWrap" type="String" value="NoWrap" />
<property name="textPadding" type="float" value="3" />
</font>
<attributes>
<property name="resizeBorders" type="Vector4f">
<x value="0" />
<y value="0" />
<z value="0" />
<w value="0" />
</property>
<property name="arrowResizeBorders" type="Vector4f">
<x value="0" />
<y value="0" />
<z value="0" />
<w value="0" />
</property>
<property name="defaultSize" type="Vector2f">
<x value="100" />
<y value="24" />
</property>
<property name="arrowSize" type="Vector2f">
<x value="20" />
<y value="20" />
</property>
</attributes>
<images>
<property name="expandImg" type="String" value="tonegod/gui/style/def/Common/Arrows/arrow_right.png" />
<property name="collapseImg" type="String" value="tonegod/gui/style/def/Common/Arrows/arrow_down.png" />
</images>
<effects>
</effects>
</element>
</root>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -17,5 +17,6 @@
<style control="ChatBox" path="tonegod/gui/style/def/ChatBox/ChatBox.gui.xml" /> <style control="ChatBox" path="tonegod/gui/style/def/ChatBox/ChatBox.gui.xml" />
<style control="Indicator" path="Gui/Indicator/Indicator.gui.xml" /> <style control="Indicator" path="Gui/Indicator/Indicator.gui.xml" />
<style control="ColorWheel" path="tonegod/gui/style/def/Common/Extras/ColorWheel.gui.xml" /> <style control="ColorWheel" path="tonegod/gui/style/def/Common/Extras/ColorWheel.gui.xml" />
<style control="Table" path="Gui/Table/Table.gui.xml" />
</root> </root>

BIN
ShootingStars/bulletjme.dll Normal file

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,282 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--desktop-deployment-impl.xml v1.0-->
<project name="desktop-deployment-impl" basedir="..">
<target name="-desktop-deployment" depends="-extract-native-binaries, -create-launcher-jvmargs, -test-platforms-enabled, -windows-x86-app, -windows-x64-app, -linux-x86-app, -linux-x64-app, -macosx-x64-app"/>
<target name="-windows-x86-app" if="is.windows-x86.app.enabled">
<echo>Windows 32bit Application Creation</echo>
<copy file="resources/desktop-deployment/windows-x86/package.cfg" tofile="resources/desktop-deployment/windows-x86/_package.cfg">
<filterchain>
<replacestring from="$${main.class}" to="${main.class.launcher}"/>
<replacestring from="$${launcher.jvmargs}" to="${launcher.jvmargs}"/>
<replacestring from="$${application.title}" to="${application.title}"/>
<replacestring from="$${jar.name}" to="${application.title}.jar"/>
</filterchain>
</copy>
<zip destfile="${dist.dir}/${application.title}-Windows-x86.zip">
<zipfileset file="resources/desktop-deployment/windows-x86/stub.exe" filemode="755" fullpath="${application.title}/${application.title}.exe"/>
<zipfileset file="resources/desktop-deployment/windows-x86/_package.cfg" fullpath="${application.title}/app/package.cfg"/>
<zipfileset file="resources/desktop-deployment/windows-x86/icon.ico" fullpath="${application.title}/${application.title}.ico"/>
<zipfileset file="${dist.jar}" prefix="${application.title}/app"/>
<zipfileset dir="${dist.dir}/lib" excludes="${deployment.jarexcludes}" prefix="${application.title}/app/lib"/>
<zipfileset dir="${build.dir}/natives/windows-x86" prefix="${application.title}/app" erroronmissingdir="false"/>
</zip>
<delete file="resources/desktop-deployment/windows-x86/_package.cfg"/>
<antcall target="-package-windows-x86-jre"/>
</target>
<target name="-package-windows-x86-jre" if="is.bundle.jre.enabled">
<untar src="resources/desktop-deployment/jre-windows-x86.tar.gz" dest="build/jre" compression="gzip"/>
<dirset dir="build/jre" id="dirId-windows-x86">
<include name="jre*"/>
</dirset>
<property name= "dirName-windows-x86" refid= "dirId-windows-x86"/>
<zip destfile="${dist.dir}/${application.title}-Windows-x86.zip" update="true">
<zipfileset dir="build/jre/${dirName-windows-x86}" prefix="${application.title}/runtime/jre"/>
</zip>
<delete dir="build/jre"/>
</target>
<target name="-windows-x64-app" if="is.windows-x64.app.enabled">
<echo>Windows 64bit Application Creation</echo>
<copy file="resources/desktop-deployment/windows-x64/package.cfg" tofile="resources/desktop-deployment/windows-x64/_package.cfg">
<filterchain>
<replacestring from="$${main.class}" to="${main.class.launcher}"/>
<replacestring from="$${launcher.jvmargs}" to="${launcher.jvmargs}"/>
<replacestring from="$${application.title}" to="${application.title}"/>
<replacestring from="$${jar.name}" to="${application.title}.jar"/>
</filterchain>
</copy>
<zip destfile="${dist.dir}/${application.title}-Windows-x64.zip">
<zipfileset file="resources/desktop-deployment/windows-x64/stub.exe" filemode="755" fullpath="${application.title}/${application.title}.exe"/>
<zipfileset file="resources/desktop-deployment/windows-x64/_package.cfg" fullpath="${application.title}/app/package.cfg"/>
<zipfileset file="resources/desktop-deployment/windows-x64/icon.ico" fullpath="${application.title}/${application.title}.ico"/>
<zipfileset file="${dist.jar}" prefix="${application.title}/app"/>
<zipfileset dir="${dist.dir}/lib" excludes="${deployment.jarexcludes}" prefix="${application.title}/app/lib"/>
<zipfileset dir="${build.dir}/natives/windows-x64" prefix="${application.title}/app" erroronmissingdir="false"/>
</zip>
<delete file="resources/desktop-deployment/windows-x64/_package.cfg"/>
<antcall target="-package-windows-x64-jre"/>
</target>
<target name="-package-windows-x64-jre" if="is.bundle.jre.enabled">
<untar src="resources/desktop-deployment/jre-windows-x64.tar.gz" dest="build/jre" compression="gzip"/>
<dirset dir="build/jre" id="dirId-windows-x64">
<include name="jre*"/>
</dirset>
<property name= "dirName-windows-x64" refid= "dirId-windows-x64"/>
<zip destfile="${dist.dir}/${application.title}-Windows-x64.zip" update="true">
<zipfileset dir="build/jre/${dirName-windows-x64}" prefix="${application.title}/runtime/jre"/>
</zip>
<delete dir="build/jre"/>
</target>
<target name="-linux-x86-app" if="is.linux-x86.app.enabled">
<echo>Linux 32bit Application Creation</echo>
<copy file="resources/desktop-deployment/linux-x86/package.cfg" tofile="resources/desktop-deployment/linux-x86/_package.cfg">
<filterchain>
<replacestring from="$${main.class}" to="${main.class.launcher}"/>
<replacestring from="$${launcher.jvmargs}" to="${launcher.jvmargs}"/>
<replacestring from="$${application.title}" to="${application.title}"/>
<replacestring from="$${jar.name}" to="${application.title}.jar"/>
</filterchain>
</copy>
<zip destfile="${dist.dir}/${application.title}-Linux-x86.zip">
<zipfileset file="resources/desktop-deployment/linux-x86/stub" filemode="755" fullpath="${application.title}/${application.title}"/>
<zipfileset file="resources/desktop-deployment/linux-x86/_package.cfg" fullpath="${application.title}/app/package.cfg"/>
<zipfileset file="${dist.jar}" prefix="${application.title}/app"/>
<zipfileset dir="${dist.dir}/lib" excludes="${deployment.jarexcludes}" prefix="${application.title}/app/lib"/>
<zipfileset dir="${build.dir}/natives/linux-x86" prefix="${application.title}/app" erroronmissingdir="false"/>
</zip>
<delete file="resources/desktop-deployment/linux-x86/_package.cfg"/>
<antcall target="-package-linux-x86-jre"/>
</target>
<target name="-package-linux-x86-jre" if="is.bundle.jre.enabled">
<untar src="resources/desktop-deployment/jre-linux-x86.tar.gz" dest="build/jre" compression="gzip"/>
<dirset dir="build/jre" id="dirId-linux-x86">
<include name="jre*"/>
</dirset>
<property name= "dirName-linux-x86" refid= "dirId-linux-x86"/>
<zip destfile="${dist.dir}/${application.title}-Linux-x86.zip" update="true">
<zipfileset dir="build/jre/${dirName-linux-x86}" excludes ="bin/*" prefix="${application.title}/runtime/jre"/>
<zipfileset dir="build/jre/${dirName-linux-x86}" includes ="bin/*" filemode="755" prefix="${application.title}/runtime/jre"/>
</zip>
<delete dir="build/jre"/>
</target>
<target name="-linux-x64-app" if="is.linux-x64.app.enabled">
<echo>Linux 64bit Application Creation</echo>
<copy file="resources/desktop-deployment/linux-x64/package.cfg" tofile="resources/desktop-deployment/linux-x64/_package.cfg">
<filterchain>
<replacestring from="$${main.class}" to="${main.class.launcher}"/>
<replacestring from="$${launcher.jvmargs}" to="${launcher.jvmargs}"/>
<replacestring from="$${application.title}" to="${application.title}"/>
<replacestring from="$${jar.name}" to="${application.title}.jar"/>
</filterchain>
</copy>
<zip destfile="${dist.dir}/${application.title}-Linux-x64.zip">
<zipfileset file="resources/desktop-deployment/linux-x64/stub" filemode="755" fullpath="${application.title}/${application.title}"/>
<zipfileset file="resources/desktop-deployment/linux-x64/_package.cfg" fullpath="${application.title}/app/package.cfg"/>
<zipfileset file="${dist.jar}" prefix="${application.title}/app"/>
<zipfileset dir="${dist.dir}/lib" excludes="${deployment.jarexcludes}" prefix="${application.title}/app/lib"/>
<zipfileset dir="${build.dir}/natives/linux-x64" prefix="${application.title}/app" erroronmissingdir="false"/>
</zip>
<delete file="resources/desktop-deployment/linux-x64/_package.cfg"/>
<antcall target="-package-linux-x64-jre"/>
</target>
<target name="-package-linux-x64-jre" if="is.bundle.jre.enabled">
<untar src="resources/desktop-deployment/jre-linux-x64.tar.gz" dest="build/jre" compression="gzip"/>
<dirset dir="build/jre" id="dirId-linux-x64">
<include name="jre*"/>
</dirset>
<property name= "dirName-linux-x64" refid= "dirId-linux-x64"/>
<zip destfile="${dist.dir}/${application.title}-Linux-x64.zip" update="true">
<zipfileset dir="build/jre/${dirName-linux-x64}" excludes ="bin/*" prefix="${application.title}/runtime/jre"/>
<zipfileset dir="build/jre/${dirName-linux-x64}" includes ="bin/*" filemode="755" prefix="${application.title}/runtime/jre"/>
</zip>
<delete dir="build/jre"/>
</target>
<target name="-macosx-x64-app" if="is.macosx-x64.app.enabled">
<echo>MacOSX Application Creation</echo>
<loadresource property="jfxdeploy.jvmargs">
<propertyresource name="run.jvmargs"/>
<filterchain>
<tokenfilter>
<filetokenizer/>
<replacestring from=" " to="&lt;/string&gt;&lt;string&gt;"/>
</tokenfilter>
</filterchain>
</loadresource>
<antcall target="-update-macosx-x64-plist-with-runtime"/>
<antcall target="-update-macosx-x64-plist-without-runtime"/>
<zip destfile="${dist.dir}/${application.title}-MacOSX.zip">
<zipfileset file="resources/desktop-deployment/macosx-x64/stub" filemode="755" fullpath="${application.title}.app/Contents/MacOS/JavaAppLauncher"/>
<zipfileset file="resources/desktop-deployment/macosx-x64/_Info.plist" fullpath="${application.title}.app/Contents/Info.plist"/>
<zipfileset file="resources/desktop-deployment/macosx-x64/icon.icns" fullpath="${application.title}.app/Contents/Resources/GenericApp.icns"/>
<zipfileset file="${dist.jar}" prefix="${application.title}.app/Contents/Java"/>
<zipfileset dir="${dist.dir}/lib" excludes="${deployment.jarexcludes}" prefix="${application.title}.app/Contents/Java/lib"/>
<zipfileset dir="${build.dir}/natives/macosx-x64" prefix="${application.title}.app/Contents/Java" erroronmissingdir="false"/>
</zip>
<delete file="resources/desktop-deployment/macosx-x64/_Info.plist"/>
<antcall target="-package-macosx-x64-jre"/>
</target>
<target name="-update-macosx-x64-plist-with-runtime" if="is.bundle.jre.enabled">
<!--key>JVMRuntime</key>
<string>jdk1.8.0_31.jdk</string-->
<copy file="resources/desktop-deployment/macosx-x64/Info.plist" tofile="resources/desktop-deployment/macosx-x64/_Info.plist">
<filterchain>
<replacestring from="$${main.class}" to="${main.class}"/>
<replacestring from="$${run.jvmargs}" to="${jfxdeploy.jvmargs}"/>
<replacestring from="$${application.title}" to="${application.title}"/>
<replacestring from="$${jfxdeploy.jvmargs}" to="-Xnoagent"/>
<replacestring from="$${jar.name}" to="${application.title}.jar"/>
<replacestring from="&lt;!--jvmruntime--&gt;" to="&lt;key&gt;JVMRuntime&lt;/key&gt;&#13; &lt;string&gt;jre.jre&lt;/string&gt;"/>
</filterchain>
</copy>
</target>
<target name="-update-macosx-x64-plist-without-runtime" unless="is.bundle.jre.enabled">
<copy file="resources/desktop-deployment/macosx-x64/Info.plist" tofile="resources/desktop-deployment/macosx-x64/_Info.plist">
<filterchain>
<replacestring from="$${main.class}" to="${main.class}"/>
<replacestring from="$${run.jvmargs}" to="${jfxdeploy.jvmargs}"/>
<replacestring from="$${application.title}" to="${application.title}"/>
<replacestring from="$${jfxdeploy.jvmargs}" to="-Xnoagent"/>
<replacestring from="$${jar.name}" to="${application.title}.jar"/>
</filterchain>
</copy>
</target>
<target name="-package-macosx-x64-jre" if="is.bundle.jre.enabled">
<untar src="resources/desktop-deployment/jre-macosx-x64.tar.gz" dest="build/jre" compression="gzip"/>
<dirset dir="build/jre" id="dirId-macosx-x64">
<include name="jre*"/>
</dirset>
<property name= "dirName-macosx-x64" refid= "dirId-macosx-x64"/>
<zip destfile="${dist.dir}/${application.title}-MacOSX.zip" update="true">
<zipfileset dir="build/jre/${dirName-macosx-x64}/Contents/Home" excludes ="bin/*" prefix="${application.title}.app/Contents/PlugIns/jre.jre/Contents/Home/jre"/>
<zipfileset dir="build/jre/${dirName-macosx-x64}/Contents/Home" includes ="bin/*" filemode="755" prefix="${application.title}.app/Contents/PlugIns/jre.jre/Contents/Home/jre"/>
<zipfileset file="build/jre/${dirName-macosx-x64}/Contents/Info.plist" fullpath="${application.title}.app/Contents/PlugIns/jre.jre/Contents/Info.plist"/>
<zipfileset dir="build/jre/${dirName-macosx-x64}/Contents/MacOS" prefix="${application.title}.app/Contents/PlugIns/jre.jre/Contents/MacOS"/>
</zip>
<delete dir="build/jre"/>
</target>
<target name="-test-platforms-enabled">
<condition property="is.windows-x86.app.enabled">
<istrue value="${windows-x86.app.enabled}"/>
</condition>
<condition property="is.windows-x64.app.enabled">
<istrue value="${windows-x64.app.enabled}"/>
</condition>
<condition property="is.linux-x86.app.enabled">
<istrue value="${linux-x86.app.enabled}"/>
</condition>
<condition property="is.linux-x64.app.enabled">
<istrue value="${linux-x64.app.enabled}"/>
</condition>
<condition property="is.macosx-x64.app.enabled">
<istrue value="${macosx-x64.app.enabled}"/>
</condition>
<condition property="is.bundle.jre.enabled">
<istrue value="${bundle.jre.enabled}"/>
</condition>
</target>
<target name="-create-launcher-jvmargs">
<script language="javascript">
<![CDATA[
var args = project.getProperty("run.jvmargs");
var res = args.split(" ");
var out = "";
for (var i = 1; i < res.length+1; i++) {
out = out + "jvmarg." + i + "=" + res[i-1] + "\r\n";
}
project.setProperty("launcher.jvmargs", out);
]]>
</script>
<loadresource property="main.class.launcher">
<propertyresource name="main.class"/>
<filterchain>
<tokenfilter>
<filetokenizer/>
<replacestring from="." to="/"/>
</tokenfilter>
</filterchain>
</loadresource>
</target>
<target name="-extract-native-binaries">
<java outputproperty="deployment.jarexcludes" dir="${basedir}" classname="com.jme3.system.ExtractNativeLibraries" fork="true" failonerror="false" classpath="${dist.jar}">
<arg value="getjarexcludes"/>
</java>
<java dir="${basedir}" classname="com.jme3.system.ExtractNativeLibraries" fork="true" failonerror="false" classpath="${dist.jar}">
<arg value="Windows32"/>
<arg value="${build.dir}/natives/windows-x86"/>
</java>
<java dir="${basedir}" classname="com.jme3.system.ExtractNativeLibraries" fork="true" failonerror="false" classpath="${dist.jar}">
<arg value="Windows64"/>
<arg value="${build.dir}/natives/windows-x64"/>
</java>
<java dir="${basedir}" classname="com.jme3.system.ExtractNativeLibraries" fork="true" failonerror="false" classpath="${dist.jar}">
<arg value="Linux32"/>
<arg value="${build.dir}/natives/linux-x86"/>
</java>
<java dir="${basedir}" classname="com.jme3.system.ExtractNativeLibraries" fork="true" failonerror="false" classpath="${dist.jar}">
<arg value="Linux64"/>
<arg value="${build.dir}/natives/linux-x64"/>
</java>
<java dir="${basedir}" classname="com.jme3.system.ExtractNativeLibraries" fork="true" failonerror="false" classpath="${dist.jar}">
<arg value="MacOSX64"/>
<arg value="${build.dir}/natives/macosx-x64"/>
</java>
</target>
</project>

View File

@ -6,6 +6,9 @@
<extension file="assets-impl.xml" id="assets"> <extension file="assets-impl.xml" id="assets">
<dependency dependsOn="-init-assets" target="-do-init"/> <dependency dependsOn="-init-assets" target="-do-init"/>
</extension> </extension>
<extension file="desktop-deployment-impl.xml" id="desktop-deployment">
<dependency dependsOn="-desktop-deployment" target="jar"/>
</extension>
</buildExtensions> </buildExtensions>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3"> <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>ShootingStars</name> <name>ShootingStars</name>

View File

@ -0,0 +1,6 @@
app.mainjar=${jar.name}
app.version=1.0
app.preferences.id=${application.title}
app.mainclass=${main.class}
app.classpath=
${launcher.jvmargs}

View File

@ -0,0 +1,6 @@
app.mainjar=${jar.name}
app.version=1.0
app.preferences.id=${application.title}
app.mainclass=${main.class}
app.classpath=
${launcher.jvmargs}

View File

@ -0,0 +1,55 @@
<?xml version="1.0" ?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSMinimumSystemVersion</key>
<string>10.7.4</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleAllowMixedLocalizations</key>
<true/>
<key>CFBundleExecutable</key>
<string>JavaAppLauncher</string>
<key>CFBundleIconFile</key>
<string>GenericApp.icns</string>
<key>CFBundleIdentifier</key>
<string>${main.class}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${application.title}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<!-- See http://developer.apple.com/library/mac/#releasenotes/General/SubmittingToMacAppStore/_index.html
for list of AppStore categories -->
<key>LSApplicationCategoryType</key>
<string>Unknown</string>
<key>CFBundleVersion</key>
<string>100</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright (C) 2015</string>
<!--jvmruntime-->
<key>JVMMainClassName</key>
<string>${main.class}</string>
<key>JVMAppClasspath</key>
<string></string>
<key>JVMMainJarName</key>
<string>${jar.name}</string>
<key>JVMPreferencesID</key>
<string>${application.title}</string>
<key>JVMOptions</key>
<array>
<string>${run.jvmargs}</string>
</array>
<key>JVMUserOptions</key>
<dict>
</dict>
<key>NSHighResolutionCapable</key>
<string>true</string>
</dict>
</plist>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

@ -0,0 +1,7 @@
app.mainjar=${jar.name}
app.version=1.0
app.id=${application.title}
app.preferences.id=${application.title}
app.mainclass=${main.class}
app.classpath=
${launcher.jvmargs}

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

@ -0,0 +1,7 @@
app.mainjar=${jar.name}
app.version=1.0
app.id=${application.title}
app.preferences.id=${application.title}
app.mainclass=${main.class}
app.classpath=
${launcher.jvmargs}

View File

@ -34,6 +34,7 @@ public class AudioDataManager {
private static final Band LOW_BAND = new Band(1f, 140); private static final Band LOW_BAND = new Band(1f, 140);
private static final Band MID_BAND = new Band(400f, 1200f); private static final Band MID_BAND = new Band(400f, 1200f);
private static final Band HIGH_BAND = new Band(2000f, 16000f); private static final Band HIGH_BAND = new Band(2000f, 16000f);
private static final float MAX_POINTS = 100f;
/**/ /**/
private AudioProcessor audioProcessorLowBand; private AudioProcessor audioProcessorLowBand;
private AudioProcessor audioProcessorMidBand; private AudioProcessor audioProcessorMidBand;
@ -140,6 +141,16 @@ public class AudioDataManager {
audioProcessorMidBand = null; audioProcessorMidBand = null;
} }
public int getMaxAchievablePoints() {
int maxAchievablePoints = 0;
for (int i = 0; i < spawnData.length; i++) {
maxAchievablePoints += (int) Math.round(MAX_POINTS * spawnData[i]);
}
return maxAchievablePoints;
}
public void analyseHighBand() { public void analyseHighBand() {
audioProcessorHighBand.calculate(); audioProcessorHighBand.calculate();

View File

@ -108,7 +108,7 @@ public class Ground extends Node {
private void addLight() { private void addLight() {
AmbientLight ambient = new AmbientLight(); AmbientLight ambient = new AmbientLight();
ambient.setColor(new ColorRGBA(0.5f, 0.5f, 0.5f, 1f)); ambient.setColor(new ColorRGBA(0.1f, 0.1f, 0.1f, 1f));
this.addLight(ambient); this.addLight(ambient);
} }
} }

View File

@ -19,9 +19,7 @@ package org.wyrez.shootingstars.gui;
import com.jme3.asset.AssetManager; import com.jme3.asset.AssetManager;
import com.jme3.math.Vector2f; import com.jme3.math.Vector2f;
import com.jme3.ui.Picture; import com.jme3.ui.Picture;
import tonegod.gui.controls.text.Label;
import tonegod.gui.controls.windows.Panel; import tonegod.gui.controls.windows.Panel;
import tonegod.gui.core.Element;
import tonegod.gui.core.Screen; import tonegod.gui.core.Screen;
/** /**

View File

@ -49,11 +49,11 @@ public class FileMetaInfoGUI extends BackgroundedGui implements Gui {
this.settings = settings; this.settings = settings;
this.screenHelper = screenHelper; this.screenHelper = screenHelper;
this.setIgnoreMouse(true); this.setIgnoreMouse(true);
this.setIsVisible(false); this.setAsContainerOnly();
create();
} }
private void create() { @Override
public void create() {
float startPointx = screenHelper.calcX(256f); float startPointx = screenHelper.calcX(256f);
float startPointy = screenHelper.calcY(202f); float startPointy = screenHelper.calcY(202f);
float marginLeft = screenHelper.calcX(110f); float marginLeft = screenHelper.calcX(110f);
@ -120,6 +120,7 @@ public class FileMetaInfoGUI extends BackgroundedGui implements Gui {
this.addChild(btnCancel); this.addChild(btnCancel);
} }
@Override
public void refresh() { public void refresh() {
lblDuration.setText(String.valueOf(settings.getTrackLength()) + " s"); lblDuration.setText(String.valueOf(settings.getTrackLength()) + " s");
lblTitel.setText(settings.getTrackTitle()); lblTitel.setText(settings.getTrackTitle());
@ -127,10 +128,12 @@ public class FileMetaInfoGUI extends BackgroundedGui implements Gui {
lblFileName.setText(new File(settings.getVideoFile()).getName()); lblFileName.setText(new File(settings.getVideoFile()).getName());
} }
@Override
public void attach() { public void attach() {
screen.addElement(this); screen.addElement(this);
} }
@Override
public void detach() { public void detach() {
screen.removeElement(this); screen.removeElement(this);
} }

View File

@ -25,7 +25,9 @@ import org.wyrez.shootingstars.gui.controls.ButtonBase;
import org.wyrez.shootingstars.gui.controls.GuiMusicRemainingTimeControl; import org.wyrez.shootingstars.gui.controls.GuiMusicRemainingTimeControl;
import org.wyrez.shootingstars.gui.controls.GuiPlayerPointsControl; import org.wyrez.shootingstars.gui.controls.GuiPlayerPointsControl;
import org.wyrez.shootingstars.gui.listener.GameListener; import org.wyrez.shootingstars.gui.listener.GameListener;
import org.wyrez.shootingstars.gui.model.GameMode;
import org.wyrez.shootingstars.helper.ScreenHelper; import org.wyrez.shootingstars.helper.ScreenHelper;
import org.wyrez.shootingstars.states.util.OptionSettings;
import tonegod.gui.controls.buttons.Button; import tonegod.gui.controls.buttons.Button;
import tonegod.gui.controls.extras.Indicator; import tonegod.gui.controls.extras.Indicator;
import tonegod.gui.controls.text.Label; import tonegod.gui.controls.text.Label;
@ -36,7 +38,7 @@ import tonegod.gui.core.Screen;
* *
* @author Darth Affe * @author Darth Affe
*/ */
public class GameGUI extends Panel implements Gui{ public class GameGUI extends Panel implements Gui {
private GameListener listener; private GameListener listener;
private Button btnStart; private Button btnStart;
@ -49,18 +51,22 @@ public class GameGUI extends Panel implements Gui{
private ScreenHelper screenHelper; private ScreenHelper screenHelper;
private AudioDataManager audioDataManager; private AudioDataManager audioDataManager;
private Panel pointsTimePanel; private Panel pointsTimePanel;
private GameMode gameMode;
private OptionSettings optionSettings;
public GameGUI(Screen screen, GameListener listener, ScreenHelper screenHelper, AudioDataManager audioDataManager) { public GameGUI(Screen screen, GameListener listener, ScreenHelper screenHelper, AudioDataManager audioDataManager, OptionSettings optionSettings) {
super(screen, new Vector2f(0f, 0f), new Vector2f(1280f, 720f)); //create for full hd super(screen, new Vector2f(0f, 0f), new Vector2f(1280f, 720f)); //create for full hd
this.listener = listener; this.listener = listener;
this.screenHelper = screenHelper; this.screenHelper = screenHelper;
this.audioDataManager = audioDataManager; this.audioDataManager = audioDataManager;
this.optionSettings = optionSettings;
this.setIgnoreMouse(true); this.setIgnoreMouse(true);
this.setIsVisible(false); this.setAsContainerOnly();
create();
} }
private void create() { @Override
public void create() {
this.gameMode = GameMode.values()[optionSettings.getGameMode()];
float startPointx = screenHelper.calcX(537f); float startPointx = screenHelper.calcX(537f);
float startPointy = screenHelper.calcY(576f); float startPointy = screenHelper.calcY(576f);
@ -72,6 +78,9 @@ public class GameGUI extends Panel implements Gui{
float labelFontSize = screenHelper.calcX(20f); float labelFontSize = screenHelper.calcX(20f);
float pointsTimePanelWidth = screenHelper.calcX(180f);
float pointsTimePanelHeight = screenHelper.calcY(65f);
btnStart = new ButtonBase(screen, new Vector2f(startPointx, startPointy), btnStart = new ButtonBase(screen, new Vector2f(startPointx, startPointy),
new Vector2f(screenHelper.calcX(200f), screenHelper.calcY(40f))) { new Vector2f(screenHelper.calcX(200f), screenHelper.calcY(40f))) {
@Override @Override
@ -121,7 +130,7 @@ public class GameGUI extends Panel implements Gui{
indOverheat.setMaxValue(100f); indOverheat.setMaxValue(100f);
updateOverhead(0f); updateOverhead(0f);
pointsTimePanel = new Panel(screen, new Vector2f(startPointPointsx, startPointPointsy), new Vector2f(screenHelper.calcX(180f), screenHelper.calcY(65f))); pointsTimePanel = new Panel(screen, new Vector2f(startPointPointsx, startPointPointsy), new Vector2f(pointsTimePanelWidth, pointsTimePanelHeight));
lblPoints = new Label(screen, new Vector2f(screenHelper.calcX(5f), 0), new Vector2f(screenHelper.calcX(150f), screenHelper.calcY(30f))); lblPoints = new Label(screen, new Vector2f(screenHelper.calcX(5f), 0), new Vector2f(screenHelper.calcX(150f), screenHelper.calcY(30f)));
lblPoints.setFontColor(new ColorRGBA(1f, 0f, 0f, 1f)); lblPoints.setFontColor(new ColorRGBA(1f, 0f, 0f, 1f));
@ -177,10 +186,12 @@ public class GameGUI extends Panel implements Gui{
pointsTimePanel.show(); pointsTimePanel.show();
} }
@Override
public void attach() { public void attach() {
screen.addElement(this); screen.addElement(this);
} }
@Override
public void detach() { public void detach() {
screen.removeElement(this); screen.removeElement(this);
} }
@ -194,8 +205,8 @@ public class GameGUI extends Panel implements Gui{
} }
public void setRemainingTime(float remainingTime) { public void setRemainingTime(float remainingTime) {
int seconds = (int)remainingTime / 1000; int seconds = (int) remainingTime / 1000;
int min = (int)(seconds / 60); int min = (int) (seconds / 60);
lblRemainingTime.setText("Time: " + min + ":" + String.format("%02d", (seconds - min * 60))); lblRemainingTime.setText("Time: " + min + ":" + String.format("%02d", (seconds - min * 60)));
} }
@ -205,6 +216,7 @@ public class GameGUI extends Panel implements Gui{
this.addControl(new GuiMusicRemainingTimeControl(audioDataManager, this)); this.addControl(new GuiMusicRemainingTimeControl(audioDataManager, this));
} }
@Override
public void refresh() { public void refresh() {
} }
} }

View File

@ -22,6 +22,8 @@ package org.wyrez.shootingstars.gui;
*/ */
public interface Gui { public interface Gui {
public void create();
public void refresh(); public void refresh();
public void attach(); public void attach();

View File

@ -24,12 +24,13 @@ import java.util.List;
import org.wyrez.shootingstars.gui.controls.ButtonBase; import org.wyrez.shootingstars.gui.controls.ButtonBase;
import org.wyrez.shootingstars.gui.listener.HighscoreListener; import org.wyrez.shootingstars.gui.listener.HighscoreListener;
import org.wyrez.shootingstars.gui.manager.HighscoreManager; import org.wyrez.shootingstars.gui.manager.HighscoreManager;
import org.wyrez.shootingstars.gui.model.Score; import org.wyrez.shootingstars.gui.model.ClassicScore;
import org.wyrez.shootingstars.helper.ScreenHelper; import org.wyrez.shootingstars.helper.ScreenHelper;
import tonegod.gui.controls.buttons.Button; import tonegod.gui.controls.buttons.Button;
import tonegod.gui.controls.text.Label; import tonegod.gui.controls.lists.Table;
import tonegod.gui.controls.lists.Table.TableColumn;
import tonegod.gui.controls.lists.Table.TableRow;
import tonegod.gui.controls.text.TextField; import tonegod.gui.controls.text.TextField;
import tonegod.gui.controls.windows.Panel;
import tonegod.gui.core.Screen; import tonegod.gui.core.Screen;
/** /**
@ -41,8 +42,8 @@ public class HighscoreGUI extends BackgroundedGui implements Gui {
private HighscoreListener listener; private HighscoreListener listener;
private HighscoreManager highscoreManager; private HighscoreManager highscoreManager;
private ScreenHelper screenHelper; private ScreenHelper screenHelper;
private Panel plnScores;
private TextField txtFilter; private TextField txtFilter;
private Table classicTable;
public HighscoreGUI(Screen screen, HighscoreListener listener, HighscoreManager highscoreManager, public HighscoreGUI(Screen screen, HighscoreListener listener, HighscoreManager highscoreManager,
ScreenHelper screenHelper, AssetManager assetManager) { ScreenHelper screenHelper, AssetManager assetManager) {
@ -51,27 +52,25 @@ public class HighscoreGUI extends BackgroundedGui implements Gui {
this.highscoreManager = highscoreManager; this.highscoreManager = highscoreManager;
this.screenHelper = screenHelper; this.screenHelper = screenHelper;
this.setIgnoreMouse(true); this.setIgnoreMouse(true);
this.setIsVisible(false); this.setAsContainerOnly();
plnScores = new Panel(screen, new Vector2f(0f, 0f),new Vector2f(0f, 0f));
create();
} }
@Override
public void attach() { public void attach() {
screen.addElement(this); screen.addElement(this);
} }
@Override
public void detach() { public void detach() {
screen.removeElement(this); screen.removeElement(this);
} }
private void create() { @Override
float startPointx = screenHelper.calcX(32f); public void create() {
float startPointy = screenHelper.calcY(18f); float startPointX = screenHelper.calcX(32f);
float startPointY = screenHelper.calcY(80f);
float marginScoreNameLeft = screenHelper.calcX(14f); float marginTableLeft = screenHelper.calcX(7f);
float marginScorePointsLeft = screenHelper.calcX(300f);
float marginScoreDateLeft = screenHelper.calcX(420f);
float marginScoreSongNameLeft = screenHelper.calcX(600f);
float labelFontSize = screenHelper.calcX(20f); float labelFontSize = screenHelper.calcX(20f);
@ -79,27 +78,9 @@ public class HighscoreGUI extends BackgroundedGui implements Gui {
float buttonWidth = screenHelper.calcX(180f); float buttonWidth = screenHelper.calcX(180f);
float buttonFontSize = screenHelper.calcX(18f); float buttonFontSize = screenHelper.calcX(18f);
List<Score> highscores = highscoreManager.getScores(); createClassicHighscore(startPointX,startPointY,marginTableLeft,labelFontSize);
Label lblScoreNameHead = new Label(screen, new Vector2f(startPointx + marginScoreNameLeft, startPointy), new Vector2f(screenHelper.calcX(250f), screenHelper.calcY(40f))); Button btnBack = new ButtonBase(screen, new Vector2f(startPointX + screenHelper.calcX(1060f), startPointY + screenHelper.calcY(560.8f)), new Vector2f(screenHelper.calcX(153f), buttonHeight)) {
lblScoreNameHead.setText("Name");
lblScoreNameHead.setFontSize(labelFontSize);
Label lblScorePointsHead = new Label(screen, new Vector2f(startPointx + marginScorePointsLeft, startPointy), new Vector2f(screenHelper.calcX(120f), screenHelper.calcY(40f)));
lblScorePointsHead.setText("Points");
lblScorePointsHead.setFontSize(labelFontSize);
Label lblScoreDateHead = new Label(screen, new Vector2f(startPointx + marginScoreDateLeft, startPointy), new Vector2f(screenHelper.calcX(180f), screenHelper.calcY(40f)));
lblScoreDateHead.setText("Date");
lblScoreDateHead.setFontSize(labelFontSize);
Label lblScoreSongNameHead = new Label(screen, new Vector2f(startPointx + marginScoreSongNameLeft, startPointy), new Vector2f(screenHelper.calcX(600f), screenHelper.calcY(40f)));
lblScoreSongNameHead.setText("Song Name");
lblScoreSongNameHead.setFontSize(labelFontSize);
drawHighscores(highscores);
Button btnBack = new ButtonBase(screen, new Vector2f(startPointx + screenHelper.calcX(1060f), startPointy + screenHelper.calcY(622.8f)), new Vector2f(screenHelper.calcX(153f), buttonHeight)) {
@Override @Override
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) { public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
listener.back(); listener.back();
@ -114,7 +95,7 @@ public class HighscoreGUI extends BackgroundedGui implements Gui {
Button btnFilter = new ButtonBase(screen, new Vector2f(screenHelper.calcX(1092f), screenHelper.calcY(15f)), new Vector2f(buttonWidth, buttonHeight)) { Button btnFilter = new ButtonBase(screen, new Vector2f(screenHelper.calcX(1092f), screenHelper.calcY(15f)), new Vector2f(buttonWidth, buttonHeight)) {
@Override @Override
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) { public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
List<Score> scores = highscoreManager.getScoresWithSongName(txtFilter.getText()); List<ClassicScore> scores = highscoreManager.getClassicScoresWithSongName(txtFilter.getText());
drawHighscores(scores); drawHighscores(scores);
} }
}; };
@ -122,66 +103,71 @@ public class HighscoreGUI extends BackgroundedGui implements Gui {
btnFilter.setText("Filter Song Name"); btnFilter.setText("Filter Song Name");
btnFilter.setFontSize(buttonFontSize); btnFilter.setFontSize(buttonFontSize);
this.addChild(lblScoreNameHead); this.addChild(classicTable);
this.addChild(lblScorePointsHead);
this.addChild(lblScoreDateHead);
this.addChild(lblScoreSongNameHead);
this.addChild(plnScores);
this.addChild(txtFilter); this.addChild(txtFilter);
this.addChild(btnFilter); this.addChild(btnFilter);
this.addChild(btnBack); this.addChild(btnBack);
} }
public void refresh() { private void createClassicHighscore(float startPointX, float startPointY, float marginTableLeft, float labelFontSize) {
List<Score> highscores = highscoreManager.getScores(); List<ClassicScore> highscores = highscoreManager.getClassicScores();
classicTable = new Table(screen, new Vector2f(startPointX + marginTableLeft, startPointY),new Vector2f(screenHelper.calcX(1205f), screenHelper.calcY(550f))) {
@Override
public void onChange() {
}
};
TableColumn placeColumn = new TableColumn(classicTable, screen, "Place");
placeColumn.setDimensions(screenHelper.calcX(35f), screenHelper.calcY(40f));
placeColumn.setText("");
placeColumn.setFontSize(labelFontSize);
classicTable.addColumn(placeColumn);
TableColumn nameColumn = new TableColumn(classicTable, screen, "Name");
nameColumn.setDimensions(screenHelper.calcX(190f), screenHelper.calcY(40f));
nameColumn.setText("Name");
nameColumn.setFontSize(labelFontSize);
classicTable.addColumn(nameColumn);
TableColumn pointsColumn = new TableColumn(classicTable, screen, "Points");
pointsColumn.setDimensions(screenHelper.calcX(110f), screenHelper.calcY(40f));
pointsColumn.setText("Points");
pointsColumn.setFontSize(labelFontSize);
classicTable.addColumn(pointsColumn);
TableColumn dateColumn = new TableColumn(classicTable, screen, "Date");
dateColumn.setDimensions(screenHelper.calcX(170f), screenHelper.calcY(40f));
dateColumn.setText("Date");
dateColumn.setFontSize(labelFontSize);
classicTable.addColumn(dateColumn);
TableColumn songNameColumn = new TableColumn(classicTable, screen, "Song Name");
songNameColumn.setDimensions(screenHelper.calcX(693f), screenHelper.calcY(40f));
songNameColumn.setText("Song Name");
songNameColumn.setFontSize(labelFontSize);
classicTable.addColumn(songNameColumn);
drawHighscores(highscores); drawHighscores(highscores);
} }
private void drawHighscores(List<Score> scores) { @Override
plnScores.detachAllChildren(); public void refresh() {
List<ClassicScore> highscores = highscoreManager.getClassicScores();
float startPointx = screenHelper.calcX(32f); drawHighscores(highscores);
float startPointy = screenHelper.calcY(18f);
float marginScoreNameLeft = screenHelper.calcX(14f);
float marginScorePointsLeft = screenHelper.calcX(300f);
float marginScoreDateLeft = screenHelper.calcX(420f);
float marginScoreSongNameLeft = screenHelper.calcX(600f);
float marginScoreTop = screenHelper.calcY(50f);
float labelFontSize = screenHelper.calcX(20f);
int maxScores = 0;
if (scores.size() > 10) {
maxScores = 10;
} else {
maxScores = scores.size();
} }
for (int i = 0; i < maxScores; i++) { private void drawHighscores(List<ClassicScore> scores) {
Score score = scores.get(i); float labelFontSize = screenHelper.calcX(20f);
Label lblScoreName = new Label(screen, new Vector2f(startPointx + marginScoreNameLeft, startPointy + marginScoreTop), new Vector2f(screenHelper.calcX(250f), screenHelper.calcY(40f)));
lblScoreName.setText(score.getPlayerName());
lblScoreName.setFontSize(labelFontSize);
Label lblScorePoints = new Label(screen, new Vector2f(startPointx + marginScorePointsLeft, startPointy + marginScoreTop), new Vector2f(screenHelper.calcX(120f), screenHelper.calcY(40f))); classicTable.removeAllRows();
lblScorePoints.setText(String.valueOf(score.getScore())); for (int i = 0; i < scores.size(); i++) {
lblScorePoints.setFontSize(labelFontSize);
Label lblScoreDate = new Label(screen, new Vector2f(startPointx + marginScoreDateLeft, startPointy + marginScoreTop), new Vector2f(screenHelper.calcX(180f), screenHelper.calcY(40f))); ClassicScore score = scores.get(i);
lblScoreDate.setText(DateFormat.getDateTimeInstance().format(score.getDate())); TableRow row = new TableRow(screen, classicTable);
lblScoreDate.setFontSize(labelFontSize); row.setFontSize(labelFontSize);
row.addCell(String.valueOf(i + 1), i);
Label lblScoreSongName = new Label(screen, new Vector2f(startPointx + marginScoreSongNameLeft, startPointy + marginScoreTop), new Vector2f(screenHelper.calcX(600f), screenHelper.calcY(40f))); row.addCell(score.getPlayerName(), i);
lblScoreSongName.setText(score.getSongName()); row.addCell(String.valueOf(score.getScore()), i);
lblScoreSongName.setFontSize(labelFontSize); row.addCell(DateFormat.getDateTimeInstance().format(score.getDate()), i);
row.addCell(score.getSongName(), i);
plnScores.addChild(lblScoreName); classicTable.addRow(row);
plnScores.addChild(lblScorePoints);
plnScores.addChild(lblScoreDate);
plnScores.addChild(lblScoreSongName);
marginScoreTop += screenHelper.calcY(50f);
} }
} }
} }

View File

@ -42,12 +42,11 @@ public class LoadingGui extends BackgroundedGui implements Gui {
assetManager, "Textures/ShootingStars.png"); //create for full hd assetManager, "Textures/ShootingStars.png"); //create for full hd
this.screenHelper = screenHelper; this.screenHelper = screenHelper;
this.setIgnoreMouse(true); this.setIgnoreMouse(true);
this.setIsVisible(false); this.setAsContainerOnly();
create();
} }
private void create() { @Override
public void create() {
float startPointx = screenHelper.calcX(537f); float startPointx = screenHelper.calcX(537f);
float startPointy = screenHelper.calcY(576f); float startPointy = screenHelper.calcY(576f);
float distancePogressbarLabely = screenHelper.calcY(36f); float distancePogressbarLabely = screenHelper.calcY(36f);
@ -67,10 +66,12 @@ public class LoadingGui extends BackgroundedGui implements Gui {
this.addChild(lblStatus); this.addChild(lblStatus);
} }
@Override
public void attach() { public void attach() {
screen.addElement(this); screen.addElement(this);
} }
@Override
public void detach() { public void detach() {
screen.removeElement(this); screen.removeElement(this);
} }
@ -80,6 +81,7 @@ public class LoadingGui extends BackgroundedGui implements Gui {
indProgress.setCurrentValue(progress.getValue()); indProgress.setCurrentValue(progress.getValue());
} }
@Override
public void refresh() { public void refresh() {
} }
} }

View File

@ -25,6 +25,7 @@ import org.wyrez.shootingstars.helper.ScreenHelper;
import tonegod.gui.controls.buttons.Button; import tonegod.gui.controls.buttons.Button;
import tonegod.gui.controls.text.Label; import tonegod.gui.controls.text.Label;
import tonegod.gui.core.Screen; import tonegod.gui.core.Screen;
import tonegod.gui.core.layouts.MigLayout;
/** /**
* *
@ -40,11 +41,14 @@ public class MenuGUI extends BackgroundedGui implements Gui {
this.listener = listener; this.listener = listener;
this.screenHelper = screenHelper; this.screenHelper = screenHelper;
this.setIgnoreMouse(true); this.setIgnoreMouse(true);
this.setIsVisible(false); this.setAsContainerOnly();
create();
} }
private void create() { @Override
public void create() {
//MigLayout ml = new MigLayout(screen, "[70][15][15]", "[35][15][15][35]", "");
float startPointx = screenHelper.calcX(256f); float startPointx = screenHelper.calcX(256f);
float startPointy = screenHelper.calcY(252f); float startPointy = screenHelper.calcY(252f);
float labelFontSize = screenHelper.calcX(89f); float labelFontSize = screenHelper.calcX(89f);
@ -112,13 +116,16 @@ public class MenuGUI extends BackgroundedGui implements Gui {
this.addChild(lblShootingStars); this.addChild(lblShootingStars);
} }
@Override
public void refresh() { public void refresh() {
} }
@Override
public void attach() { public void attach() {
screen.addElement(this); screen.addElement(this);
} }
@Override
public void detach() { public void detach() {
screen.removeElement(this); screen.removeElement(this);
} }

View File

@ -21,6 +21,7 @@ import com.jme3.input.event.MouseButtonEvent;
import com.jme3.math.Vector2f; import com.jme3.math.Vector2f;
import org.wyrez.shootingstars.gui.controls.ButtonBase; import org.wyrez.shootingstars.gui.controls.ButtonBase;
import org.wyrez.shootingstars.gui.listener.OptionsListener; import org.wyrez.shootingstars.gui.listener.OptionsListener;
import org.wyrez.shootingstars.gui.model.GameMode;
import org.wyrez.shootingstars.helper.DisplayHelper; import org.wyrez.shootingstars.helper.DisplayHelper;
import org.wyrez.shootingstars.helper.ScreenHelper; import org.wyrez.shootingstars.helper.ScreenHelper;
import org.wyrez.shootingstars.states.util.OptionSettings; import org.wyrez.shootingstars.states.util.OptionSettings;
@ -44,6 +45,7 @@ public class OptionsGUI extends BackgroundedGui implements Gui {
//General Controls //General Controls
private TextField txtPlayerName; private TextField txtPlayerName;
private CheckBox chkEnableAudioVisualization; private CheckBox chkEnableAudioVisualization;
private ComboBox cboGameMode;
//Video Controls //Video Controls
private ComboBox cboResolution; private ComboBox cboResolution;
private ComboBox cboFrequency; private ComboBox cboFrequency;
@ -63,20 +65,21 @@ public class OptionsGUI extends BackgroundedGui implements Gui {
this.settings = settings; this.settings = settings;
this.screenHelper = screenHelper; this.screenHelper = screenHelper;
this.setIgnoreMouse(true); this.setIgnoreMouse(true);
this.setIsVisible(false); this.setAsContainerOnly();
create();
readControlValues();
} }
@Override
public void attach() { public void attach() {
screen.addElement(this); screen.addElement(this);
} }
@Override
public void detach() { public void detach() {
screen.removeElement(this); screen.removeElement(this);
} }
private void create() { @Override
public void create() {
float tabControlStartPointx = screenHelper.calcX(32f); float tabControlStartPointx = screenHelper.calcX(32f);
float tabControlStartPointy = screenHelper.calcY(18f); float tabControlStartPointy = screenHelper.calcY(18f);
@ -114,6 +117,8 @@ public class OptionsGUI extends BackgroundedGui implements Gui {
this.addChild(btnSave); this.addChild(btnSave);
this.addChild(btnCancel); this.addChild(btnCancel);
readControlValues();
} }
private void createGeneral(float labelFontSize) { private void createGeneral(float labelFontSize) {
@ -125,6 +130,9 @@ public class OptionsGUI extends BackgroundedGui implements Gui {
float startPointAudioVisualy = screenHelper.calcY(36f); float startPointAudioVisualy = screenHelper.calcY(36f);
float marginLeftAudioVisualControl = screenHelper.calcX(190f); float marginLeftAudioVisualControl = screenHelper.calcX(190f);
float comboBoxWidth = screenHelper.calcX(200f);
float comboBoxHeight = screenHelper.calcY(30f);
Label lblPlayerName = new Label(screen, new Vector2f(startPointx, startPointy), new Vector2f(screenHelper.calcX(120f), screenHelper.calcY(40f))); Label lblPlayerName = new Label(screen, new Vector2f(startPointx, startPointy), new Vector2f(screenHelper.calcX(120f), screenHelper.calcY(40f)));
lblPlayerName.setText("Player Name"); lblPlayerName.setText("Player Name");
lblPlayerName.setFontSize(labelFontSize); lblPlayerName.setFontSize(labelFontSize);
@ -138,10 +146,26 @@ public class OptionsGUI extends BackgroundedGui implements Gui {
chkEnableAudioVisualization = new CheckBox(screen, new Vector2f(startPointAudioVisualx + marginLeftAudioVisualControl, startPointAudioVisualy + screenHelper.calcY(12f)), new Vector2f(screenHelper.calcX(20f), screenHelper.calcX(20f))); chkEnableAudioVisualization = new CheckBox(screen, new Vector2f(startPointAudioVisualx + marginLeftAudioVisualControl, startPointAudioVisualy + screenHelper.calcY(12f)), new Vector2f(screenHelper.calcX(20f), screenHelper.calcX(20f)));
Label lblGameMode = new Label(screen, new Vector2f(startPointx, startPointy + screenHelper.calcY(308f)), new Vector2f(screenHelper.calcX(120f), screenHelper.calcY(40f)));
lblGameMode.setText("Game Mode");
lblGameMode.setFontSize(labelFontSize);
cboGameMode = new ComboBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(315f)), new Vector2f(comboBoxWidth, comboBoxHeight)) {
@Override
public void onChange(int selectedIndex, Object value) {
}
};
cboGameMode.setFontSize(labelFontSize);
for (GameMode gm : GameMode.values()) {
cboGameMode.addListItem(gm.toString(), gm);
}
this.addChild(lblPlayerName); this.addChild(lblPlayerName);
this.addChild(txtPlayerName); this.addChild(txtPlayerName);
this.addChild(lblEnableAudioVisualization); this.addChild(lblEnableAudioVisualization);
this.addChild(chkEnableAudioVisualization); this.addChild(chkEnableAudioVisualization);
this.addChild(lblGameMode);
this.addChild(cboGameMode);
} }
private void createVideo(float labelFontSize) { private void createVideo(float labelFontSize) {
@ -291,6 +315,7 @@ public class OptionsGUI extends BackgroundedGui implements Gui {
//General //General
txtPlayerName.setText(settings.getUsername()); txtPlayerName.setText(settings.getUsername());
chkEnableAudioVisualization.setIsChecked(settings.isAudioVisualizationEnabled()); chkEnableAudioVisualization.setIsChecked(settings.isAudioVisualizationEnabled());
setComboBoxValue(cboGameMode, GameMode.values()[settings.getGameMode()].name());
//Video //Video
setComboBoxValue(cboResolution, resolution); setComboBoxValue(cboResolution, resolution);
@ -308,7 +333,7 @@ public class OptionsGUI extends BackgroundedGui implements Gui {
private void setComboBoxValue(ComboBox comboBox, String value) { private void setComboBoxValue(ComboBox comboBox, String value) {
for (int i = 0; i < comboBox.getListItems().size(); i++) { for (int i = 0; i < comboBox.getListItems().size(); i++) {
if (comboBox.getListItems().get(i).getValue().equals(value)) { if (comboBox.getListItems().get(i).getValue().toString().equalsIgnoreCase(value)) {
comboBox.setSelectedIndex(i); comboBox.setSelectedIndex(i);
} }
} }
@ -318,6 +343,7 @@ public class OptionsGUI extends BackgroundedGui implements Gui {
//General //General
settings.setUsername(txtPlayerName.getText()); settings.setUsername(txtPlayerName.getText());
settings.setEnableAudioVisualization(chkEnableAudioVisualization.getIsChecked()); settings.setEnableAudioVisualization(chkEnableAudioVisualization.getIsChecked());
settings.setGameMode(cboGameMode.getSelectIndex());
//Video //Video
String resolution[] = cboResolution.getSelectedListItem().getValue().toString().split(" x "); String resolution[] = cboResolution.getSelectedListItem().getValue().toString().split(" x ");
@ -337,6 +363,8 @@ public class OptionsGUI extends BackgroundedGui implements Gui {
settings.save(); settings.save();
} }
@Override
public void refresh() { public void refresh() {
create();
} }
} }

View File

@ -41,11 +41,11 @@ public class SelectTrackGUI extends BackgroundedGui implements Gui {
this.listener = listener; this.listener = listener;
this.screenHelper = screenHelper; this.screenHelper = screenHelper;
this.setIgnoreMouse(true); this.setIgnoreMouse(true);
this.setIsVisible(false); this.setAsContainerOnly();
create();
} }
private void create() { @Override
public void create() {
float startPointx = screenHelper.calcX(576f); float startPointx = screenHelper.calcX(576f);
float startPointy = screenHelper.calcY(260f); float startPointy = screenHelper.calcY(260f);
float labelFontSize = screenHelper.calcX(76f); float labelFontSize = screenHelper.calcX(76f);
@ -98,13 +98,16 @@ public class SelectTrackGUI extends BackgroundedGui implements Gui {
this.addChild(btnCancel); this.addChild(btnCancel);
} }
@Override
public void refresh() { public void refresh() {
} }
@Override
public void attach() { public void attach() {
screen.addElement(this); screen.addElement(this);
} }
@Override
public void detach() { public void detach() {
screen.removeElement(this); screen.removeElement(this);
} }

View File

@ -42,11 +42,11 @@ public class YTDownloadGUI extends BackgroundedGui implements Gui {
this.listener = listener; this.listener = listener;
this.screenHelper = screenHelper; this.screenHelper = screenHelper;
this.setIgnoreMouse(true); this.setIgnoreMouse(true);
this.setIsVisible(false); this.setAsContainerOnly();
create();
} }
private void create() { @Override
public void create() {
float startPointx = screenHelper.calcX(384f); float startPointx = screenHelper.calcX(384f);
float startPointy = screenHelper.calcY(324f); float startPointy = screenHelper.calcY(324f);
float labelFontSize = screenHelper.calcX(51.2f); float labelFontSize = screenHelper.calcX(51.2f);
@ -99,13 +99,16 @@ public class YTDownloadGUI extends BackgroundedGui implements Gui {
this.addChild(btnCancel); this.addChild(btnCancel);
} }
@Override
public void refresh() { public void refresh() {
} }
@Override
public void attach() { public void attach() {
screen.addElement(this); screen.addElement(this);
} }
@Override
public void detach() { public void detach() {
screen.removeElement(this); screen.removeElement(this);
} }

View File

@ -16,14 +16,10 @@
*/ */
package org.wyrez.shootingstars.gui.controls; package org.wyrez.shootingstars.gui.controls;
import com.jme3.input.event.MouseButtonEvent;
import com.jme3.input.event.MouseMotionEvent;
import com.jme3.math.Vector2f; import com.jme3.math.Vector2f;
import com.jme3.math.Vector4f; import com.jme3.math.Vector4f;
import tonegod.gui.controls.buttons.Button;
import tonegod.gui.controls.buttons.ButtonAdapter; import tonegod.gui.controls.buttons.ButtonAdapter;
import tonegod.gui.core.ElementManager; import tonegod.gui.core.ElementManager;
import tonegod.gui.core.Screen;
/** /**
* *

View File

@ -34,7 +34,7 @@ public class IndicatorBase extends Indicator {
} }
public IndicatorBase(ElementManager screen, Vector2f position, Vector2f dimensions, Orientation orientation) { public IndicatorBase(ElementManager screen, Vector2f position, Vector2f dimensions, Orientation orientation) {
super(screen, position, dimensions, orientation); super(screen, position, dimensions, orientation, true);
init(); init();
} }
@ -54,7 +54,7 @@ public class IndicatorBase extends Indicator {
} }
public IndicatorBase(ElementManager screen, String UID, Vector2f position, Vector2f dimensions, Vector4f resizeBorders, String defaultImg, Orientation orientation) { public IndicatorBase(ElementManager screen, String UID, Vector2f position, Vector2f dimensions, Vector4f resizeBorders, String defaultImg, Orientation orientation) {
super(screen, UID, position, dimensions, resizeBorders, defaultImg, orientation); super(screen, UID, position, dimensions, resizeBorders, defaultImg, orientation, true);
init(); init();
} }

View File

@ -25,13 +25,13 @@ import java.sql.ResultSet;
import java.text.DateFormat; import java.text.DateFormat;
import java.util.*; import java.util.*;
import org.wyrez.shootingstars.game.GameSettings; import org.wyrez.shootingstars.game.GameSettings;
import org.wyrez.shootingstars.gui.model.Score; import org.wyrez.shootingstars.gui.model.ClassicScore;
import org.wyrez.shootingstars.io.SQLiteConnector; import org.wyrez.shootingstars.io.SQLiteConnector;
import org.wyrez.shootingstars.states.util.OptionSettings; import org.wyrez.shootingstars.states.util.OptionSettings;
public class HighscoreManager { public class HighscoreManager {
private List<Score> scores; private List<ClassicScore> classicScores;
private Connection connection; private Connection connection;
private SQLiteConnector connector; private SQLiteConnector connector;
private ScoreComparator scoreComparator; private ScoreComparator scoreComparator;
@ -40,33 +40,35 @@ public class HighscoreManager {
this.connector = connector; this.connector = connector;
this.scoreComparator = scoreComparator; this.scoreComparator = scoreComparator;
connection = connector.initDBConnection(); connection = connector.initDBConnection();
scores = new ArrayList<Score>(); classicScores = new ArrayList<ClassicScore>();
loadScoreFile(); loadClassicScoreDB();
} }
public List<Score> getScores() { public List<ClassicScore> getClassicScores() {
sort(scores); sort(classicScores);
return scores; return classicScores;
} }
private void sort(List<Score> scores) { private void sort(List<ClassicScore> scores) {
Collections.sort(scores, scoreComparator); Collections.sort(scores, scoreComparator);
} }
public void addScore(GameSettings gameSettings, OptionSettings optionSettings, int score) { public void addScore(GameSettings gameSettings, OptionSettings optionSettings, int score) {
String songName = gameSettings.getTrackArtist() + " ~ " + gameSettings.getTrackTitle(); String songName = gameSettings.getTrackArtist() + " ~ " + gameSettings.getTrackTitle();
Date date = new Date(System.currentTimeMillis()); Date date = new Date(System.currentTimeMillis());
scores.add(new Score(songName, optionSettings.getUsername(), score, date));
updateScoreFile(optionSettings.getUsername(), score, songName, date);
classicScores.add(new ClassicScore(songName, optionSettings.getUsername(), score, date));
updateClassicScoreDB(optionSettings.getUsername(), score, songName, date);
} }
public List<Score> getScoresWithSongName(String songName) { public List<ClassicScore> getClassicScoresWithSongName(String songName) {
List<Score> tempScores = new ArrayList<Score>(); List<ClassicScore> tempScores = new ArrayList<ClassicScore>();
try { try {
ResultSet rs = connector.excecuteQuery(connection, "SELECT * FROM Scores WHERE LOWER(SongName) LIKE LOWER('%" + songName + "%');"); ResultSet rs = connector.excecuteQuery(connection, "SELECT * FROM ClassicScores WHERE LOWER(SongName) LIKE LOWER('%" + songName + "%');");
while (rs.next()) { while (rs.next()) {
tempScores.add(new Score(rs.getString("SongName"), rs.getString("Name"), rs.getInt("Points"), DateFormat.getDateTimeInstance().parse(rs.getString("GameDate")))); tempScores.add(new ClassicScore(rs.getString("SongName"), rs.getString("Name"), rs.getInt("Points"), DateFormat.getDateTimeInstance().parse(rs.getString("GameDate"))));
} }
rs.close(); rs.close();
} catch (Exception ex) { } catch (Exception ex) {
@ -75,20 +77,20 @@ public class HighscoreManager {
return tempScores; return tempScores;
} }
private void loadScoreFile() { private void loadClassicScoreDB() {
try { try {
ResultSet rs = connector.excecuteQuery(connection, "SELECT * FROM Scores;"); ResultSet rs = connector.excecuteQuery(connection, "SELECT * FROM ClassicScores;");
while (rs.next()) { while (rs.next()) {
scores.add(new Score(rs.getString("SongName"), rs.getString("Name"), rs.getInt("Points"), DateFormat.getDateTimeInstance().parse(rs.getString("GameDate")))); classicScores.add(new ClassicScore(rs.getString("SongName"), rs.getString("Name"), rs.getInt("Points"), DateFormat.getDateTimeInstance().parse(rs.getString("GameDate"))));
} }
rs.close(); rs.close();
} catch (Exception ex) { } catch (Exception ex) {
} }
} }
private void updateScoreFile(String name, int score, String songName, Date date) { private void updateClassicScoreDB(String name, int score, String songName, Date date) {
try { try {
connector.excecuteUpdate(connection, "INSERT INTO Scores(Name,Points,SongName,GameDate) values('" + name + "'," + score + ", '" + songName + "', '" + DateFormat.getDateTimeInstance().format(date) + "' )"); connector.excecuteUpdate(connection, "INSERT INTO ClassicScores(Name,Points,SongName,GameDate) values('" + name + "'," + score + ", '" + songName + "', '" + DateFormat.getDateTimeInstance().format(date) + "' )");
} catch (Exception ex) { } catch (Exception ex) {
} }
} }

View File

@ -21,11 +21,11 @@ package org.wyrez.shootingstars.gui.manager;
* @author Rappold * @author Rappold
*/ */
import java.util.Comparator; import java.util.Comparator;
import org.wyrez.shootingstars.gui.model.Score; import org.wyrez.shootingstars.gui.model.ClassicScore;
public class ScoreComparator implements Comparator<Score> { public class ScoreComparator implements Comparator<ClassicScore> {
public int compare(Score score1, Score score2) { public int compare(ClassicScore score1, ClassicScore score2) {
int sc1 = score1.getScore(); int sc1 = score1.getScore();
int sc2 = score2.getScore(); int sc2 = score2.getScore();

View File

@ -23,14 +23,14 @@ package org.wyrez.shootingstars.gui.model;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
public class Score implements Serializable { public class ClassicScore implements Serializable {
private int score; private int score;
private String playerName; private String playerName;
private String songName; private String songName;
private Date date; private Date date;
public Score(String songName, String playerName, int score, Date date) { public ClassicScore(String songName, String playerName, int score, Date date) {
this.songName = songName; this.songName = songName;
this.score = score; this.score = score;
this.playerName = playerName; this.playerName = playerName;

View File

@ -0,0 +1,12 @@
package org.wyrez.shootingstars.gui.model;
/**
*
* @author Snowsun
*/
public enum GameMode {
Classic,
RushEasy,
RushNormal,
RushHard
}

View File

@ -24,11 +24,13 @@ import java.io.File;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
public class SQLiteConnector { public class SQLiteConnector {
private static final String DB_PATH = "scoresdb.db"; private static final String DB_PATH = "scoresdb.db";
private static final String VERSION = "1.1";
public SQLiteConnector() { public SQLiteConnector() {
} }
@ -39,7 +41,6 @@ public class SQLiteConnector {
try { try {
Class.forName("org.sqlite.JDBC"); Class.forName("org.sqlite.JDBC");
String sqliteTable = "CREATE TABLE Scores (Name VARCHAR(250), Points INT(20), SongName VARCHAR(250), GameDate DATE)";
File sQLiteDb = new File(DB_PATH); File sQLiteDb = new File(DB_PATH);
if (!sQLiteDb.exists()) { if (!sQLiteDb.exists()) {
sQLiteDb.createNewFile(); sQLiteDb.createNewFile();
@ -48,10 +49,12 @@ public class SQLiteConnector {
connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH); connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH);
if(newFile) { if (newFile) {
Statement stmt = connection.createStatement(); createNewTables(connection);
stmt.executeUpdate(sqliteTable); } else {
updateTables(connection);
} }
return connection; return connection;
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
@ -59,6 +62,57 @@ public class SQLiteConnector {
return null; return null;
} }
private void createNewTables(Connection connection) throws SQLException {
Statement stmt = connection.createStatement();
String query = "CREATE TABLE ClassicScores (Name VARCHAR(250), Points INT(20), SongName VARCHAR(250), GameDate DATE)";
stmt.executeUpdate(query);
query = "CREATE TABLE RushScores (Name VARCHAR(250), Points INT(20), SongName VARCHAR(250), GameDate DATE, UsedTime INT(20))";
stmt.executeUpdate(query);
query = "CREATE TABLE Version (Number VARCHAR(20))";
stmt.executeUpdate(query);
query = "INSERT INTO Version (Number) values('" + VERSION + "')";
stmt.executeUpdate(query);
}
private void updateTables(Connection connection) throws SQLException {
Statement stmt = connection.createStatement();
String query = "SELECT name FROM sqlite_master WHERE type='table' AND name='Version';";
ResultSet resultSet = stmt.executeQuery(query);
if(resultSet.next()) { //DatabaseVersion 1.1 or higher
resultSet.close();
query = "Select Number From Version";
ResultSet rs = stmt.executeQuery(query);
if(rs.next()) {
String versionNumber = rs.getString("Number");
rs.close();
//todo stuff later here when tables are changed
}
rs.close();
} else { //DatabaseVersion 1.0
resultSet.close();
query = "ALTER TABLE Scores RENAME TO ClassicScores;";
stmt.executeUpdate(query);
query = "CREATE TABLE RushScores (Name VARCHAR(250), Points INT(20), SongName VARCHAR(250), GameDate DATE, UsedTime INT(20))";
stmt.executeUpdate(query);
query = "CREATE TABLE Version (Number VARCHAR(20))";
stmt.executeUpdate(query);
query = "INSERT INTO Version (Number) values('" + VERSION + "')";
stmt.executeUpdate(query);
}
}
public ResultSet excecuteQuery(Connection con, String query) { public ResultSet excecuteQuery(Connection con, String query) {
ResultSet result = null; ResultSet result = null;
try { try {

View File

@ -39,12 +39,15 @@ public class FileMetaInfoState extends AbstractAppState implements FileMetaInfoL
GameSettings settings, ScreenHelper screenHelper, AssetManager assetManager) { GameSettings settings, ScreenHelper screenHelper, AssetManager assetManager) {
this.stateManager = stateManager; this.stateManager = stateManager;
this.gui = new FileMetaInfoGUI(screen, this, settings, screenHelper, assetManager); this.gui = new FileMetaInfoGUI(screen, this, settings, screenHelper, assetManager);
this.gui.create();
} }
@Override
public void startLoading() { public void startLoading() {
stateManager.setState(State.LOADING); stateManager.setState(State.LOADING);
} }
@Override
public void cancel() { public void cancel() {
stateManager.setState(State.MENU); stateManager.setState(State.MENU);
} }

View File

@ -84,7 +84,9 @@ public class GameState extends AbstractAppState implements GameListener, ActionL
this.rootNode = rootNode; this.rootNode = rootNode;
this.audioDataManager = audioDataManager; this.audioDataManager = audioDataManager;
this.gui = new GameGUI(screen, this, screenHelper,audioDataManager); this.optionSettings = optionSettings;
this.gui = new GameGUI(screen, this, screenHelper,audioDataManager, optionSettings);
this.gui.create();
this.stateManager = stateManager; this.stateManager = stateManager;
inputManager.addListener(this, new String[]{"ESC"}); inputManager.addListener(this, new String[]{"ESC"});
@ -92,7 +94,6 @@ public class GameState extends AbstractAppState implements GameListener, ActionL
this.camera = camera; this.camera = camera;
this.assetManager = assetManager; this.assetManager = assetManager;
this.viewPort = viewPort; this.viewPort = viewPort;
this.optionSettings = optionSettings;
this.highscoreManager = highscoreManager; this.highscoreManager = highscoreManager;
this.settings = settings; this.settings = settings;
@ -147,6 +148,7 @@ public class GameState extends AbstractAppState implements GameListener, ActionL
player.setUserData(UserDataKeys.RUNNING, running); player.setUserData(UserDataKeys.RUNNING, running);
} }
@Override
public void start() { public void start() {
gui.setStart(); gui.setStart();
inputManager.setCursorVisible(false); inputManager.setCursorVisible(false);
@ -215,6 +217,7 @@ public class GameState extends AbstractAppState implements GameListener, ActionL
return isRunning; return isRunning;
} }
@Override
public void onAction(String name, boolean isPressed, float tpf) { public void onAction(String name, boolean isPressed, float tpf) {
if (name.equals("ESC") && !isPressed) { if (name.equals("ESC") && !isPressed) {
if (isRunning) { if (isRunning) {
@ -233,6 +236,7 @@ public class GameState extends AbstractAppState implements GameListener, ActionL
gui.showMenu(); gui.showMenu();
} }
@Override
public void resume() { public void resume() {
gui.resumeGame(); gui.resumeGame();
inputManager.setCursorVisible(false); inputManager.setCursorVisible(false);
@ -246,6 +250,7 @@ public class GameState extends AbstractAppState implements GameListener, ActionL
stateManager.setState(State.HIGHSCORE); stateManager.setState(State.HIGHSCORE);
} }
@Override
public void cancelTrack() { public void cancelTrack() {
stateManager.setState(State.MENU); stateManager.setState(State.MENU);
} }

View File

@ -41,9 +41,11 @@ public class HighscoreState extends AbstractAppState implements HighscoreListene
ScreenHelper screenHelper, BackgroundMusic music, AssetManager assetManager) { ScreenHelper screenHelper, BackgroundMusic music, AssetManager assetManager) {
this.stateManager = stateManager; this.stateManager = stateManager;
this.gui = new HighscoreGUI(screen, this, highscoreManager, screenHelper, assetManager); this.gui = new HighscoreGUI(screen, this, highscoreManager, screenHelper, assetManager);
this.gui.create();
this.music = music; this.music = music;
} }
@Override
public void back() { public void back() {
stateManager.setState(State.MENU); stateManager.setState(State.MENU);
} }

View File

@ -50,6 +50,7 @@ public class LoadingState extends AbstractAppState {
ScreenHelper screenHelper, BackgroundMusic music, AssetManager assetManager) { ScreenHelper screenHelper, BackgroundMusic music, AssetManager assetManager) {
this.stateManager = stateManager; this.stateManager = stateManager;
this.gui = new LoadingGui(screen, screenHelper, assetManager); this.gui = new LoadingGui(screen, screenHelper, assetManager);
this.gui.create();
this.audioDataManager = audioDataManager; this.audioDataManager = audioDataManager;
this.settings = settings; this.settings = settings;
this.music = music; this.music = music;

View File

@ -42,23 +42,32 @@ public class MenuState extends AbstractAppState implements MenuListener {
ScreenHelper screenHelper, BackgroundMusic music, AssetManager assetManager) { ScreenHelper screenHelper, BackgroundMusic music, AssetManager assetManager) {
this.stateManager = stateManager; this.stateManager = stateManager;
this.gui = new MenuGUI(screen, this, screenHelper, assetManager); this.gui = new MenuGUI(screen, this, screenHelper, assetManager);
this.gui.create();
this.shootingStars = shootingStars; this.shootingStars = shootingStars;
this.music = music; this.music = music;
} }
public Gui getGui() {
return gui;
}
@Override
public void selectFile() { public void selectFile() {
stateManager.setState(State.SELECTTRACK); stateManager.setState(State.SELECTTRACK);
} }
@Override
public void exitGame() { public void exitGame() {
shootingStars.stop(); shootingStars.stop();
System.exit(0); System.exit(0);
} }
@Override
public void openhighscore() { public void openhighscore() {
stateManager.setState(State.HIGHSCORE); stateManager.setState(State.HIGHSCORE);
} }
@Override
public void openOptions() { public void openOptions() {
stateManager.setState(State.OPTIONS); stateManager.setState(State.OPTIONS);
} }

View File

@ -19,7 +19,11 @@ package org.wyrez.shootingstars.states;
import com.jme3.app.state.AbstractAppState; import com.jme3.app.state.AbstractAppState;
import com.jme3.app.state.AppStateManager; import com.jme3.app.state.AppStateManager;
import com.jme3.asset.AssetManager; import com.jme3.asset.AssetManager;
import java.lang.reflect.InvocationTargetException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.wyrez.shootingstars.ShootingStars; import org.wyrez.shootingstars.ShootingStars;
import org.wyrez.shootingstars.gui.Gui;
import org.wyrez.shootingstars.gui.OptionsGUI; import org.wyrez.shootingstars.gui.OptionsGUI;
import org.wyrez.shootingstars.gui.listener.OptionsListener; import org.wyrez.shootingstars.gui.listener.OptionsListener;
import org.wyrez.shootingstars.helper.ScreenHelper; import org.wyrez.shootingstars.helper.ScreenHelper;
@ -46,6 +50,7 @@ public class OptionsState extends AbstractAppState implements OptionsListener {
this.stateManager = stateManager; this.stateManager = stateManager;
this.settings = settings; this.settings = settings;
this.gui = new OptionsGUI(screen, this, settings, screenHelper, assetManager); this.gui = new OptionsGUI(screen, this, settings, screenHelper, assetManager);
this.gui.create();
this.music = music; this.music = music;
} }
@ -59,6 +64,7 @@ public class OptionsState extends AbstractAppState implements OptionsListener {
gui.detach(); gui.detach();
} }
@Override
public void save() { public void save() {
shootingStars.setSettings(settings.getAppSettings()); shootingStars.setSettings(settings.getAppSettings());
shootingStars.restart(); shootingStars.restart();
@ -66,6 +72,7 @@ public class OptionsState extends AbstractAppState implements OptionsListener {
music.update(); music.update();
} }
@Override
public void cancel() { public void cancel() {
stateManager.setState(State.MENU); stateManager.setState(State.MENU);
} }

View File

@ -60,6 +60,7 @@ public class SelectTrackState extends AbstractAppState implements SelectFileList
this.stateManager = stateManager; this.stateManager = stateManager;
this.settings = settings; this.settings = settings;
this.gui = new SelectTrackGUI(screen, this, screenHelper, assetManager); this.gui = new SelectTrackGUI(screen, this, screenHelper, assetManager);
this.gui.create();
} }
@Override @Override
@ -130,6 +131,7 @@ public class SelectTrackState extends AbstractAppState implements SelectFileList
} }
} }
@Override
public void selectFile() { public void selectFile() {
wasFullscreen = optionSettings.isFullscreenEnabled(); wasFullscreen = optionSettings.isFullscreenEnabled();
selectState = 0; selectState = 0;
@ -138,6 +140,7 @@ public class SelectTrackState extends AbstractAppState implements SelectFileList
private void readMetadata(String file) { private void readMetadata(String file) {
MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory("--no-video-title-show", "--quiet"); MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory("--no-video-title-show", "--quiet");
DirectMediaPlayer mediaPlayer = mediaPlayerFactory.newDirectMediaPlayer(1, 1, new RenderCallback() { DirectMediaPlayer mediaPlayer = mediaPlayerFactory.newDirectMediaPlayer(1, 1, new RenderCallback() {
@Override
public void display(DirectMediaPlayer dmp, Memory[] memorys, BufferFormat bf) { public void display(DirectMediaPlayer dmp, Memory[] memorys, BufferFormat bf) {
} }
}); });
@ -158,10 +161,12 @@ public class SelectTrackState extends AbstractAppState implements SelectFileList
mediaPlayerFactory.release(); mediaPlayerFactory.release();
} }
@Override
public void downloadYT() { public void downloadYT() {
stateManager.setState(State.YTDOWNLOAD); stateManager.setState(State.YTDOWNLOAD);
} }
@Override
public void cancel() { public void cancel() {
stateManager.setState(State.MENU); stateManager.setState(State.MENU);
} }

View File

@ -59,6 +59,7 @@ public class YTDownloadState extends AbstractAppState implements YTDownloadListe
this.stateManager = stateManager; this.stateManager = stateManager;
this.settings = settings; this.settings = settings;
this.gui = new YTDownloadGUI(screen, this, screenHelper, assetManager); this.gui = new YTDownloadGUI(screen, this, screenHelper, assetManager);
this.gui.create();
this.downloader = downloader; this.downloader = downloader;
} }
@ -72,6 +73,7 @@ public class YTDownloadState extends AbstractAppState implements YTDownloadListe
gui.detach(); gui.detach();
} }
@Override
public void downloadYTVideo(String url) { public void downloadYTVideo(String url) {
try { try {
Matcher matcher = YT_LINK_PATTERN.matcher(url); Matcher matcher = YT_LINK_PATTERN.matcher(url);
@ -119,6 +121,7 @@ public class YTDownloadState extends AbstractAppState implements YTDownloadListe
private void readMetadata() { private void readMetadata() {
MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory("--no-video-title-show", "--quiet"); MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory("--no-video-title-show", "--quiet");
DirectMediaPlayer mediaPlayer = mediaPlayerFactory.newDirectMediaPlayer(1, 1, new RenderCallback() { DirectMediaPlayer mediaPlayer = mediaPlayerFactory.newDirectMediaPlayer(1, 1, new RenderCallback() {
@Override
public void display(DirectMediaPlayer dmp, Memory[] memorys, BufferFormat bf) { public void display(DirectMediaPlayer dmp, Memory[] memorys, BufferFormat bf) {
} }
}); });
@ -141,6 +144,7 @@ public class YTDownloadState extends AbstractAppState implements YTDownloadListe
mediaPlayerFactory.release(); mediaPlayerFactory.release();
} }
@Override
public void cancel() { public void cancel() {
stateManager.setState(State.MENU); stateManager.setState(State.MENU);
} }

View File

@ -81,6 +81,7 @@ public class OptionSettings {
setShowWeapon(true); setShowWeapon(true);
setVSync(true); setVSync(true);
setEnableAudioVisualization(true); setEnableAudioVisualization(true);
setGameMode(0);
} }
} }
@ -152,6 +153,10 @@ public class OptionSettings {
settings.putString("ThirdLastPlayedTrack", thirdLastPlayedTrack); settings.putString("ThirdLastPlayedTrack", thirdLastPlayedTrack);
} }
public void setGameMode(int gameMode) {
settings.putInteger("GameMode", gameMode);
}
public String getUsername() { public String getUsername() {
return settings.getString("Username"); return settings.getString("Username");
} }
@ -220,6 +225,10 @@ public class OptionSettings {
return settings.getString("ThirdLastPlayedTrack"); return settings.getString("ThirdLastPlayedTrack");
} }
public int getGameMode() {
return settings.getInteger("GameMode");
}
public void save() { public void save() {
try { try {
OutputStream os = new FileOutputStream(PathHelper.CONFIG); OutputStream os = new FileOutputStream(PathHelper.CONFIG);