123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- # ifndef CAR_HEADER_FILE
- # define CAR_HEADER_FILE
- // Basiques
- # include <iostream>
- # include <cmath>
- # include <vector>
- // Random
- # include <ctime>
- # include <cstdlib>
- // SDL
- # include <SDL/SDL.h>
- # undef main
- # include <SDL/SDL_rotozoom.h>
- # include <SDL/SDL_gfxPrimitives.h>
- // bBox2D
- # include <box2d/box2d.h>
- # define MULTI 100.0f
- enum command { FREE, BREAK, GO, REVERSE };
- class Car
- {
- public:
- Car();
- virtual ~Car();
- void init( b2World &world, float x, float y, float angle = 0.0f );
- void drive( command cmd );
- void update();
- b2Vec2 GetPosition();
- protected:
- b2Body* m_bodyCar ;
- b2Body* m_bodyWheelFwd ;
- b2Body* m_bodyWheelBack ;
- b2RevoluteJoint* m_motorAxe ;
- b2RevoluteJoint* m_fwdAxe ;
-
- SDL_Surface* m_imgCar ;
- SDL_Surface* m_imgWheel ;
- command m_cmd ;
- float m_currentTorque ;
- float m_currentSpeed ;
- float m_goTorque ;
- float m_minTorque ;
- float m_maxSpeed ;
- };
- # endif // CAR_HEADER_FILE
|