We will add a new line to the very beginning of the render function. This line will render the background starfield and move it based on the camera position:
render_manager->RenderBackground();
After that, we will need to add a line to the end of the render function. This line will need to come immediately before the SDL_RenderPresent call, which will still need to be the last line in this function:
locator->Render();
This is what the render() function looks like in its entirety:
void render() {
render_manager->RenderBackground();
player->Render();
enemy->Render();
projectile_pool->RenderProjectiles();
Asteroid* asteroid;
std::vector<Asteroid*>::iterator it;
for( it = asteroid_list.begin(); it != asteroid_list.end(); it++ ) {
asteroid = *it;
asteroid->Render();
}
star->Render();
locator->Render();
SDL_RenderPresent( renderer );
}