I'm drawing my ship by the following code and wanted to draw a missile at the tip of the ship, so that when I click spacebar it fires that missile. I don't know if what I'm doing is correct or not. Is that the "correct" way to do the job of drawing a missile then firing it by a space bar? or there is a "better" way? Is the transformation correct here, I mean writing hard coded values and just stick the missile at the tip of the ship by trial and error?
void Ship::Draw( )
{
gl::pushMatrices();
gl::translate(Vec2f(m_Pos.x,m_Pos.y));
gl::rotate(Vec3f(0,0,m_Angle));
gl::color(ci::Color(1,0,0));
gl::drawLine(Vec2f(-43,-52),Vec2f(59,1));
m_Bullet.Draw(59,-8);
gl::drawLine(Vec2f(-14,-34),Vec2f(-14,38));
gl::drawLine(Vec2f(59,1),Vec2f(-43,54));
gl::popMatrices();
}
void Bullet::Draw(int x, int y)
{
gl::pushMatrices();
gl::translate(x,y);
gl::drawSolidRect(Rectf(0,0,16,16));
gl::popMatrices();
}