Example #1
0
 public synchronized void removeAll() {
   if (sprites != null) {
     sprites.removeAll();
   }
   if (desktop != null) {
     desktop.getContentPane().clear();
   }
 }
Example #2
0
 public final void paint(LGraphics g) {
   if (!running || isClose()) {
     return;
   }
   if (sleep == 0) {
     if (scrCG == null) {
       return;
     }
     if (scrCG.getBackgroundCG() != null) {
       if (shakeNumber > 0) {
         g.drawImage(
             scrCG.getBackgroundCG(),
             shakeNumber / 2 - LSystem.random.nextInt(shakeNumber),
             shakeNumber / 2 - LSystem.random.nextInt(shakeNumber));
       } else {
         g.drawImage(scrCG.getBackgroundCG(), 0, 0);
       }
     }
     int moveCount = 0;
     for (int i = 0; i < scrCG.getCharas().size(); i++) {
       Chara chara = (Chara) scrCG.getCharas().get(i);
       float value = 1.0f;
       if (chara.next()) {
         value = chara.getNextAlpha();
         moveCount++;
       }
       g.setAlpha(value);
       chara.draw(g);
       g.setAlpha(1.0F);
     }
     drawScreen(g);
     if (desktop != null) {
       desktop.createUI(g);
     }
     if (sprites != null) {
       sprites.createUI(g);
     }
   } else {
     sleep--;
     if (color != null) {
       double alpha = (double) (sleepMax - sleep) / sleepMax;
       if (alpha < 1.0) {
         if (scrCG.getBackgroundCG() != null) {
           g.drawImage(scrCG.getBackgroundCG(), 0, 0);
         }
         g.setAlpha(alpha);
         g.setColor(color);
         g.fillRect(0, 0, getCurrentWidth(), getCurrentHeight());
         g.setAlpha(1.0f);
       }
     }
     if (sleep <= 0) {
       sleep = 0;
       color = null;
     }
   }
 }
Example #3
0
 /** 创建程序UI */
 public synchronized void createUI(final LGraphics g) {
   draw(g);
   if (sprites != null) {
     sprites.createUI(g);
   }
   if (desktop != null) {
     desktop.createUI(g);
   }
 }
Example #4
0
 public void run() {
   initAVG();
   while (running) {
     repaint();
     pause(delay);
     if (desktop != null) {
       desktop.update(delay);
     }
     if (sprites != null) {
       sprites.update(delay);
     }
   }
 }
Example #5
0
 public void pointerPressed(double x, double y) {
   if (desktop != null) {
     LComponent[] cs = desktop.getContentPane().getComponents();
     for (int i = 0; i < cs.length; i++) {
       if (cs[i] instanceof LButton) {
         LButton btn = ((LButton) cs[i]);
         if (btn != null && btn.isVisible()) {
           if (btn.intersects((int) x, (int) y)) {
             btn.doClick();
           }
         }
       } else if (cs[i] instanceof LPaper) {
         LPaper paper = ((LPaper) cs[i]);
         if (paper != null && paper.isVisible()) {
           if (paper.intersects((int) x, (int) y)) {
             paper.doClick();
           }
         }
       }
     }
   }
   click();
 }
Example #6
0
 public void removeAll() {
   sprites.removeAll();
   desktop.getContentPane().clear();
 }
Example #7
0
 public void remove(LComponent comp) {
   desktop.remove(comp);
 }
Example #8
0
 public void add(LComponent c) {
   if (desktop == null) {
     initDesktop();
   }
   desktop.add(c);
 }
Example #9
0
 public synchronized void remove(LComponent comp) {
   if (desktop != null) {
     desktop.remove(comp);
   }
 }
Example #10
0
 /**
  * 添加游戏组件
  *
  * @param comp
  */
 public void add(LComponent comp) {
   if (desktop != null) {
     desktop.add(comp);
   }
 }
Example #11
0
 /** 触发输入事件 */
 public void changeText(String text) {
   desktop.changeText(text);
 }
Example #12
0
 /**
  * 检查窗体默认对象中是否包含指定组件
  *
  * @param comp
  * @return
  */
 public boolean contains(LComponent comp) {
   return desktop.getContentPane().contains(comp);
 }