Example #1
0
 /**
  * 设定模拟按钮组是否显示
  *
  * @param visible
  */
 public void emulatorButtonsVisible(boolean visible) {
   if (handler.getDeploy() != null) {
     try {
       EmulatorButtons es = handler.getDeploy().getEmulatorButtons();
       es.setVisible(visible);
     } catch (Exception e) {
     }
   }
 }
Example #2
0
  /** 键盘按下 */
  public void keyPressed(KeyEvent e) {

    int code = e.getKeyCode();
    if (e.getModifiers() == InputEvent.ALT_MASK && e.getKeyCode() == KeyEvent.VK_F4) {
      if (handler != null) {
        handler.getScene().close();
      }
    }
    try {
      this.onKey(e);
      if (!keyDown[code & 0xFF]) {
        keyDown[code & 0xFF] = true;
        keyPressed[this.pressedKey] = code;
        this.pressedKey++;
        if (keyMap.size() > 0) {
          Action action = (Action) keyMap.get(String.valueOf(code));
          if (action != null) {
            action.press();
          }
        }
      }
      e.consume();
    } catch (Exception ex) {
      pressedKey = 0;
    }
  }
Example #3
0
 /**
  * 变更窗体匹配的图像组件大小
  *
  * @param w
  * @param h
  */
 public void resize() {
   this.id = ThreadID.get();
   if (handler != null) {
     int w = handler.getWidth(), h = handler.getHeight();
     if (w < 1 || h < 1) {
       w = h = 1;
     }
     if (w != tmp_width || h != tmp_height) {
       tmp_width = w;
       tmp_height = h;
     } else {
       Thread.yield();
       return;
     }
   }
   this.setBackground(GraphicsUtils.createIntdexedImage(tmp_width, tmp_height));
   this.flvVideo = new FLVEngine(tmp_width, tmp_height);
   this.sprites = new Sprites(tmp_width, tmp_height);
   this.desktop = new Desktop(baseInput, tmp_width, tmp_height);
 }
Example #4
0
 /**
  * 获得Screen的画面边界
  *
  * @return
  */
 public Rectangle getBounds() {
   if (handler == null) {
     return null;
   }
   Window window = handler.getScene().getWindow();
   Rectangle bounds = window.getBounds();
   Insets insets = window.getInsets();
   return new Rectangle(
       bounds.x + insets.left,
       bounds.y + insets.top,
       bounds.width - (insets.left + insets.top),
       bounds.height - (insets.top + insets.bottom));
 }
Example #5
0
 public void addComponent(
     final Component component, final int x, final int y, final int w, final int h) {
   if (handler != null) {
     if (handler.getDeploy().addComponent(x, y, w, h, component)) {
       isComponents = true;
     }
   } else {
     Thread componentThread =
         new Thread(
             new Runnable() {
               public void run() {
                 while (handler == null) {
                   Thread.yield();
                 }
                 if (handler != null) {
                   if (handler.getDeploy().addComponent(x, y, w, h, component)) {
                     isComponents = true;
                   }
                 }
               }
             });
     componentThread.start();
   }
 }
Example #6
0
 /** 返回最大刷新率 */
 public long getMaxFPS() {
   if (handler != null) {
     return handler.getDeploy().getView().getMaxFPS();
   }
   return 0;
 }
Example #7
0
 /**
  * 设定刷新率
  *
  * @param fps
  */
 public void setFPS(long fps) {
   if (handler != null) {
     handler.getDeploy().getView().setFPS(fps);
   }
 }
Example #8
0
 /**
  * 设置主窗口标题
  *
  * @param title
  */
 public void setFrameTitle(String title) {
   if (handler != null) {
     handler.getScene().setTitle(title);
   }
 }
Example #9
0
 /** 设置主窗体小图标 */
 public void setFrameIcon(String fileName) {
   if (handler != null) {
     handler.getScene().setIconImage(fileName);
   }
 }
Example #10
0
 /**
  * 设置主窗体小图标
  *
  * @param image
  */
 public void setFrameIcon(Image icon) {
   if (handler != null) {
     handler.getScene().setIconImage(icon);
   }
 }
Example #11
0
 /**
  * 返回模拟按钮集合
  *
  * @return
  */
 public EmulatorButtons getEmulatorButtons() {
   if (handler.getDeploy() != null) {
     return handler.getDeploy().getEmulatorButtons();
   }
   return null;
 }
Example #12
0
 /** 设定模拟按钮监听器 */
 public void setEmulatorListener(EmulatorListener emulator) {
   if (handler.getDeploy() != null) {
     handler.getDeploy().setEmulatorListener(emulator);
   }
 }
Example #13
0
 public void removeComponent(Component component) {
   if (handler != null) {
     handler.getDeploy().removeComponent(component);
   }
 }
Example #14
0
 /** 还原窗体 */
 public void updateNormalScreen() {
   checkFullScreen();
   if (handler != null) {
     handler.getScene().updateNormalScreen();
   }
 }
Example #15
0
 /** 全屏窗体为指定大小 */
 public void updateFullScreen(int w, int h) {
   checkFullScreen();
   if (handler != null) {
     handler.getScene().updateFullScreen(w, h);
   }
 }
Example #16
0
 /**
  * 返回当前窗体画面图
  *
  * @param width
  * @param height
  * @return
  */
 public BufferedImage getScreenImage() {
   if (handler == null) {
     return null;
   }
   return handler.getDeploy().getView().getAwtImage();
 }