public void showState(int mousex, int mousey) { p = ((double) mousex - (double) getWidth() / (double) 2) / ((double) (getWidth() + 1) / 2.0); d = -((double) mousey - (double) getHeight() / (double) 2) / ((double) (getHeight() + 1) / 2.0); setXY(p, d); face.setEmotion(p, a, d, mousex, mousey); paint(); this.getGraphics().drawLine(mousex - 3, mousey, mousex + 3, mousey); this.getGraphics().drawLine(mousex, mousey - 3, mousex, mousey + 3); }
public void mouseMoved(MouseEvent e) { if (isEnabled()) { setXY( ((double) e.getX() - (double) getWidth() / (double) 2) / ((double) (getWidth() + 1) / 2.0), -((double) e.getY() - (double) getHeight() / (double) 2) / ((double) (getHeight() + 1) / 2.0)); face.setEmotion(p, a, d, e.getX(), e.getY()); } paint(); }
public void reset() { p = 0; a = 0; d = 0; face.setEmotion(p, a, d); }