@Override
    public void draw(Graphics2D g) {
        // TODO toto fps meranie je tu len docasne
        time = System.currentTimeMillis();
        delay = time - lastTime;
        lastTime = time;
        longest = Math.max(longest, delay);
        totalTime += delay;
        ticks++;
        if (totalTime >= 2000) {
            Player.sfps = (int) (1000 / longest);
            Player.afps = (int) (1000 * ticks / totalTime);
            totalTime = 0;
            longest = 0;
            ticks = 0;
        }
        //

        if (pauseTime > 0) {
            if (System.currentTimeMillis() - pauseTime > waitTime) {
                pauseTime = -1;
                waitTime = 0;
                player.state = RunState.running;
                player.start();
            }
        }
        // vykresli vrcholy a hrany
        g.setFont(new Font(Font.MONOSPACED, Font.ITALIC, 14));
        for (Edge edge : edges) {
            edge.preDraw(g);
        }
        for (Edge edge : edges) {
            edge.draw(g);
        }
        g.setStroke(Canvas.thinStroke);
        listener.draw(g);
        for (Vertex vertex : vertices) {
            vertex.draw(g);
        }
        g.setFont(new Font(Font.DIALOG, Font.PLAIN, 11));
        for (Edge edge : edges) {
            edge.queue.draw(g);
        }
        g.setFont(new Font(Font.DIALOG, Font.PLAIN, 11));
        mousex = cursorGetX();
        mousey = cursorGetY();
        //System.out.println("mxy " + mousex + " " + mousey);
        for (Vertex vertex : vertices) {
            vertex.bubble.draw(g);
        }
        Vertex.randomInit.draw(g);
        if (player.state != RunState.stopped)
            player.observer.draw(g);
    }