コード例 #1
0
 public void keyBoardEvent(int key, boolean state) {
   if (state) {
     switch (key) {
       case Keyboard.KEY_LCONTROL:
         if (vertex != -1 && this.state == EDIT_SHAPE) tgl.setLocked(true);
         break;
     }
   } else {
     switch (key) {
       case Keyboard.KEY_LCONTROL:
         tgl.setLocked(false);
         break;
       case Keyboard.KEY_RETURN:
         setState(NULL_STATE);
         break;
       case Keyboard.KEY_E:
         setState(EDIT_SHAPE);
         break;
       case Keyboard.KEY_M:
         setState(MOVE_SHAPE);
     }
   }
 }
コード例 #2
0
 public void mouseEvent(int mouseButton, boolean state, int x, int y) {
   if (state) {
     switch (mouseButton) {
       case 0:
         break;
     }
   } else {
     switch (mouseButton) {
       case 0:
         if (this.state == NEW_SHAPE) {
           es.add(new Vertex2DPosition(x, y));
         } else if (this.state == EDIT_SHAPE) {
           if (vertex != -1) {
             es.add(vertex, new Vertex2DPosition(x, y));
           }
         }
         tgl.setLocked(false);
         break;
     }
   }
 }