コード例 #1
0
ファイル: LProcess.java プロジェクト: Del-Gin/LGame
 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;
     }
   }
 }
コード例 #2
0
ファイル: LProcess.java プロジェクト: Del-Gin/LGame
 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;
     }
   }
 }
コード例 #3
0
ファイル: LProcess.java プロジェクト: Del-Gin/LGame
  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;
    }
  }