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.
54 lines
1.0 KiB
54 lines
1.0 KiB
#pragma once
|
|
|
|
#include "ofMain.h"
|
|
|
|
namespace ofx {
|
|
namespace piMapper {
|
|
|
|
class BaseJoint {
|
|
|
|
public:
|
|
BaseJoint();
|
|
~BaseJoint();
|
|
|
|
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();
|
|
|
|
};
|
|
|
|
} // namespace piMapper
|
|
} // namespace ofx
|
|
|