You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.0 KiB
48 lines
1.0 KiB
#ifndef H_OFX_BASE_JOINT
|
|
#define H_OFX_BASE_JOINT
|
|
|
|
#include "ofMain.h"
|
|
|
|
class ofxBaseJoint {
|
|
public:
|
|
ofxBaseJoint();
|
|
~ofxBaseJoint();
|
|
|
|
void registerMouseEvents();
|
|
void unregisterMouseEvents();
|
|
|
|
ofVec2f position;
|
|
bool enabled;
|
|
bool visible;
|
|
bool selected;
|
|
|
|
void mousePressed(ofMouseEventArgs& args);
|
|
void mouseReleased(int x, int y, int button);
|
|
void mouseDragged(ofMouseEventArgs& args);
|
|
void startDrag();
|
|
void stopDrag();
|
|
void select();
|
|
void unselect();
|
|
void setClickDistance(ofVec2f newClickDistance);
|
|
bool isDragged();
|
|
bool isSelected();
|
|
|
|
virtual void update(){};
|
|
virtual void draw(){};
|
|
virtual bool hitTest(ofVec2f position){};
|
|
|
|
protected:
|
|
ofColor fillColor;
|
|
ofColor strokeColor;
|
|
ofColor fillColorSelected;
|
|
ofColor strokeColorSelected;
|
|
float strokeWidth;
|
|
ofVec2f clickDistance; // How far from the center of the joint the user has clicked?
|
|
bool bDrag;
|
|
|
|
private:
|
|
void setDefaultColors();
|
|
void setDefaultProperties();
|
|
};
|
|
|
|
#endif
|
|
|