import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class Pantalla extends MIDlet {// implements CommandListener {    
//    private Command exitCommand1;
    static DTTCanvas miCanvas;
    private Rejilla rejilla;
    static Figura figura = null;
    static Display screen;
    public Pantalla() {
    	screen = Display.getDisplay(this);
    	miCanvas = new DTTCanvas(this);
        rejilla = new Rejilla(8,9);
        DTTCanvas.leerInicializacion();
    }
    
    private void initialize() {
        Display.getDisplay(this).setCurrent(miCanvas);
        figura = Figura.nuevaFigura();   // crea la primera figura        
        rejilla.initRejilla();
        DTTCanvas.leerInicializacion(); 
    }

    public Display getDisplay() {
        return Display.getDisplay(this);
    }
    
    public void exitMIDlet() {
        getDisplay().setCurrent(null);
        destroyApp(true);
        notifyDestroyed();
    }
      
    public void startApp() {
        initialize();
    }
    
    public void pauseApp() {
    }
    
    public void destroyApp(boolean unconditional) {
    }
    
    public Rejilla getRejilla(){
        return rejilla;
    }

    public Figura getFigura(){
        return figura;
    }
    
    public DTTCanvas getCanvas(){
        return miCanvas;
    }    
}
