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.
65 lines
1.1 KiB
65 lines
1.1 KiB
#include "ofxSurfaceGui.h"
|
|
|
|
ofxSurfaceGui::ofxSurfaceGui()
|
|
{
|
|
|
|
}
|
|
|
|
ofxSurfaceGui::~ofxSurfaceGui()
|
|
{
|
|
|
|
}
|
|
|
|
void ofxSurfaceGui::setup(ofxTriangleSurface& surfaceForGui)
|
|
{
|
|
surface = &surfaceForGui;
|
|
addNumJoints(3);
|
|
}
|
|
|
|
void ofxSurfaceGui::update()
|
|
{
|
|
for ( int i=0; i<joints.size(); i++ ) {
|
|
joints[i].update();
|
|
}
|
|
}
|
|
|
|
void ofxSurfaceGui::draw()
|
|
{
|
|
for ( int i=0; i<joints.size(); i++ ) {
|
|
joints[i].draw();
|
|
}
|
|
}
|
|
|
|
void ofxSurfaceGui::mousePressed(int x, int y, int button)
|
|
{
|
|
for ( int i=0; i<joints.size(); i++ ) {
|
|
joints[i].mousePressed(x, y, button);
|
|
}
|
|
}
|
|
|
|
void ofxSurfaceGui::mouseReleased(int x, int y, int button)
|
|
{
|
|
for ( int i=0; i<joints.size(); i++ ) {
|
|
joints[i].mouseReleased(x, y, button);
|
|
}
|
|
}
|
|
|
|
void ofxSurfaceGui::mouseDragged(int x, int y, int button)
|
|
{
|
|
for ( int i=0; i<joints.size(); i++ ) {
|
|
joints[i].mouseDragged(x, y, button);
|
|
}
|
|
}
|
|
|
|
void ofxSurfaceGui::addJoint()
|
|
{
|
|
joints.push_back(ofxCircleJoint());
|
|
}
|
|
|
|
void ofxSurfaceGui::addNumJoints(int num)
|
|
{
|
|
for ( int i=0; i<num; i++ ) {
|
|
addJoint();
|
|
joints[i].position = surface->getVertex(i);
|
|
}
|
|
}
|