From df1073cb77a9c115c28bb427ea171465850d54bc Mon Sep 17 00:00:00 2001 From: s-ballw Date: Tue, 3 Apr 2018 15:26:11 -0700 Subject: [PATCH 1/4] made hitobjects more accurate --- src/game/RhythmState.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/game/RhythmState.java b/src/game/RhythmState.java index 9556a08..67ee410 100644 --- a/src/game/RhythmState.java +++ b/src/game/RhythmState.java @@ -216,8 +216,7 @@ public void update(GameContainer gc, StateBasedGame sbg, int delta) && beatmap.get(beatmapindex).time <= CIRCLE_TIME + songtime) { Beat currentbeat = beatmap.get(beatmapindex); HitObject hitobject = new HitObject(currentbeat.x, currentbeat.y, - maxRadius, - CIRCLE_TIME, false); + maxRadius, beatmap.get(beatmapindex).time - songtime, false); hitobjects.add(hitobject); beatmapindex++; } From aefbc0d199ad833de5354a6f2881ad7015083adc Mon Sep 17 00:00:00 2001 From: William Ball <33137947+Althoumb@users.noreply.github.com> Date: Wed, 4 Apr 2018 12:45:33 -0700 Subject: [PATCH 2/4] Create contribution guidelines --- CONTRIBUTING.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..dc8752a --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,8 @@ +## Guidelines for contributing + +Please follow [Java coding standards](http://www2.hawaii.edu/~tp_200/ics111/material/codingStandards.html) and comment often, so everyone else can understand what your code does. + +Every class and method should be preceded with a descriptive comment using Javadoc notational convention. + +Please compile and run your code at least once before pushing to a main branch like master or develop. +If the code won't run, save your changes to a personal branch instead on a branch others rely on. From cce2968e60dfb8b12b1211df3802fbcf4f43d21e Mon Sep 17 00:00:00 2001 From: William Ball <33137947+Althoumb@users.noreply.github.com> Date: Wed, 4 Apr 2018 12:47:51 -0700 Subject: [PATCH 3/4] Create README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..45aea51 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# BEeT +A rhythm game written in Java using Slick2d and LWJGL. From 90d5eba1cfdc43411988a52ed55f541a2d2122ac Mon Sep 17 00:00:00 2001 From: s-ballw Date: Wed, 4 Apr 2018 13:17:24 -0700 Subject: [PATCH 4/4] Add javadoc comments for OsuPixels.java and UnitTesting.java --- src/game/OsuPixels.java | 39 ++++++++++++++++++++++++++++++++++---- src/utils/UnitTesting.java | 31 +++++++++++++++++++----------- 2 files changed, 55 insertions(+), 15 deletions(-) diff --git a/src/game/OsuPixels.java b/src/game/OsuPixels.java index 819a00a..70c6066 100644 --- a/src/game/OsuPixels.java +++ b/src/game/OsuPixels.java @@ -3,13 +3,24 @@ import org.newdawn.slick.GameContainer; import org.newdawn.slick.geom.Vector2f; +/** + * + * @author William Ball + * + */ public class OsuPixels { /** - * Converts osupixels to display coordinates + * Converts a vector containing osupixel coordinates to a vector containing + * display coordinates. * * @param gc + * The game container, used to find the dimensions of the game + * window. * @param osupixels - * @return + * The vector, in osupixel coordinates, to be converted to display + * coordinates. + * @return Returns a vector containing the converted display coordinates of the + * osupixel coordinate vector. */ public Vector2f osuPixeltoXY(GameContainer gc, Vector2f osupixels) { float newx = osupixels.x; @@ -32,11 +43,17 @@ public Vector2f osuPixeltoXY(GameContainer gc, Vector2f osupixels) { } /** - * Converts display coordinates to osupixels + * Converts a vector containing display coordinates to a vector containing + * osupixel coordinates. * * @param gc + * The game container, used to find the dimensions of the game + * window. * @param XYpixels - * @return + * The vector, in display coordinates, to be converted to osupixel + * coordinates. + * @return Returns a vector containing the converted osupixel coordinates of the + * display coordinate vector. */ public Vector2f XYtoOsuPixel(GameContainer gc, Vector2f convertedvector) { float scalefactor = (float) (1.0 / getScaleFactor(gc)); @@ -59,6 +76,20 @@ public Vector2f XYtoOsuPixel(GameContainer gc, Vector2f convertedvector) { return vector; } + /** + * Determines the scale factor to use when converting osupixel coordinates to + * display coordinates. + * + * @param gc + * The game container, used to find the dimensions of the game + * window. + * @return If the screen width to screen height ratio is greater than that of a + * 640x480px display, returns the float ratio between the screen height + * and the height of a 640x480px display. If the screen width to screen + * height ratio is less than that of a 640x480px display, returns the + * float ratio between the screen width and that of a 640x480px display. + * + */ protected float getScaleFactor(GameContainer gc) { int screenheight = gc.getHeight(); int screenwidth = gc.getWidth(); diff --git a/src/utils/UnitTesting.java b/src/utils/UnitTesting.java index 0f38ef6..8befca7 100644 --- a/src/utils/UnitTesting.java +++ b/src/utils/UnitTesting.java @@ -5,23 +5,32 @@ import game.OsuPixels; +/** + * + * @author William Ball + * + */ public class UnitTesting { /** - * Using the GameContainer, tests if OsuPixels returns the right vectors. - * + * Tests if OsuPixels returns the right vectors. + *

+ * Goes through all possible osupixel coordinate values, and converts them to + * display coordinates and back. + * * @param gc - * @return + * The game container, used for osupixel conversion. + * @return Returns whether or not the test was successful. */ public boolean testOsuPixels(GameContainer gc) { OsuPixels osupixelconverter = new OsuPixels(); - for (int i = 0; i < 100; i++) { - int x = (int) (Math.random() * 512); - int y = (int) (Math.random() * 384); - Vector2f test = new Vector2f(x, y); - test = osupixelconverter.osuPixeltoXY(gc, test); - test = osupixelconverter.XYtoOsuPixel(gc, test); - if ((int) test.x != x || (int) test.y != y) { - return false; + for (int x = 0; x <= 512; x++) { + for (int y = 0; y <= 384; y++) { + Vector2f test = new Vector2f(x, y); + test = osupixelconverter.osuPixeltoXY(gc, test); + test = osupixelconverter.XYtoOsuPixel(gc, test); + if ((int) test.x != x || (int) test.y != y) { + return false; + } } } return true;