Modifying shield.cpp

As with many other game objects, the Shield::Render() function will need to be modified so that it no longer calls SDL directly and instead calls the Render function from the render_manager object. Inside the Shield::Render() function, we will need to remove the following calls to SDL:

SDL_SetTextureColorMod(m_SpriteTexture,
color_red,
color_green,
0 );

SDL_RenderCopyEx( renderer, m_SpriteTexture,
&m_src, &m_dest,
RAD_TO_DEG(m_Ship->m_Rotation),
NULL, SDL_FLIP_NONE );

We will be replacing these lines with a single call to Render:

render_manager->Render( m_SpriteTexture, &m_src, &m_dest, m_Ship->m_Rotation,
255, color_red, color_green, 0 );

This is what the new version of the Shield::Render function looks like in its entirety:

void Shield::Render() {
if( m_Active ) {
int color_green = m_ttl / 100 + 1;
int color_red = 255 - color_green;

m_src.x = m_CurrentFrame * m_dest.w;

m_dest.x = m_Ship->m_Position.x;
m_dest.y = m_Ship->m_Position.y;
render_manager->Render( m_SpriteTexture, &m_src, &m_dest, m_Ship->m_Rotation,
255, color_red, color_green, 0 );
}
}