simplify access to display width and height and halves

This commit is contained in:
yugecin
2018-07-08 00:30:47 +02:00
parent 27bbc874da
commit d412a2e39e
44 changed files with 339 additions and 399 deletions

View File

@@ -1,6 +1,6 @@
/*
* opsu!dance - fork of opsu! with cursordance auto
* Copyright (C) 2016 yugecin
* Copyright (C) 2016-2018 yugecin
*
* opsu!dance is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -64,7 +64,7 @@ public class CircleMover extends Mover {
double a = ang + SOME_CONSTANT * t;
pos[0] = (startX + (endX - startX) * t) - middlexoffset - Math.cos(a) * radius;
pos[1] = (startY + (endY - startY) * t) - middleyoffset - Math.sin(a) * radius;
if (pos[0] < 0 || displayContainer.width < pos[0] || pos[1] < 0 || displayContainer.height < pos[1]) {
if (pos[0] < 0 || width < pos[0] || pos[1] < 0 || height < pos[1]) {
pass = false;
break;
}

View File

@@ -1,6 +1,6 @@
/*
* opsu!dance - fork of opsu! with cursordance auto
* Copyright (C) 2016 yugecin
* Copyright (C) 2016-2018 yugecin
*
* opsu!dance is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -44,8 +44,8 @@ public class ExgonMover extends Mover {
pos[0] = endX;
pos[1] = endY;
} else {
pos[0] = randgen.nextInt(displayContainer.width);
pos[1] = randgen.nextInt(displayContainer.height);
pos[0] = randgen.nextInt(width);
pos[1] = randgen.nextInt(height);
}
}
return pos;

View File

@@ -1,6 +1,6 @@
/*
* opsu!dance - fork of opsu! with cursordance auto
* Copyright (C) 2016 yugecin
* Copyright (C) 2016-2018 yugecin
*
* opsu!dance is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -102,8 +102,8 @@ public class AutoMoverFactory implements MoverFactory {
}
private boolean checkBounds( double[] pos ) {
return 0 < pos[0] && pos[0] < displayContainer.width - displayContainer.width / 8 &&
0 < pos[1] && pos[1] < displayContainer.height - displayContainer.height / 8;
return 0 < pos[0] && pos[0] < width - width / 8 &&
0 < pos[1] && pos[1] < height - height / 8;
}
@Override