Hello,
I have been programming an Asteroids-like game in C++ in Xcode on Mac OSX. The only problem I have run into is that for some reason, Xcode is saying that I have an out-of-line definition, my drawAsteroid declaration, which I believe I have actually declared correctly. Here is the code where this all happens. This is not the full source code of the game, it is just where I believe the error is occurring.
cpp file:
And here is the .h file where the code from the .h file where I declare the drawAsteroid declaration
Any help would be much appreciated!!
I have been programming an Asteroids-like game in C++ in Xcode on Mac OSX. The only problem I have run into is that for some reason, Xcode is saying that I have an out-of-line definition, my drawAsteroid declaration, which I believe I have actually declared correctly. Here is the code where this all happens. This is not the full source code of the game, it is just where I believe the error is occurring.
cpp file:
#include "colors.h"
#include <GLUT/glut.h>
#define _USE_MATH_DEFINES
#include <cmath>
void Color::drawAsteroid(float x, float y, float size, float angle, Jet state)
{
glPushMatrix();
glTranslatef(x, y, 0);
glScalef(0, 0, 1);
glColor3f(0.5, 0.5, 0.5);
glBegin(GL_POLYGON);
for (int i = 0; i < 5; ++i)
glVertex2f(sin(2 * M_PI / 5 * i), cos(2 * M_PI / 5 * i));
glEnd();
glPopMatrix();
}
And here is the .h file where the code from the .h file where I declare the drawAsteroid declaration
#pragma once
#include "jet.h"
class Color
{
public:
void drawAsteroid(float x, float y, float size, float angle);
void drawShip(float x, float y, float angle, Jet );
void drawBullet(float x, float y);
};
Any help would be much appreciated!!