Android Open Source - jmjuanesFramework Game Load






From Project

Back to project page jmjuanesFramework.

License

The source code is released under:

MIT License

If you think the Android project jmjuanesFramework listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package jmjuanes.core;
//w w w . j a  v a 2 s.  c o m
import java.util.Timer;
import java.util.TimerTask;

import jmjuanes.Config;
import jmjuanes.GameMain;
import jmjuanes.util.Ui;

public class GameLoad
{
  //Clase del game
  public GameMain game;
  
  //Clase del view
  public GameView view;
  
  //Timers
  public Timer timer1, timer2;

  public GameLoad(GameView view, GameMain game)
  {
    //Guardamos las clases
    this.view = view;
    this.game = game;
    
    //Creamos el primer timer
    timer1 = new Timer();
    timer1Task myTask = new timer1Task();
    
    //Lo iniciamos
    timer1.schedule(myTask, 1500, 500);
  }
  
  //Clase para el primer temporizador: carga de datos
  class timer1Task extends TimerTask
  {
    public void run()
    {
      //Iniciamos el jmGame
      Ui.Start(view.getWidth() ,view.getHeight());
      
      //Iniciamos las screens
      game.Screens();
      
      //Iniciamos la screen inicial
      game.screen_actual = game.screen_loading;
      
      //Iniciamos el contador de frames
      GameFrames.Iniciar();
      
      //Marcamos como que estamos en el loading
      view.loading = true;
      
      //Iniciamos el thread
      view.ThreadCreate();
      
      //Iniciamos el timer2
      timer2 = new Timer();
      timer2Task myTask = new timer2Task();
      timer2.schedule(myTask, Config.LoadTime, 1500);
      
      //Detenemos el timer1
      timer1.cancel();
    }
  }
  
  class timer2Task extends TimerTask
  {
    public void run()
    {
      //Abrimos el menu principal
      game.ScreenOpen(game.screen_menu);
      
      //Activamos el touch
      game.Touch.On();
      
      //Marcamos como que ya no estamos en el loading
      view.loading = false;
      
      //Contamos los fps
      GameFrames.SetFrames();
      
      //Detenemos el timer2
      timer2.cancel();
    }
  }

}




Java Source Code List

jmjuanes.Config.java
jmjuanes.GameMain.java
jmjuanes.Screen.java
jmjuanes.core.GameData.java
jmjuanes.core.GameFrames.java
jmjuanes.core.GameLoad.java
jmjuanes.core.GameThread.java
jmjuanes.core.GameTouch.java
jmjuanes.core.GameView.java
jmjuanes.util.Mathm.java
jmjuanes.util.Ui.java