17 #ifndef __CU_OBSTACLE_SELECTOR_H__
18 #define __CU_OBSTACLE_SELECTOR_H__
20 #include <base/CCRef.h>
21 #include <Box2D/Dynamics/Joints/b2MouseJoint.h>
22 #include <Box2D/Dynamics/b2Fixture.h>
23 #include "CUWorldController.h"
26 #define DEFAULT_MSIZE 0.2f
28 #define DEFAULT_FREQUENCY 10.0f
30 #define DEFAULT_DAMPING 0.7f
32 #define DEFAULT_FORCE 1000.0f
37 #pragma mark Obstacle Selector
76 #pragma mark Static Constructors
107 #pragma mark Selection Methods
136 bool select(
const Vec2& pos);
145 void moveTo(
const Vec2& pos);
164 bool onQuery(b2Fixture* fixture);
167 #pragma mark Attribute Properties
202 void setDamping(
float ratio) { _jointDef.dampingRatio = ratio; }
247 #pragma mark Initializers
248 CC_CONSTRUCTOR_ACCESS:
255 ObstacleSelector(
void) : _controller(nullptr), _selection(nullptr), _ground(nullptr), _mouseJoint(nullptr) {}
bool isSelected() const
Definition: CUObstacleSelector.h:113
WorldController * _controller
Definition: CUObstacleSelector.h:58
b2MouseJoint * _mouseJoint
Definition: CUObstacleSelector.h:67
void setForce(float force)
Definition: CUObstacleSelector.h:222
float getDamping() const
Definition: CUObstacleSelector.h:193
void setMouseSize(const Size &size)
Definition: CUObstacleSelector.h:244
Definition: CUObstacleSelector.h:51
b2Body * _ground
Definition: CUObstacleSelector.h:62
Definition: CUWorldController.h:48
b2Fixture * _selection
Definition: CUObstacleSelector.h:60
float getForce() const
Definition: CUObstacleSelector.h:212
const Size & getMouseSize() const
Definition: CUObstacleSelector.h:233
float getFrequency() const
Definition: CUObstacleSelector.h:175
Rect _pointer
Definition: CUObstacleSelector.h:70
void setFrequency(float speed)
Definition: CUObstacleSelector.h:184
b2MouseJointDef _jointDef
Definition: CUObstacleSelector.h:65
float _force
Definition: CUObstacleSelector.h:72
Definition: CUObstacle.h:46
void setDamping(float ratio)
Definition: CUObstacleSelector.h:202
bool init(WorldController *controller)
Definition: CUObstacleSelector.h:275