private void rotateCamera(long ticks) {
        int t = 1;
        if(rotate) {
            mouseListener.hide();
            t = -1;
        }
        Matrix rot = cam.getBack();
        int dx = mouseListener.getDeltaX()*t;
        int dy = mouseListener.getDeltaY()*t;
        float ts = 0.2f * ticks;
        float tsy = ts;

        if (dx != 0) {
            ts = dx / 500f;
        }
        if (dy != 0) {
            tsy = dy / 500f;
        }

        if (dx != 0) {
            //rot.rotateAxis(rot.getXAxis(), ts);
            rot.rotateY(-ts);
        }

        if (dy != 0) {
            rot.rotateX(tsy);
        }
    }