Android Open Source - misty Misty






From Project

Back to project page misty.

License

The source code is released under:

MIT License

If you think the Android project misty 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 com.misty.kernel;
//from   ww w .  ja  va 2  s.  c om
import android.app.Activity;
import android.media.AudioManager;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.Window;
import android.view.WindowManager;
import com.misty.graphics.Renderer;
import com.misty.graphics.ScreenResolution;

public abstract class Misty extends Activity implements OnTouchListener
{
  private Engine engine;
  private GLSurfaceView screen;
  
  @Override
  protected void onCreate(Bundle savedInstanceState)
  {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    
    Window window = getWindow();
    window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    
    super.onCreate(savedInstanceState);
    
    this.engine = new Engine(this);
    
    this.screen = new GLSurfaceView(this);
    this.screen.setEGLContextClientVersion(2);
    Renderer renderer = new Renderer(this, this.engine, getResolution());
    this.screen.setRenderer(renderer);
    this.screen.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
    this.screen.setOnTouchListener(this);
    setContentView(this.screen);
    
    setVolumeControlStream(AudioManager.STREAM_MUSIC);
  }
  
  public abstract ScreenResolution getResolution();
  
  public abstract void start();
  
  @Override
  public boolean onTouch(View view, MotionEvent event)
  {
    if (this.engine != null)
    {
      this.engine.onTouch(event);
    }
    
    return true;
  }
  
  @Override
  protected void onResume()
  {
    super.onResume();
    
    if (this.engine != null)
    {
      this.engine.resume();
    }
    
    if (this.screen != null)
    {
      this.screen.onResume();
    }
  }
  
  @Override
  protected void onPause()
  {
    super.onPause();
    
    if (this.engine != null)
    {
      this.engine.pause(isFinishing());
    }
    
    if (this.screen != null)
    {
      this.screen.onPause();
    }
  }
  
  @Override
  protected void onDestroy()
  {
    if (this.engine != null)
    {
      this.engine.stop();
    }
    
    super.onDestroy();
  }
}




Java Source Code List

com.misty.audio.AudioManager.java
com.misty.debug.FPS.java
com.misty.debug.TimeCounter.java
com.misty.graphics.Animation.java
com.misty.graphics.Camera.java
com.misty.graphics.CollisionGrid.java
com.misty.graphics.Renderer.java
com.misty.graphics.ScreenResolution.java
com.misty.graphics.textures.TextureManager.java
com.misty.graphics.textures.Texture.java
com.misty.input.TouchEvent.java
com.misty.kernel.Alarm.java
com.misty.kernel.Engine.java
com.misty.kernel.Misty.java
com.misty.kernel.Process.java
com.misty.math.Rectangle.java
com.misty.math.Utils.java
com.misty.math.Vector.java
com.misty.utils.Assets.java