package sillysagiri;

import javax.microedition.lcdui.Graphics;

public class Sagiri 
{
  public final static int TOUCH_NONE = 0;
  public final static int TOUCH_BEGIN = 1;
  public final static int TOUCH_END = 2;
  public final static int TOUCH_DRAG = 3;

  public static Sagiri _instance = null;

  public Input input;

  public int fps = 20;

  private Scene _scene_current = null;
  public long time_begin = 0;
  public long time_delta = 0;

  public Sagiri()
  {
    _instance = this;
    input = new Input();
  }

  public void Update(Graphics g)
  {
    input.Update();
    if (_scene_current != null) 
    _scene_current.Update(time_delta, g);
  }

  public Scene Get_Scene() { return _scene_current; }
  public void Set_Scene(Scene scene)
  {
    if (_scene_current != null)
    {
      _scene_current.Destroy();
      _scene_current = null;
      System.gc();
    }
    _scene_current = scene;
  }

  public final long GetFrameTime() { return time_delta; }
}
