From fae5cc1d77590caff6f9c1f2abfbe0a90e3d2173 Mon Sep 17 00:00:00 2001 From: tferrari25 Date: Wed, 10 May 2023 23:26:13 -0400 Subject: Downgrade to JavaFX 15.0.1 and add Windows configs --- .classpath | 36 ++-- .settings/org.eclipse.jdt.core.prefs | 1 + Driver.java | 21 -- NoteField.java | 34 ---- NoteInfo.java | 22 -- Score.java | 51 ----- SongPlayer.java | 225 --------------------- Timer.java | 15 -- lib/javafx-swt.jar | Bin 37117 -> 0 bytes lib/javafx.base.jar | Bin 755038 -> 0 bytes lib/javafx.controls.jar | Bin 2577993 -> 0 bytes lib/javafx.fxml.jar | Bin 130176 -> 0 bytes lib/javafx.graphics.jar | Bin 4339873 -> 0 bytes lib/javafx.media.jar | Bin 278549 -> 0 bytes lib/javafx.properties | 3 - lib/javafx.swing.jar | Bin 89688 -> 0 bytes lib/javafx.web.jar | Bin 727749 -> 0 bytes lib/libavplugin-54.so | Bin 52160 -> 0 bytes lib/libavplugin-56.so | Bin 52360 -> 0 bytes lib/libavplugin-57.so | Bin 52360 -> 0 bytes lib/libavplugin-ffmpeg-56.so | Bin 52360 -> 0 bytes lib/libavplugin-ffmpeg-57.so | Bin 52360 -> 0 bytes lib/libavplugin-ffmpeg-58.so | Bin 52360 -> 0 bytes lib/libavplugin-ffmpeg-59.so | Bin 52272 -> 0 bytes lib/libdecora_sse.so | Bin 73672 -> 0 bytes lib/libfxplugins.so | Bin 51752 -> 0 bytes lib/libglass.so | Bin 11568 -> 0 bytes lib/libglassgtk2.so | Bin 328520 -> 0 bytes lib/libglassgtk3.so | Bin 328864 -> 0 bytes lib/libgstreamer-lite.so | Bin 2187712 -> 0 bytes lib/libjavafx_font.so | Bin 15992 -> 0 bytes lib/libjavafx_font_freetype.so | Bin 25928 -> 0 bytes lib/libjavafx_font_pango.so | Bin 24424 -> 0 bytes lib/libjavafx_iio.so | Bin 140496 -> 0 bytes lib/libjfxmedia.so | Bin 530144 -> 0 bytes lib/libjfxwebkit.so | Bin 99198016 -> 0 bytes lib/libprism_common.so | Bin 7048 -> 0 bytes lib/libprism_es2.so | Bin 62480 -> 0 bytes lib/libprism_sw.so | Bin 64960 -> 0 bytes lib/linux/javafx-swt.jar | Bin 0 -> 37118 bytes lib/linux/javafx.base.jar | Bin 0 -> 745370 bytes lib/linux/javafx.controls.jar | Bin 0 -> 2531099 bytes lib/linux/javafx.fxml.jar | Bin 0 -> 128790 bytes lib/linux/javafx.graphics.jar | Bin 0 -> 4409913 bytes lib/linux/javafx.media.jar | Bin 0 -> 266912 bytes lib/linux/javafx.properties | 3 + lib/linux/javafx.swing.jar | Bin 0 -> 88725 bytes lib/linux/javafx.web.jar | Bin 0 -> 725645 bytes lib/linux/libavplugin-54.so | Bin 0 -> 51568 bytes lib/linux/libavplugin-56.so | Bin 0 -> 51592 bytes lib/linux/libavplugin-57.so | Bin 0 -> 51592 bytes lib/linux/libavplugin-ffmpeg-56.so | Bin 0 -> 51720 bytes lib/linux/libavplugin-ffmpeg-57.so | Bin 0 -> 51592 bytes lib/linux/libavplugin-ffmpeg-58.so | Bin 0 -> 51592 bytes lib/linux/libdecora_sse.so | Bin 0 -> 70624 bytes lib/linux/libfxplugins.so | Bin 0 -> 51016 bytes lib/linux/libglass.so | Bin 0 -> 12928 bytes lib/linux/libglassgtk2.so | Bin 0 -> 522752 bytes lib/linux/libglassgtk3.so | Bin 0 -> 522976 bytes lib/linux/libgstreamer-lite.so | Bin 0 -> 2248752 bytes lib/linux/libjavafx_font.so | Bin 0 -> 16928 bytes lib/linux/libjavafx_font_freetype.so | Bin 0 -> 27368 bytes lib/linux/libjavafx_font_pango.so | Bin 0 -> 25496 bytes lib/linux/libjavafx_iio.so | Bin 0 -> 256344 bytes lib/linux/libjfxmedia.so | Bin 0 -> 520504 bytes lib/linux/libjfxwebkit.so | Bin 0 -> 98926456 bytes lib/linux/libprism_common.so | Bin 0 -> 59136 bytes lib/linux/libprism_es2.so | Bin 0 -> 63856 bytes lib/linux/libprism_sw.so | Bin 0 -> 71432 bytes lib/windows/bin/api-ms-win-core-console-l1-1-0.dll | Bin 0 -> 21032 bytes lib/windows/bin/api-ms-win-core-console-l1-2-0.dll | Bin 0 -> 21024 bytes .../bin/api-ms-win-core-datetime-l1-1-0.dll | Bin 0 -> 20512 bytes lib/windows/bin/api-ms-win-core-debug-l1-1-0.dll | Bin 0 -> 20544 bytes .../bin/api-ms-win-core-errorhandling-l1-1-0.dll | Bin 0 -> 20520 bytes lib/windows/bin/api-ms-win-core-file-l1-1-0.dll | Bin 0 -> 24104 bytes lib/windows/bin/api-ms-win-core-file-l1-2-0.dll | Bin 0 -> 20520 bytes lib/windows/bin/api-ms-win-core-file-l2-1-0.dll | Bin 0 -> 20520 bytes lib/windows/bin/api-ms-win-core-handle-l1-1-0.dll | Bin 0 -> 20520 bytes lib/windows/bin/api-ms-win-core-heap-l1-1-0.dll | Bin 0 -> 21032 bytes .../bin/api-ms-win-core-interlocked-l1-1-0.dll | Bin 0 -> 20520 bytes .../bin/api-ms-win-core-libraryloader-l1-1-0.dll | Bin 0 -> 21568 bytes .../bin/api-ms-win-core-localization-l1-2-0.dll | Bin 0 -> 23080 bytes lib/windows/bin/api-ms-win-core-memory-l1-1-0.dll | Bin 0 -> 21032 bytes .../bin/api-ms-win-core-namedpipe-l1-1-0.dll | Bin 0 -> 20520 bytes .../api-ms-win-core-processenvironment-l1-1-0.dll | Bin 0 -> 21544 bytes .../bin/api-ms-win-core-processthreads-l1-1-0.dll | Bin 0 -> 22560 bytes .../bin/api-ms-win-core-processthreads-l1-1-1.dll | Bin 0 -> 21056 bytes lib/windows/bin/api-ms-win-core-profile-l1-1-0.dll | Bin 0 -> 20008 bytes .../bin/api-ms-win-core-rtlsupport-l1-1-0.dll | Bin 0 -> 21056 bytes lib/windows/bin/api-ms-win-core-string-l1-1-0.dll | Bin 0 -> 20520 bytes lib/windows/bin/api-ms-win-core-synch-l1-1-0.dll | Bin 0 -> 22568 bytes lib/windows/bin/api-ms-win-core-synch-l1-2-0.dll | Bin 0 -> 21032 bytes lib/windows/bin/api-ms-win-core-sysinfo-l1-1-0.dll | Bin 0 -> 21544 bytes .../bin/api-ms-win-core-timezone-l1-1-0.dll | Bin 0 -> 21032 bytes lib/windows/bin/api-ms-win-core-util-l1-1-0.dll | Bin 0 -> 20520 bytes lib/windows/bin/api-ms-win-crt-conio-l1-1-0.dll | Bin 0 -> 21544 bytes lib/windows/bin/api-ms-win-crt-convert-l1-1-0.dll | Bin 0 -> 24616 bytes .../bin/api-ms-win-crt-environment-l1-1-0.dll | Bin 0 -> 21032 bytes .../bin/api-ms-win-crt-filesystem-l1-1-0.dll | Bin 0 -> 22568 bytes lib/windows/bin/api-ms-win-crt-heap-l1-1-0.dll | Bin 0 -> 21544 bytes lib/windows/bin/api-ms-win-crt-locale-l1-1-0.dll | Bin 0 -> 21032 bytes lib/windows/bin/api-ms-win-crt-math-l1-1-0.dll | Bin 0 -> 29528 bytes .../bin/api-ms-win-crt-multibyte-l1-1-0.dll | Bin 0 -> 28736 bytes lib/windows/bin/api-ms-win-crt-private-l1-1-0.dll | Bin 0 -> 73048 bytes lib/windows/bin/api-ms-win-crt-process-l1-1-0.dll | Bin 0 -> 21568 bytes lib/windows/bin/api-ms-win-crt-runtime-l1-1-0.dll | Bin 0 -> 25128 bytes lib/windows/bin/api-ms-win-crt-stdio-l1-1-0.dll | Bin 0 -> 26664 bytes lib/windows/bin/api-ms-win-crt-string-l1-1-0.dll | Bin 0 -> 26664 bytes lib/windows/bin/api-ms-win-crt-time-l1-1-0.dll | Bin 0 -> 23080 bytes lib/windows/bin/api-ms-win-crt-utility-l1-1-0.dll | Bin 0 -> 21032 bytes lib/windows/bin/decora_sse.dll | Bin 0 -> 81408 bytes lib/windows/bin/fxplugins.dll | Bin 0 -> 119296 bytes lib/windows/bin/glass.dll | Bin 0 -> 264704 bytes lib/windows/bin/glib-lite.dll | Bin 0 -> 611840 bytes lib/windows/bin/gstreamer-lite.dll | Bin 0 -> 901632 bytes lib/windows/bin/javafx_font.dll | Bin 0 -> 67072 bytes lib/windows/bin/javafx_iio.dll | Bin 0 -> 159232 bytes lib/windows/bin/jfxmedia.dll | Bin 0 -> 137216 bytes lib/windows/bin/jfxwebkit.dll | Bin 0 -> 60861440 bytes lib/windows/bin/msvcp140.dll | Bin 0 -> 627440 bytes lib/windows/bin/prism_common.dll | Bin 0 -> 55808 bytes lib/windows/bin/prism_d3d.dll | Bin 0 -> 124928 bytes lib/windows/bin/prism_sw.dll | Bin 0 -> 92672 bytes lib/windows/bin/ucrtbase.dll | Bin 0 -> 1026088 bytes lib/windows/bin/vcruntime140.dll | Bin 0 -> 85232 bytes lib/windows/lib/javafx-swt.jar | Bin 0 -> 37110 bytes lib/windows/lib/javafx.base.jar | Bin 0 -> 745369 bytes lib/windows/lib/javafx.controls.jar | Bin 0 -> 2531028 bytes lib/windows/lib/javafx.fxml.jar | Bin 0 -> 128790 bytes lib/windows/lib/javafx.graphics.jar | Bin 0 -> 4341110 bytes lib/windows/lib/javafx.media.jar | Bin 0 -> 266912 bytes lib/windows/lib/javafx.properties | 3 + lib/windows/lib/javafx.swing.jar | Bin 0 -> 88725 bytes lib/windows/lib/javafx.web.jar | Bin 0 -> 725645 bytes lib/windows/lib/src.zip | Bin 0 -> 6707232 bytes src/fallTest/Driver.java | 2 +- src/fallTest/Score.java | 10 +- src/fallTest/SongPlayer.java | 221 +++++++++++++------- 138 files changed, 183 insertions(+), 464 deletions(-) delete mode 100644 Driver.java delete mode 100644 NoteField.java delete mode 100644 NoteInfo.java delete mode 100644 Score.java delete mode 100644 SongPlayer.java delete mode 100644 Timer.java delete mode 100644 lib/javafx-swt.jar delete mode 100644 lib/javafx.base.jar delete mode 100644 lib/javafx.controls.jar delete mode 100644 lib/javafx.fxml.jar delete mode 100644 lib/javafx.graphics.jar delete mode 100644 lib/javafx.media.jar delete mode 100644 lib/javafx.properties delete mode 100644 lib/javafx.swing.jar delete mode 100644 lib/javafx.web.jar delete mode 100755 lib/libavplugin-54.so delete mode 100755 lib/libavplugin-56.so delete mode 100755 lib/libavplugin-57.so delete mode 100755 lib/libavplugin-ffmpeg-56.so delete mode 100755 lib/libavplugin-ffmpeg-57.so delete mode 100755 lib/libavplugin-ffmpeg-58.so delete mode 100755 lib/libavplugin-ffmpeg-59.so delete mode 100755 lib/libdecora_sse.so delete mode 100755 lib/libfxplugins.so delete mode 100755 lib/libglass.so delete mode 100755 lib/libglassgtk2.so delete mode 100755 lib/libglassgtk3.so delete mode 100755 lib/libgstreamer-lite.so delete mode 100755 lib/libjavafx_font.so delete mode 100755 lib/libjavafx_font_freetype.so delete mode 100755 lib/libjavafx_font_pango.so delete mode 100755 lib/libjavafx_iio.so delete mode 100755 lib/libjfxmedia.so delete mode 100755 lib/libjfxwebkit.so delete mode 100755 lib/libprism_common.so delete mode 100755 lib/libprism_es2.so delete mode 100755 lib/libprism_sw.so create mode 100644 lib/linux/javafx-swt.jar create mode 100644 lib/linux/javafx.base.jar create mode 100644 lib/linux/javafx.controls.jar create mode 100644 lib/linux/javafx.fxml.jar create mode 100644 lib/linux/javafx.graphics.jar create mode 100644 lib/linux/javafx.media.jar create mode 100644 lib/linux/javafx.properties create mode 100644 lib/linux/javafx.swing.jar create mode 100644 lib/linux/javafx.web.jar create mode 100644 lib/linux/libavplugin-54.so create mode 100644 lib/linux/libavplugin-56.so create mode 100644 lib/linux/libavplugin-57.so create mode 100644 lib/linux/libavplugin-ffmpeg-56.so create mode 100644 lib/linux/libavplugin-ffmpeg-57.so create mode 100644 lib/linux/libavplugin-ffmpeg-58.so create mode 100644 lib/linux/libdecora_sse.so create mode 100644 lib/linux/libfxplugins.so create mode 100644 lib/linux/libglass.so create mode 100644 lib/linux/libglassgtk2.so create mode 100644 lib/linux/libglassgtk3.so create mode 100644 lib/linux/libgstreamer-lite.so create mode 100644 lib/linux/libjavafx_font.so create mode 100644 lib/linux/libjavafx_font_freetype.so create mode 100644 lib/linux/libjavafx_font_pango.so create mode 100644 lib/linux/libjavafx_iio.so create mode 100644 lib/linux/libjfxmedia.so create mode 100644 lib/linux/libjfxwebkit.so create mode 100644 lib/linux/libprism_common.so create mode 100644 lib/linux/libprism_es2.so create mode 100644 lib/linux/libprism_sw.so create mode 100644 lib/windows/bin/api-ms-win-core-console-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-core-console-l1-2-0.dll create mode 100644 lib/windows/bin/api-ms-win-core-datetime-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-core-debug-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-core-errorhandling-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-core-file-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-core-file-l1-2-0.dll create mode 100644 lib/windows/bin/api-ms-win-core-file-l2-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-core-handle-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-core-heap-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-core-interlocked-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-core-libraryloader-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-core-localization-l1-2-0.dll create mode 100644 lib/windows/bin/api-ms-win-core-memory-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-core-namedpipe-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-core-processenvironment-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-core-processthreads-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-core-processthreads-l1-1-1.dll create mode 100644 lib/windows/bin/api-ms-win-core-profile-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-core-rtlsupport-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-core-string-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-core-synch-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-core-synch-l1-2-0.dll create mode 100644 lib/windows/bin/api-ms-win-core-sysinfo-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-core-timezone-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-core-util-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-crt-conio-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-crt-convert-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-crt-environment-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-crt-filesystem-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-crt-heap-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-crt-locale-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-crt-math-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-crt-multibyte-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-crt-private-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-crt-process-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-crt-runtime-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-crt-stdio-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-crt-string-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-crt-time-l1-1-0.dll create mode 100644 lib/windows/bin/api-ms-win-crt-utility-l1-1-0.dll create mode 100644 lib/windows/bin/decora_sse.dll create mode 100644 lib/windows/bin/fxplugins.dll create mode 100644 lib/windows/bin/glass.dll create mode 100644 lib/windows/bin/glib-lite.dll create mode 100644 lib/windows/bin/gstreamer-lite.dll create mode 100644 lib/windows/bin/javafx_font.dll create mode 100644 lib/windows/bin/javafx_iio.dll create mode 100644 lib/windows/bin/jfxmedia.dll create mode 100644 lib/windows/bin/jfxwebkit.dll create mode 100644 lib/windows/bin/msvcp140.dll create mode 100644 lib/windows/bin/prism_common.dll create mode 100644 lib/windows/bin/prism_d3d.dll create mode 100644 lib/windows/bin/prism_sw.dll create mode 100644 lib/windows/bin/ucrtbase.dll create mode 100644 lib/windows/bin/vcruntime140.dll create mode 100644 lib/windows/lib/javafx-swt.jar create mode 100644 lib/windows/lib/javafx.base.jar create mode 100644 lib/windows/lib/javafx.controls.jar create mode 100644 lib/windows/lib/javafx.fxml.jar create mode 100644 lib/windows/lib/javafx.graphics.jar create mode 100644 lib/windows/lib/javafx.media.jar create mode 100644 lib/windows/lib/javafx.properties create mode 100644 lib/windows/lib/javafx.swing.jar create mode 100644 lib/windows/lib/javafx.web.jar create mode 100644 lib/windows/lib/src.zip diff --git a/.classpath b/.classpath index a94ee04..7167265 100644 --- a/.classpath +++ b/.classpath @@ -1,18 +1,18 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index f2525a8..a58ebdc 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,5 +1,6 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=11 diff --git a/Driver.java b/Driver.java deleted file mode 100644 index 2319412..0000000 --- a/Driver.java +++ /dev/null @@ -1,21 +0,0 @@ -/*Name: - *Date: - *Period: - *Teacher: - *Description: - */ -package cs; - - -public class Driver -{ - - public static void main(String[] args) - { - // TODO Auto-generated method stub - SongPlayer g = new SongPlayer(); - g.loadSong(); - g.createAndShowGui(); - } - -} diff --git a/NoteField.java b/NoteField.java deleted file mode 100644 index b54e33a..0000000 --- a/NoteField.java +++ /dev/null @@ -1,34 +0,0 @@ -/*Name: Guitar Hero Project - *Description: Contains the information for a single note on the field - */ -package cs; - -public class NoteField -{ - private boolean failed = false; - private final int NOTESPEED = 5; - private int yPos = SongPlayer.HEIGHT; - - public void gameTick() { - if (!failed) { - if (yPos > 0) { - yPos -= NOTESPEED; - } - else { - failed = true; - } - } - } - - public int goalDistance() { - return (yPos-((SongPlayer.HEIGHT)/6)); - } - - public boolean getFailed() { - return failed; - } - - public int getY() { - return yPos; - } -} diff --git a/NoteInfo.java b/NoteInfo.java deleted file mode 100644 index 538b31b..0000000 --- a/NoteInfo.java +++ /dev/null @@ -1,22 +0,0 @@ -/*Name: Guitar Hero Project - *Description: Contains the info for when to send a note - */ -package cs; - - -public class NoteInfo -{ - private int sendTime; - - public NoteInfo(int t) { - sendTime = t; - } - - public int getTime() { - return sendTime; - } - - public int compareTo(NoteInfo other) { - return sendTime - other.sendTime; - } -} diff --git a/Score.java b/Score.java deleted file mode 100644 index 9d31c9a..0000000 --- a/Score.java +++ /dev/null @@ -1,51 +0,0 @@ -/*Name: Guitar Hero Project - *Description: Handles all the scoring for playing songs - */ -package cs; - - -public class Score -{ - private int combo=0; - private int comboMultiplier=1; - private int score=0; - - public void perfect() { - score += 300*comboMultiplier; - System.out.println("Perfect!"); - } - - public void close() { - score += 100*comboMultiplier; - System.out.println("Good"); - } - - public void miss() { - combo = 0; - comboMultiplier = 1; - System.out.println("Miss"); - } - public void combo() { - combo++; - - if (combo == 2) { - comboMultiplier = 2; - } - - if (combo == 4) { - comboMultiplier = 4; - } - - if (combo == 8) { - comboMultiplier = 8; - } - } - - public int getScore() { - return score; - } - - public int getCombo() { - return combo; - } -} diff --git a/SongPlayer.java b/SongPlayer.java deleted file mode 100644 index 065e777..0000000 --- a/SongPlayer.java +++ /dev/null @@ -1,225 +0,0 @@ -/*Name: Guitar Hero Project - *Description: Contains the main game loop for gameplay - */ -package cs; - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import java.util.*; - -public class SongPlayer -{ - Timer time = new Timer(); - - public static final int HEIGHT = 650; - public static final int LENGTH = 400; - - private final int BLENGTH = LENGTH/7; - private final int BHEIGHT = HEIGHT/20; - - JFrame frame = new JFrame("Guitar Hero"); //creates the frame - - JButton d = new JButton("D"); //button declarations - JButton f = new JButton("F"); - JButton space= new JButton("SPC"); - JButton j = new JButton("J"); - JButton k = new JButton("K"); - - Queue dSends = new LinkedList(); //Queue that dictates when to send the notes - ArrayList dLane = new ArrayList(); //Array list containing all the notes currently on the field - ArrayList dVis = new ArrayList(); //Array list containing the visual representations of the notes in lanes - - Queue fSends = new LinkedList(); - ArrayList fLane = new ArrayList(); - ArrayList fVis = new ArrayList(); - - Queue spaceSends = new LinkedList(); - ArrayList spaceLane = new ArrayList(); - ArrayList spaceVis = new ArrayList(); - - Queue jSends = new LinkedList(); - ArrayList jLane = new ArrayList(); - ArrayList jVis = new ArrayList(); - - Queue kSends = new LinkedList(); - ArrayList kLane = new ArrayList(); - ArrayList kVis = new ArrayList(); - - Score score = new Score(); - - /** - * Establishes what the chart for the song is going to look like - */ - public void loadSong() { - dSends.add(new NoteInfo(4000)); - dSends.add(new NoteInfo(4333)); - dSends.add(new NoteInfo(4666)); - fSends.add(new NoteInfo(5000)); - kSends.add(new NoteInfo(5500)); - spaceSends.add(new NoteInfo(6000)); - jSends.add(new NoteInfo(6000)); - jSends.add(new NoteInfo(6250)); - dSends.add(new NoteInfo(6500)); - jSends.add(new NoteInfo(6750)); - spaceSends.add(new NoteInfo(7000)); - fSends.add(new NoteInfo(7500)); - jSends.add(new NoteInfo(7750)); - spaceSends.add(new NoteInfo(8000)); - fSends.add(new NoteInfo(8500)); - jSends.add(new NoteInfo(8500)); - dSends.add(new NoteInfo(9000)); - spaceSends.add(new NoteInfo(9000)); - kSends.add(new NoteInfo(9000)); - spaceSends.add(new NoteInfo(9500)); - - kSends.add(new NoteInfo(10000)); - dSends.add(new NoteInfo(10000)); - kSends.add(new NoteInfo(10333)); - fSends.add(new NoteInfo(10333)); - kSends.add(new NoteInfo(10666)); - spaceSends.add(new NoteInfo(10666)); - dSends.add(new NoteInfo(11000)); - spaceSends.add(new NoteInfo(11000)); - dSends.add(new NoteInfo(11333)); - jSends.add(new NoteInfo(11333)); - dSends.add(new NoteInfo(11666)); - kSends.add(new NoteInfo(11666)); - spaceSends.add(new NoteInfo(12000)); - } - - - /** - * Creates the GUI used to play the game - */ - public void createAndShowGui() { - - d.setBounds(1*BLENGTH, (5*HEIGHT)/6, BLENGTH, BHEIGHT); //makes the button bounds for each button - f.setBounds(2*BLENGTH, (5*HEIGHT)/6, BLENGTH, BHEIGHT); - space.setBounds(3*BLENGTH, (5*HEIGHT)/6, BLENGTH, BHEIGHT); - j.setBounds(4*BLENGTH, (5*HEIGHT)/6, BLENGTH, BHEIGHT); - k.setBounds(5*BLENGTH, (5*HEIGHT)/6, BLENGTH, BHEIGHT); - d.setFocusable(false); //makes it so you can't focus on the button - f.setFocusable(false); - space.setFocusable(false); - j.setFocusable(false); - k.setFocusable(false); - - - frame.add(d); //adds the buttons to the frame - frame.add(f); - frame.add(space); - frame.add(j); - frame.add(k); - - frame.setSize(LENGTH, HEIGHT); //sets the size of the frame - frame.setLayout(null); - frame.setVisible(true); //makes the frame visible - - - while (true) { //TRY TO FIND A BETTER SOLUTION FOR THIS?? maybe something like sends.size() > 0 || lanes.size() > 0 - - update(d, dSends, dLane, dVis, 'd', "dPress", 1); //updates the provided lane - update(f, fSends, fLane, fVis, 'f', "fPress", 2); - update(space, spaceSends, spaceLane, spaceVis, ' ', "spacePress", 3); - update(j, jSends, jLane, jVis, 'j', "jPress", 4); - update(k, kSends, kLane, kVis, 'k', "kPress", 5); - - frame.repaint(); //updates the visuals every frame - - try { - Thread.sleep(10); //THIS IS PROBABLY NOT THE BEST WAY TO DO THIS - } catch (InterruptedException e) - { - e.printStackTrace(); - } - } - } - - /** - * Updates a lane. An update involves: - * Checking to see if a note needs to be sent down a lane - * Checking to see if the user hit the button - * Checking to see if any notes have moved past the lane - * @param sends The sending queue for the given lane - * @param lane The place where note information is stored for notes currently in that lane - * @param vis The place where the visual representation for a note is stored in that lane - * @param key The button on the keyboard corresponding to the button for the lane being updated - * @param id The id for the action map - * @param k The lane number - */ - private void update(JButton button, Queue sends, ArrayList lane, ArrayList vis, char key, String id, int k) { - if (!sends.isEmpty() && sends.peek().getTime()-time.time()<3) { //checks if any notes in the queue need to be sent at this time - lane.add(new NoteField()); //adds that note's information to the lane list - - vis.add(new JButton()); //creates a visual representation of that note in the visualizer list - frame.add(vis.get(vis.size()-1)); - - sends.remove(); //removes the note just sent from the sending queue - } - - if (lane.size() > 0) { //if there are any notes in the lanes, tests for a button press - button.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(key), id); //Input map and Action map setting - button.getActionMap().put(id, new AbstractAction() { //Defines what happens when the proper button is pressed - public void actionPerformed(ActionEvent e) - { - if (lane.size() > 0) { - int i = getClosestNote(lane); - int dist = (int)Math.abs(lane.get(i).goalDistance()); - - lane.remove(i); //removes the notes and visual representation from the playing field when the button is pressed - frame.remove(vis.get(i)); - vis.remove(i); - - if (dist > 2*BHEIGHT) { //Determines what to add to the score depending on the proximity of the note - score.miss(); - } - else if (dist > BHEIGHT) { - score.combo(); - score.close(); - } - else { - score.combo(); - score.perfect(); - } - - System.out.println("Score: " + score.getScore() + " Combo: " + score.getCombo()); - } - } - }); - } - - for (int i=0; i 0 && lane.get(i).getFailed()) { //if the note has passed into the fail boundary, removes the note from the field - score.miss(); - System.out.println(score.getScore() + " Combo: " + score.getCombo()); - - - lane.remove(i); - frame.remove(vis.get(i)); - vis.remove(i); - - i--; - } - } - } - - /** - * Finds the note closest to the goal - * @return the location in the array list of the closest note - */ - private int getClosestNote(ArrayList searchLane) { - int pos = 0; - - for (int i=0; i sends = new LinkedList(); //Queue that dictates when to send the notes - ArrayList lanes = new ArrayList(); //Array list containing all the notes currently on the field - ArrayList vis = new ArrayList(); //Array list containing the visual representations of the notes in lanes + JButton d = new JButton("D"); //button declarations + JButton f = new JButton("F"); + JButton space= new JButton("SPC"); + JButton j = new JButton("J"); + JButton k = new JButton("K"); + + Queue dSends = new LinkedList(); //Queue that dictates when to send the notes + ArrayList dLane = new ArrayList(); //Array list containing all the notes currently on the field + ArrayList dVis = new ArrayList(); //Array list containing the visual representations of the notes in lanes + Queue fSends = new LinkedList(); + ArrayList fLane = new ArrayList(); + ArrayList fVis = new ArrayList(); + + Queue spaceSends = new LinkedList(); + ArrayList spaceLane = new ArrayList(); + ArrayList spaceVis = new ArrayList(); + + Queue jSends = new LinkedList(); + ArrayList jLane = new ArrayList(); + ArrayList jVis = new ArrayList(); + + Queue kSends = new LinkedList(); + ArrayList kLane = new ArrayList(); + ArrayList kVis = new ArrayList(); + Score score = new Score(); - public void queueTest() { - sends.add(new NoteInfo(1000)); - sends.add(new NoteInfo(2000)); - sends.add(new NoteInfo(3000)); - sends.add(new NoteInfo(4000)); - sends.add(new NoteInfo(5000)); - sends.add(new NoteInfo(6000)); - sends.add(new NoteInfo(7000)); - sends.add(new NoteInfo(8000)); - sends.add(new NoteInfo(9000)); + /** + * Establishes what the chart for the song is going to look like + */ + public void loadSong() { + dSends.add(new NoteInfo(4000)); + dSends.add(new NoteInfo(4333)); + dSends.add(new NoteInfo(4666)); + fSends.add(new NoteInfo(5000)); + kSends.add(new NoteInfo(5500)); + spaceSends.add(new NoteInfo(6000)); + jSends.add(new NoteInfo(6000)); + jSends.add(new NoteInfo(6250)); + dSends.add(new NoteInfo(6500)); + jSends.add(new NoteInfo(6750)); + spaceSends.add(new NoteInfo(7000)); + fSends.add(new NoteInfo(7500)); + jSends.add(new NoteInfo(7750)); + spaceSends.add(new NoteInfo(8000)); + fSends.add(new NoteInfo(8500)); + jSends.add(new NoteInfo(8500)); + dSends.add(new NoteInfo(9000)); + spaceSends.add(new NoteInfo(9000)); + kSends.add(new NoteInfo(9000)); + spaceSends.add(new NoteInfo(9500)); + + kSends.add(new NoteInfo(10000)); + dSends.add(new NoteInfo(10000)); + kSends.add(new NoteInfo(10333)); + fSends.add(new NoteInfo(10333)); + kSends.add(new NoteInfo(10666)); + spaceSends.add(new NoteInfo(10666)); + dSends.add(new NoteInfo(11000)); + spaceSends.add(new NoteInfo(11000)); + dSends.add(new NoteInfo(11333)); + jSends.add(new NoteInfo(11333)); + dSends.add(new NoteInfo(11666)); + kSends.add(new NoteInfo(11666)); + spaceSends.add(new NoteInfo(12000)); } /** - * Creates the Gui used to play the game + * Creates the GUI used to play the game */ public void createAndShowGui() { d.setBounds(1*BLENGTH, (5*HEIGHT)/6, BLENGTH, BHEIGHT); //makes the button bounds for each button - + f.setBounds(2*BLENGTH, (5*HEIGHT)/6, BLENGTH, BHEIGHT); + space.setBounds(3*BLENGTH, (5*HEIGHT)/6, BLENGTH, BHEIGHT); + j.setBounds(4*BLENGTH, (5*HEIGHT)/6, BLENGTH, BHEIGHT); + k.setBounds(5*BLENGTH, (5*HEIGHT)/6, BLENGTH, BHEIGHT); + d.setFocusable(false); //makes it so you can't focus on the button + f.setFocusable(false); + space.setFocusable(false); + j.setFocusable(false); + k.setFocusable(false); + + frame.add(d); //adds the buttons to the frame + frame.add(f); + frame.add(space); + frame.add(j); + frame.add(k); frame.setSize(LENGTH, HEIGHT); //sets the size of the frame frame.setLayout(null); @@ -56,27 +119,58 @@ public class SongPlayer while (true) { //TRY TO FIND A BETTER SOLUTION FOR THIS?? maybe something like sends.size() > 0 || lanes.size() > 0 - if (!sends.isEmpty() && sends.peek().getTime()-time.time()<3) { //checks if any notes in the queue need to be sent at this time - lanes.add(new NoteField()); //adds that note's information to the lane list - - vis.add(new JButton()); //creates a visual representation of that note in the visualizer list - frame.add(vis.get(vis.size()-1)); - - sends.remove(); //removes the note just sent from the sending queue - } + update(d, dSends, dLane, dVis, 'd', "dPress", 1); //updates the provided lane + update(f, fSends, fLane, fVis, 'f', "fPress", 2); + update(space, spaceSends, spaceLane, spaceVis, ' ', "spacePress", 3); + update(j, jSends, jLane, jVis, 'j', "jPress", 4); + update(k, kSends, kLane, kVis, 'k', "kPress", 5); + + frame.repaint(); //updates the visuals every frame + + try { + Thread.sleep(10); //THIS IS PROBABLY NOT THE BEST WAY TO DO THIS + } catch (InterruptedException e) + { + e.printStackTrace(); + } + } + } + + /** + * Updates a lane. An update involves: + * Checking to see if a note needs to be sent down a lane + * Checking to see if the user hit the button + * Checking to see if any notes have moved past the lane + * @param sends The sending queue for the given lane + * @param lane The place where note information is stored for notes currently in that lane + * @param vis The place where the visual representation for a note is stored in that lane + * @param key The button on the keyboard corresponding to the button for the lane being updated + * @param id The id for the action map + * @param k The lane number + */ + private void update(JButton button, Queue sends, ArrayList lane, ArrayList vis, char key, String id, int k) { + if (!sends.isEmpty() && sends.peek().getTime()-time.time()<3) { //checks if any notes in the queue need to be sent at this time + lane.add(new NoteField()); //adds that note's information to the lane list - if (lanes.size() > 0) { //if there are any notes in the lanes, tests for a button press - d.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke('d'), "dPress"); //Input map and Action map setting - d.getActionMap().put("dPress", new AbstractAction() { //Defines what happens when the proper button is pressed - public void actionPerformed(ActionEvent e) - { - int i = getClosestNote(); - int dist = (int)Math.abs(lanes.get(i).goalDistance()); - - lanes.remove(i); //removes the notes and visual representation from the playing field when the button is pressed + vis.add(new JButton()); //creates a visual representation of that note in the visualizer list + frame.add(vis.get(vis.size()-1)); + + sends.remove(); //removes the note just sent from the sending queue + } + + if (lane.size() > 0) { //if there are any notes in the lanes, tests for a button press + button.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(key), id); //Input map and Action map setting + button.getActionMap().put(id, new AbstractAction() { //Defines what happens when the proper button is pressed + public void actionPerformed(ActionEvent e) + { + if (lane.size() > 0) { + int i = getClosestNote(lane); + int dist = (int)Math.abs(lane.get(i).goalDistance()); + + lane.remove(i); //removes the notes and visual representation from the playing field when the button is pressed frame.remove(vis.get(i)); vis.remove(i); - + if (dist > 2*BHEIGHT) { //Determines what to add to the score depending on the proximity of the note score.miss(); } @@ -88,51 +182,40 @@ public class SongPlayer score.combo(); score.perfect(); } - - System.out.println(score.getScore() + " Combo: " + score.getCombo()); - } - }); - d.setFocusable(false); //makes it so you can't focus on the button - } - - for (int i=0; i 0 && lanes.get(i).getFailed()) { //if the note has passed into the fail boundary, removes the note from the field - score.miss(); - System.out.println(score.getScore() + " Combo: " + score.getCombo()); - - - lanes.remove(i); - frame.remove(vis.get(i)); - vis.remove(i); - i--; + System.out.println("Score: " + score.getScore() + " Combo: " + score.getCombo()); + } } - } - - frame.repaint(); //updates the visuals every frame + }); + } + + for (int i=0; i 0 && lane.get(i).getFailed()) { //if the note has passed into the fail boundary, removes the note from the field + score.miss(); + System.out.println(score.getScore() + " Combo: " + score.getCombo()); + + + lane.remove(i); + frame.remove(vis.get(i)); + vis.remove(i); + + i--; } - } + } } /** * Finds the note closest to the goal * @return the location in the array list of the closest note */ - private int getClosestNote() { + private int getClosestNote(ArrayList searchLane) { int pos = 0; - for (int i=0; i