public void run() {
        this.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent we) {
                saver.savePref(Width, Height, winZoom);
                System.exit(0);
            }
        });
	    long before;
	    long after;
	    long start;
        init();
	    before = System.nanoTime();
        while (!quit) {
	        start = System.nanoTime();

            update.update(Width, Height, winZoom, Map, HMap, VMap, PMap, LMap, PrMap, VxMap, VyMap, OldPrMap, OldVxMap, OldVyMap, state);

            if (var.active && state == 0) {//If drawing is active and we are in the game screen
                if (var.Drawing) //If it should be drawing
                    draw.create_line(DrawX, DrawY, LastDrawX, LastDrawY, Size, Equipped, Width, Height, winZoom, Map, VMap, PMap, HMap, Shape);//Draw
            } else {
                if (wait < 1) {//If the wait time to draw is over
                    var.active = true;//Activate the drawing
                    wait = 40;//Reset the timer
                } else {//If it can't draw and the timer is not up
                    wait -= 1;//Make the timer progress
                }
            }

            LastDrawX = DrawX;//Update the drawing points
            LastDrawY = DrawY;

	        after = System.nanoTime();
	        if(after - before > 40000000)
	        {
		        repaint();

		        before = System.nanoTime();
	        }
	        if(System.nanoTime() - start != 0)
	            var.PaintFPS = (int)(1000000000/(System.nanoTime() - start));
	        else
		        var.PaintFPS = 1337;

        }
    }