Esempio n. 1
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);
   }
 }
Esempio n. 2
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;
    }
  }