Follow-up to #52.

- Animate skip button during lead in.
- Update flashlight radius during lead in.
- Check if keys are set before calling gameKeyPressed().
- Deleted mouse moved/dragged events (no longer used).
- Renamed updateGameKeyPress().
- Added "auto"/"relax" mod checks to gameKeyPressed().

Also fixed a bug where the MenuButton class wasn't properly resetting image alpha/rotation in certain cases.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2015-03-19 03:04:35 -04:00
parent ba20953634
commit b46c589b97
8 changed files with 180 additions and 188 deletions

View File

@@ -541,36 +541,33 @@ public class Utils {
return s.useDelimiter("\\A").hasNext() ? s.next() : "";
}
}
/**
* Returns the md5 hash of a file in hex form.
* @param file
* @param file the file to hash
* @return the md5 hash
*/
public static String getMD5(File file){
public static String getMD5(File file) {
try {
InputStream in = new BufferedInputStream(new FileInputStream(file));
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] buf = new byte[4096];
while(true) {
while (true) {
int len = in.read(buf);
if (len < 0)
break;
md.update(buf, 0, len);
}
in.close();
byte[] md5byte = md.digest();
StringBuilder result = new StringBuilder();
for (byte b : md5byte) {
for (byte b : md5byte)
result.append(String.format("%02x", b));
}
return result.toString();
} catch (NoSuchAlgorithmException | IOException e) {
e.printStackTrace();
Log.error(e);
ErrorHandler.error("Failed to calculate MD5 hash.", e, true);
}
return null;
}