コード例 #1
0
 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);
 }
コード例 #2
0
 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();
 }
コード例 #3
0
 public void reset() {
   p = 0;
   a = 0;
   d = 0;
   face.setEmotion(p, a, d);
 }