Merge remote-tracking branch 'remotes/original/master' into upstream
# Conflicts: # src/itdelatrisu/opsu/Container.java # src/itdelatrisu/opsu/GameData.java # src/itdelatrisu/opsu/Options.java # src/itdelatrisu/opsu/audio/MusicController.java # src/itdelatrisu/opsu/objects/Circle.java # src/itdelatrisu/opsu/objects/Slider.java # src/itdelatrisu/opsu/render/CurveRenderState.java # src/itdelatrisu/opsu/states/Game.java # src/itdelatrisu/opsu/states/MainMenu.java # src/itdelatrisu/opsu/states/SongMenu.java # src/itdelatrisu/opsu/ui/Colors.java # src/itdelatrisu/opsu/ui/MenuButton.java
This commit is contained in:
@@ -41,6 +41,7 @@ import java.net.SocketTimeoutException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.file.Paths;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.cert.X509Certificate;
|
||||
@@ -158,6 +159,14 @@ public class Utils {
|
||||
anim.draw(x - (anim.getWidth() / 2f), y - (anim.getHeight() / 2f));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the luminance of a color.
|
||||
* @param c the color
|
||||
*/
|
||||
public static float getLuminance(Color c) {
|
||||
return 0.299f*c.r + 0.587f*c.g + 0.114f*c.b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clamps a value between a lower and upper bound.
|
||||
* @param val the value to clamp
|
||||
@@ -554,6 +563,14 @@ public class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current working directory.
|
||||
* @return the directory
|
||||
*/
|
||||
public static File getWorkingDirectory() {
|
||||
return Paths.get(".").toAbsolutePath().normalize().toFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the integer string argument as a boolean:
|
||||
* {@code 1} is {@code true}, and all other values are {@code false}.
|
||||
|
||||
Reference in New Issue
Block a user