Castle Battle  1.0
cannon.h
Go to the documentation of this file.
1 #include <irrlicht.h>
2 #include "ball.h"
3 #include "keyboard.h"
4 #include "camera.h"
5 
6 using namespace irr;
7 using namespace KEYBOARD;
8 const f32 INCLINATE_FACTOR = 0.1f;
9 const f32 MAX_ANGLE_BOTTOM = 5.f;
10 const f32 MAX_ANGLE_TOP = 45.f;
11 const f32 MAX_ANGLE_LEFT = -20.f;
12 const f32 MAX_ANGLE_RIGHT = 20.f;
13 const f32 MAX_CANNON_FORCE = 50.f;
14 const f32 CANNON_POWER = 50.f;
15 const f32 BARREL_RADIUS = 0.6f;
17 class Cannon{
18  private:
19  scene::ISceneManager* smgr;
20  IrrlichtDevice* device;
21  video::IVideoDriver* driver;
23  scene::IMeshSceneNode* cannon;
25  scene::IMeshBuffer* barrel;
27  scene::IMeshBuffer* wagon;
29  f32 angle;
41  core::vector3df initialBarrelVector;
43  core::vector3df initBarrelVector;
45  core::vector3df plane;
46  public:
47  core::vector3df rotation;
53  core::vector3df rotationconstraint;
54  Cannon(IrrlichtDevice* device, scene::ISceneManager* smgr, video::IVideoDriver* driver, core::vector3df position, Physics* physics);
55  ~Cannon();
57  f32 refreshAngle();
59  core::aabbox3df getBoundingBox();
61  scene::IMeshSceneNode* getCannon();
62 
68  core::matrix4 getInclinateValues(ACTION_KEYBOARD key);
72  core::vector3df getRange();
74  Camera* getCamera();
76  void setRotation(core::vector3df rotation);
83  void shoot(f32 power);
90  void setCamera(core::vector3df offset, core::vector3df rotation, scene::ISceneManager* smgr,scene::ISceneNode* node);
92  void setPosition(core::vector3df position);
94  bool moveCannon(ACTION_KEYBOARD action);
101  bool moveCamera();
103  void initAngles();
105  void initCannon(core::vector3df position, core::vector3df rotation);
106 
107 };
core::vector3df initBarrelVector
See ::initialBarrelVector.
Definition: cannon.h:43
ACTION_KEYBOARD
Definition: keyboard.h:10
const f32 CANNON_POWER
Definition: cannon.h:14
Ball represent the projectile of the cannon.
Definition: ball.h:12
const f32 BARREL_RADIUS
Definition: cannon.h:15
Physics * physics
Physics instance
Definition: cannon.h:35
core::vector3df plane
The plane of the cannon.
Definition: cannon.h:45
Cannon handles the cannon object.
Definition: cannon.h:17
const f32 MAX_CANNON_FORCE
Definition: cannon.h:13
Camera * camera
Fixed Camera of the cannon.
Definition: cannon.h:31
scene::IMeshSceneNode * cannon
Cannon scene node.
Definition: cannon.h:23
const f32 MAX_ANGLE_LEFT
Definition: cannon.h:11
f32 angle
Angle of the cannon.
Definition: cannon.h:29
const f32 INCLINATE_FACTOR
Definition: cannon.h:8
core::vector3df initialBarrelVector
Initial vector ray.
Definition: cannon.h:41
Physics class will handle all things related to collisions, creating Bullet physics objects and the p...
Definition: physics.h:12
const f32 MAX_ANGLE_BOTTOM
Definition: cannon.h:9
Keyboard namespace with all things related to Keyboard, Key, and keyboard mapping.
Definition: keyboard.h:8
Ball * btBall
Projectile of the cannon.
Definition: cannon.h:33
scene::IMeshBuffer * wagon
Wagon is the bottom part of the 3d cannon object.
Definition: cannon.h:27
video::IVideoDriver * driver
Definition: cannon.h:21
core::vector3df rotation
Definition: cannon.h:47
IrrlichtDevice * device
Definition: cannon.h:20
scene::ISceneManager * smgr
Definition: cannon.h:19
const f32 MAX_ANGLE_TOP
Definition: cannon.h:10
Camera based on ICameraSceneNode of Irrlicht.
Definition: camera.h:6
scene::IMeshBuffer * barrel
Barrel (cane) of the cannon.
Definition: cannon.h:25
core::vector3df rotationconstraint
Default constructor initialize the angles, setup meshes.
Definition: cannon.h:53
const f32 MAX_ANGLE_RIGHT
Definition: cannon.h:12