Ok, I am trying too create a class that stores information of a entities in my game and be able to call functions too do what ever too the selected ID.
I.E Add a new entity, display it, change it's position/size, etc when its being rendered.
F.Y.I, OpenGL/VS2008.
Here is my class:
Car.H
My uncorrected Car.cpp.
I would appreciate help with this if anyone has did this situation.
I.E Add a new entity, display it, change it's position/size, etc when its being rendered.
F.Y.I, OpenGL/VS2008.
Here is my class:
Car.H
Code:
#ifndef CARS_H #define CARS_H #include "stdafx.h" #include "Player.h" #include "Vector3.h" class Car { public: Car(); virtual ~Car(); void AddCar(Lane lane, float spawn); void ShowCar(unsigned int uiID); void KillCars(); int ReturnCars(); float ReturnSpawnTime(int uiID); protected: Vector3 Position; float SpawnTime; float tSize; int mId; private: std::map<int,Car *> m_mpCar; }; #endif
My uncorrected Car.cpp.
Code:
Car::Car(){ Position = Vector3(0.0f,0.0f,0.0f); SpawnTime = 0; tSize = 0; } Car::~Car() { } void Car::AddCar(Lane lane, float spawn) { m_mpCar.insert( } void Car::KillCars() { m_mpCar.clear(); } void Car::ShowCar(int uiID) { //OpenGL Display list function call goes here. } float Car::ReturnSpawnTime(int uiID) { float time = m_mpCar[uiID]->SpawnTime; return time; } int Car::ReturnCars() { return (int)m_mpCar.size(); }
Comment