synchronized with libgdx runtime codebase