Example #1
0
 public void runTimer(LTimerContext context) {
   if (isInstance) {
     if (waitTransition) {
       if (transition != null) {
         switch (transition.code) {
           default:
             if (!currentControl.isOnLoadComplete()) {
               transition.update(context.timeSinceLastUpdate);
             }
             break;
           case 1:
             if (!transition.completed()) {
               transition.update(context.timeSinceLastUpdate);
             } else {
               endTransition();
             }
             break;
         }
       }
     } else {
       currentControl.runTimer(context);
       currentInput.runTimer(context);
       return;
     }
   }
 }
Example #2
0
 public void draw(GLEx g) {
   if (isInstance) {
     if (waitTransition) {
       if (transition != null) {
         if (transition.isDisplayGameUI) {
           currentControl.createUI(g);
         }
         switch (transition.code) {
           default:
             if (!currentControl.isOnLoadComplete()) {
               transition.draw(g);
             }
             break;
           case 1:
             if (!transition.completed()) {
               transition.draw(g);
             }
             break;
         }
       }
     } else {
       currentControl.createUI(g);
       return;
     }
   }
 }
Example #3
0
 public void onCreate(int width, int height) {
   super.onCreate(width, height);
   if (planes == null) {
     planes = new Hashtable<Integer, STGPlane>(100);
   } else {
     planes.clear();
   }
   if (stgObjects != null) {
     stgObjects.dispose();
     stgObjects = null;
   }
   this.stgObjects = new STGObjects(this, 0);
   if (width > height) {
     this.scrollDelay = new LTimer(50);
   } else {
     this.scrollDelay = new LTimer(40);
   }
   this.dot_size = height / 10;
   this.count = 0;
   if (dot != null) {
     dot = null;
   }
   this.dot = new int[dot_size];
   for (int i = 0; i < dot_size; ++i) {
     this.dot[i] = (int) (MathUtils.random() * width);
   }
 }
Example #4
0
 private final void startTransition() {
   if (transition != null) {
     waitTransition = true;
     if (isInstance) {
       currentControl.setLock(true);
     }
   }
 }
Example #5
0
 public boolean next() {
   if (isInstance) {
     if (currentControl.next()) {
       return true;
     }
   }
   return false;
 }
Example #6
0
 public void printWait(Screen screen) {
   this.isLock = true;
   for (int i = 0; i < max; i++) {
     for (; !maxCheck(); ) {
       setDelay(screen.elapsedTime);
       try {
         screen.wait(LSystem.SECOND);
       } catch (InterruptedException e) {
       }
     }
     next();
     setDelay(screen.elapsedTime);
     try {
       screen.wait(LSystem.SECOND);
     } catch (InterruptedException e) {
     }
   }
   setExist(false);
   if (exist) {
     listener.dispose();
   }
 }
Example #7
0
 public void onDestroy() {
   endTransition();
   if (isInstance) {
     isInstance = false;
     unloads.clear();
     drawings.clear();
     if (currentControl != null) {
       currentControl.destroy();
       currentControl = null;
     }
     LTextures.disposeAll();
     LImage.disposeAll();
   }
 }
Example #8
0
 private final void endTransition() {
   if (transition != null) {
     switch (transition.code) {
       default:
         waitTransition = false;
         transition.dispose();
         break;
       case 1:
         if (transition.completed()) {
           waitTransition = false;
           transition.dispose();
         }
         break;
     }
     if (isInstance) {
       currentControl.setLock(false);
     }
   } else {
     waitTransition = false;
   }
 }
Example #9
0
 public void setCurrentScreen(final Screen screen) {
   if (screen != null) {
     this.isInstance = false;
     if (currentControl != null) {
       currentControl.destroy();
     }
     this.currentControl = screen;
     currentControl.setLock(false);
     currentControl.setLocation(0, 0);
     currentControl.setClose(false);
     currentControl.setOnLoadState(true);
     if (screen.getBackground() != null) {
       currentControl.setRepaintMode(Screen.SCREEN_BITMAP_REPAINT);
     }
     this.isInstance = true;
     if (screen instanceof EmulatorListener) {
       setEmulatorListener((EmulatorListener) screen);
     } else {
       setEmulatorListener(null);
     }
     this.screens.add(screen);
   }
 }
Example #10
0
 public void mouseDragged(LTouch e) {
   if (isInstance) {
     currentControl.mouseDragged(e);
   }
 }
Example #11
0
 public void mouseReleased(LTouch e) {
   if (isInstance) {
     currentControl.mouseReleased(e);
   }
 }
Example #12
0
 public void keyTyped(LKey e) {
   if (isInstance) {
     currentControl.keyTyped(e);
   }
 }
Example #13
0
 public void keyUp(LKey e) {
   if (isInstance) {
     currentControl.keyReleased(e);
   }
 }
Example #14
0
 public void onResume() {
   if (isInstance) {
     currentControl.onResume();
   }
 }
Example #15
0
  private void setScreen(final Screen screen, boolean put) {
    if (currentControl != null && currentControl.isOnLoadComplete()) {
      return;
    }
    synchronized (this) {
      if (screen == null) {
        this.isInstance = false;
        throw new RuntimeException("Cannot create a [Screen] instance !");
      }
      GLLoader.destory();
      if (!LSystem.isLogo) {
        if (currentControl != null) {
          setTransition(screen.onTransition());
        } else {
          LTransition transition = screen.onTransition();
          if (transition == null) {
            switch (MathUtils.random(0, 3)) {
              case 0:
                transition = LTransition.newFadeIn();
                break;
              case 1:
                transition = LTransition.newArc();
                break;
              case 2:
                transition = LTransition.newSplitRandom(LColor.black);
                break;
              case 3:
                transition = LTransition.newCrossRandom(LColor.black);
                break;
            }
          }
          setTransition(transition);
        }
      }
      screen.setOnLoadState(false);
      if (currentControl == null) {
        currentControl = screen;
      } else {
        synchronized (currentControl) {
          currentControl.destroy();
          currentControl = screen;
        }
      }
      this.isInstance = true;
      if (screen instanceof EmulatorListener) {
        setEmulatorListener((EmulatorListener) screen);
      } else {
        setEmulatorListener(null);
      }

      screen.onCreate(LSystem.screenRect.width, LSystem.screenRect.height);

      Runnable runnable =
          new Runnable() {

            @Override
            public void run() {
              for (; LSystem.isLogo; ) {
                try {
                  Thread.sleep(60);
                } catch (InterruptedException e) {
                }
              }
              startTransition();
              screen.setClose(false);
              screen.onLoad();
              screen.onLoaded();
              screen.setOnLoadState(true);
              endTransition();
            }
          };

      //	LSystem.callScreenRunnable(new Thread(runnable, "ProcessThread"));

      if (put) {
        screens.add(screen);
      }
      loading_Control = null;
    }
  }
Example #16
0
 public float getY() {
   if (isInstance) {
     return currentControl.getY();
   }
   return 0;
 }
Example #17
0
 public void resize(int w, int h) {
   if (isInstance) {
     currentControl.resize(w, h);
   }
 }
Example #18
0
 public void calls() {
   if (isInstance) {
     currentControl.callEvents(true);
   }
 }
Example #19
0
 public int getRepaintMode() {
   if (isInstance) {
     return currentControl.getRepaintMode();
   }
   return Screen.SCREEN_CANVAS_REPAINT;
 }
Example #20
0
 public LTexture getBackground() {
   if (isInstance) {
     return currentControl.getBackground();
   }
   return null;
 }
Example #21
0
 public LColor getColor() {
   if (isInstance) {
     return currentControl.getColor();
   }
   return null;
 }
 public void setAutoDestory(final boolean a) {
   super.setAutoDestory(a);
   if (content != null) {
     content.setAutoDestroy(a);
   }
 }
Example #23
0
 public void keyDown(LKey e) {
   if (isInstance) {
     currentControl.keyPressed(e);
   }
 }
Example #24
0
 public void onPause() {
   if (isInstance) {
     currentControl.onPause();
   }
 }