Added common code from previous LibGDX project.