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; } } }
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; } } }
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); } }
private final void startTransition() { if (transition != null) { waitTransition = true; if (isInstance) { currentControl.setLock(true); } } }
public boolean next() { if (isInstance) { if (currentControl.next()) { return true; } } return false; }
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(); } }
public void onDestroy() { endTransition(); if (isInstance) { isInstance = false; unloads.clear(); drawings.clear(); if (currentControl != null) { currentControl.destroy(); currentControl = null; } LTextures.disposeAll(); LImage.disposeAll(); } }
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; } }
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); } }
public void mouseDragged(LTouch e) { if (isInstance) { currentControl.mouseDragged(e); } }
public void mouseReleased(LTouch e) { if (isInstance) { currentControl.mouseReleased(e); } }
public void keyTyped(LKey e) { if (isInstance) { currentControl.keyTyped(e); } }
public void keyUp(LKey e) { if (isInstance) { currentControl.keyReleased(e); } }
public void onResume() { if (isInstance) { currentControl.onResume(); } }
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; } }
public float getY() { if (isInstance) { return currentControl.getY(); } return 0; }
public void resize(int w, int h) { if (isInstance) { currentControl.resize(w, h); } }
public void calls() { if (isInstance) { currentControl.callEvents(true); } }
public int getRepaintMode() { if (isInstance) { return currentControl.getRepaintMode(); } return Screen.SCREEN_CANVAS_REPAINT; }
public LTexture getBackground() { if (isInstance) { return currentControl.getBackground(); } return null; }
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); } }
public void keyDown(LKey e) { if (isInstance) { currentControl.keyPressed(e); } }
public void onPause() { if (isInstance) { currentControl.onPause(); } }