コード例 #1
0
 /* (non-Javadoc)
  * @see chu.engine.menu.TextInputBox#beginStep()
  */
 public void beginStep() {
   List<MouseEvent> mouseEvents = Game.getMouseEvents();
   for (MouseEvent event : mouseEvents) {
     if (event.button == 0) {
       int mX = Math.round(event.x / Game.getScaleX());
       int mY = Math.round((Game.getWindowHeight() - event.y) / Game.getScaleY());
       boolean newHover = (mX >= x && mX < x + width && mY >= y && mY < y + height);
       hasFocus = newHover;
     }
   }
   super.beginStep();
 }
コード例 #2
0
 public void beginStep() {
   List<MouseEvent> mouseEvents = Game.getMouseEvents();
   for (MouseEvent event : mouseEvents) {
     if (event.button == 0) {
       int mX = Math.round(event.x / Game.getScaleX());
       int mY = Math.round((Game.getWindowHeight() - event.y) / Game.getScaleY());
       boolean newHover = (mX >= x && mX < x + width && mY >= y && mY < y + height);
       hasFocus = newHover;
     }
   }
   super.beginStep();
   if (hasFocus) {
     List<KeyboardEvent> keys = Game.getKeys();
     for (KeyboardEvent ke : keys) {
       if (ke.state) {
         if (ke.key == FEResources.getKeyMapped(Keyboard.KEY_RETURN)) {
           send();
         }
       }
     }
   }
 }