 |
CUGL 1.3
Cornell University Game Library
|
48 #ifndef __CU_OBSTACLE_SELECTOR_H__
49 #define __CU_OBSTACLE_SELECTOR_H__
51 #include <Box2D/Dynamics/Joints/b2MouseJoint.h>
52 #include <Box2D/Dynamics/b2Fixture.h>
56 #define DEFAULT_MSIZE 0.2f
58 #define DEFAULT_FREQUENCY 10.0f
60 #define DEFAULT_DAMPING 0.7f
62 #define DEFAULT_FORCE 1000.0f
70 #pragma mark Obstacle Selector
120 #pragma mark Scene Graph Internals
157 #pragma mark Constructors
196 bool init(
const std::shared_ptr<ObstacleWorld>& world) {
197 return init(world,
Size(DEFAULT_MSIZE, DEFAULT_MSIZE));
212 bool init(
const std::shared_ptr<ObstacleWorld>& world,
const Size& mouseSize);
215 #pragma mark Static Constructors
228 static std::shared_ptr<ObstacleSelector>
alloc(
const std::shared_ptr<ObstacleWorld>& world) {
229 std::shared_ptr<ObstacleSelector> result = std::make_shared<ObstacleSelector>();
230 return (result->init(world) ? result :
nullptr);
245 static std::shared_ptr<ObstacleSelector>
alloc(
const std::shared_ptr<ObstacleWorld>& world,
246 const Size& mouseSize) {
247 std::shared_ptr<ObstacleSelector> result = std::make_shared<ObstacleSelector>();
248 return (result->init(world,mouseSize) ? result :
nullptr);
251 #pragma mark Positional Methods
276 #pragma mark Selection Methods
323 bool onQuery(b2Fixture* fixture);
326 #pragma mark Attribute Properties
413 #pragma mark Scene Graph Methods
float getFrequency() const
Definition: CUObstacleSelector.h:335
bool onQuery(b2Fixture *fixture)
void setPosition(float x, float y)
ObstacleSelector()
Definition: CUObstacleSelector.h:167
Vec2 _position
Definition: CUObstacleSelector.h:90
Definition: CUObstacleSelector.h:84
b2Fixture * _selection
Definition: CUObstacleSelector.h:97
std::shared_ptr< WireNode > _connect
Definition: CUObstacleSelector.h:111
void setFrequency(float speed)
Definition: CUObstacleSelector.h:345
bool init(const std::shared_ptr< ObstacleWorld > &world)
Definition: CUObstacleSelector.h:196
bool _dvisible
Definition: CUObstacleSelector.h:115
void setForce(float force)
Definition: CUObstacleSelector.h:385
b2MouseJointDef _jointDef
Definition: CUObstacleSelector.h:102
float getForce() const
Definition: CUObstacleSelector.h:375
Definition: CUColor4.h:1084
void setMouseSize(const Size &size)
Definition: CUObstacleSelector.h:409
Color4 getDebugColor() const
Definition: CUObstacleSelector.h:422
std::shared_ptr< ObstacleWorld > _controller
Definition: CUObstacleSelector.h:87
float x
Definition: CUVec2.h:66
void setDebugScene(const std::shared_ptr< Node > &node)
b2Body * _ground
Definition: CUObstacleSelector.h:99
static std::shared_ptr< ObstacleSelector > alloc(const std::shared_ptr< ObstacleWorld > &world, const Size &mouseSize)
Definition: CUObstacleSelector.h:245
bool isSelected() const
Definition: CUObstacleSelector.h:282
float y
Definition: CUVec2.h:68
float _force
Definition: CUObstacleSelector.h:94
static std::shared_ptr< ObstacleSelector > alloc(const std::shared_ptr< ObstacleWorld > &world)
Definition: CUObstacleSelector.h:228
Size _size
Definition: CUObstacleSelector.h:92
b2MouseJoint * _mouseJoint
Definition: CUObstacleSelector.h:104
Definition: CUPoly2.h:109
bool hasDebug()
Definition: CUObstacleSelector.h:515
Definition: CUObstacle.h:76
~ObstacleSelector()
Definition: CUObstacleSelector.h:175
bool isVisible()
Definition: CUObstacleSelector.h:505
std::shared_ptr< Node > _scene
Definition: CUObstacleSelector.h:107
void updateTarget(Obstacle *obstacle)
const Vec2 & getPosition()
Definition: CUObstacleSelector.h:257
float getDamping() const
Definition: CUObstacleSelector.h:355
void setPosition(const Vec2 &pos)
Definition: CUObstacleSelector.h:272
std::shared_ptr< WireNode > _hatch
Definition: CUObstacleSelector.h:109
Color4 _dcolor
Definition: CUObstacleSelector.h:117
void setDebugColor(Color4 color)
Definition: CUObstacleSelector.h:432
void setDamping(float ratio)
Definition: CUObstacleSelector.h:365
const Size & getMouseSize() const
Definition: CUObstacleSelector.h:397
Node * getDebugScene() const
Definition: CUObstacleSelector.h:458
void setVisible(bool flag)
Definition: CUObstacleSelector.h:491