fix for guitar hero
git-svn-id: http://wiiusej.googlecode.com/svn/trunk@190 ae48ae66-6a45-0410-b38e-211266189506
This commit is contained in:
@@ -162,10 +162,10 @@ public class GuitarHero3ButtonsEventPanel extends javax.swing.JPanel implements
|
|||||||
//blue button
|
//blue button
|
||||||
if (buttons.isButtonBlueJustPressed()) {
|
if (buttons.isButtonBlueJustPressed()) {
|
||||||
blueButton.setSelected(true);
|
blueButton.setSelected(true);
|
||||||
orangeButton.setText("X");
|
blueButton.setText("X");
|
||||||
} else if (buttons.isButtonBlueJustReleased()) {
|
} else if (buttons.isButtonBlueJustReleased()) {
|
||||||
blueButton.setSelected(false);
|
blueButton.setSelected(false);
|
||||||
orangeButton.setText("O");
|
blueButton.setText("O");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Yellow button
|
//Yellow button
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public abstract class JoystickEventPanel extends javax.swing.JPanel implements
|
|||||||
|
|
||||||
// compute coordinates
|
// compute coordinates
|
||||||
if (lastJoystickEvent != null) {
|
if (lastJoystickEvent != null) {
|
||||||
double xAng = Math.sin(lastJoystickEvent.getAngle() * Math.PI
|
double xAng = Math.sin(lastJoystickEvent.getAngle() * Math.PI
|
||||||
/ 180.0)
|
/ 180.0)
|
||||||
* lastJoystickEvent.getMagnitude();
|
* lastJoystickEvent.getMagnitude();
|
||||||
double yAng = Math.cos(lastJoystickEvent.getAngle() * Math.PI
|
double yAng = Math.cos(lastJoystickEvent.getAngle() * Math.PI
|
||||||
@@ -107,12 +107,12 @@ public abstract class JoystickEventPanel extends javax.swing.JPanel implements
|
|||||||
* lastJoystickEvent.getMagnitude();
|
* lastJoystickEvent.getMagnitude();
|
||||||
int halfWidth = (int) Math.round(shape.getBounds().getWidth() / 2);
|
int halfWidth = (int) Math.round(shape.getBounds().getWidth() / 2);
|
||||||
int halHeight = (int) Math.round(shape.getBounds().getHeight() / 2);
|
int halHeight = (int) Math.round(shape.getBounds().getHeight() / 2);
|
||||||
int xAmplitude = (int)Math.round(xCenter-shape.getBounds().getWidth());
|
int xAmplitude = (int) Math.round(xCenter - shape.getBounds().getWidth());
|
||||||
int yAmplitude = (int)Math.round(xCenter-shape.getBounds().getHeight());
|
int yAmplitude = (int) Math.round(xCenter - shape.getBounds().getHeight());
|
||||||
int xShift = (int)Math.round(xAng * xAmplitude);
|
int xShift = (int) Math.round(xAng * xAmplitude);
|
||||||
int yShift = (int)Math.round(yAng * yAmplitude);
|
int yShift = (int) Math.round(yAng * yAmplitude);
|
||||||
int x = xCenter + xShift - halfWidth;
|
int x = xCenter + xShift - halfWidth;
|
||||||
int y = yCenter - yShift - halHeight;
|
int y = yCenter - yShift - halHeight;
|
||||||
// shape
|
// shape
|
||||||
g2.translate(x, y);
|
g2.translate(x, y);
|
||||||
g2.setPaint(borderColor);
|
g2.setPaint(borderColor);
|
||||||
|
|||||||
Reference in New Issue
Block a user