Object Oriented--- object not being drawn?

Hi, I am trying to have an object (bone) to appear at point mouseX, mouseY…
I seem to have trouble getting testApp.cpp to control the position of “myBone”

what am I doing wrong?
Thanks in advance!!! :smiley: :smiley:
***************

testApp.cpp

  
#include "testApp.h"  
#include "ofMain.h"  
  
//--------------------------------------------------------------  
void testApp::setup(){  
  
  
    // macs by default run on non vertical sync, which can make animation very, very fast  
    // this fixes that:  
  
    ofSetVerticalSync(true);  
  
    // set background:  
  
    ofEnableAlphaBlending();  
    ofBackground(30,130,30);  
  
  
    // set the position of the rectangle:  
  
    myRectangle.pos.x = 100;  
    myRectangle.pos.y = 50;  
  
  
  
}  
  
//--------------------------------------------------------------  
void testApp::update(){  
    myRectangle.xenoToPoint(mouseX, mouseY);  
    myBone.update();  
  
}  
  
//--------------------------------------------------------------  
void testApp::draw(){  
    myRectangle.draw();  
    myBone.draw();  
}  
  
//--------------------------------------------------------------  
void testApp::keyPressed  (int key){  
}  
  
//--------------------------------------------------------------  
void testApp::keyReleased  (int key){  
}  
  
//--------------------------------------------------------------  
void testApp::mouseMoved(int x, int y ){  
}  
  
//--------------------------------------------------------------  
void testApp::mouseDragged(int x, int y, int button){  
}  
  
//--------------------------------------------------------------  
void testApp::mousePressed(int x, int y, int button){  
}  
  
//--------------------------------------------------------------  
void testApp::mouseReleased(){  
}  
  

bone.cpp

  
   
#include "bone.h"  
  
  
//------------------------------------------------------------------  
bone::bone(){  
    pos.x = 0;  
    pos.y = 0;  
  
}  
void bone::update() {  
    pos.x;  
    pos.y;  
    }  
//------------------------------------------------------------------  
void bone::draw() {  
	ofFill();  
  
//bone  
	ofPushMatrix();  
        ofScale(15,15);  
        ofSetColor(255,255,255);  
        ofBeginShape;  
            ofVertex(0,0);  
            ofVertex(0,2);  
            ofVertex(2,3);  
            ofVertex(0,4);  
            ofVertex(0,6);  
            ofVertex(3,5);  
            ofVertex(7,5);  
            ofVertex(10,6);  
            ofVertex(10,4);  
            ofVertex(8,3);  
            ofVertex(10,2);  
            ofVertex(10,0);  
            ofVertex(7,2);  
            ofVertex(3,2);  
            ofVertex(0,0);  
  
  
        ofEndShape;  
    ofPopMatrix();  
  
  
}  
  
//------------------------------------------------------------------  
void bone::mouseMoved(int x, int y ){  
}  
  
//--------------------------------------------------------------  
void bone  ::mouseDragged(int x, int y, int button){  
}  
  
//--------------------------------------------------------------  
void bone::mousePressed(int x, int y, int button){  
}  
  
//--------------------------------------------------------------  
void bone::mouseReleased(){  
}  
  
  
  
  

You haven’t created the objects, have you?

E.g.:

  
myBone = bone();  

a few things:

what’s does this do?

  
  
void bone::update() {  
    pos.x;  
    pos.y;  
    }  
  

nothing at the moment…

second, you have a variable called pos in the object, which you don’t use in draw:

  
  
//------------------------------------------------------------------  
void bone::draw() {  
   ofFill();  
  
//bone  
   ofPushMatrix();  
        ofScale(15,15);  
        ofSetColor(255,255,255);  
        ofBeginShape;  
            ofVertex(0,0);  
            ofVertex(0,2);  
            ofVertex(2,3);  
            ofVertex(0,4);  
            ofVertex(0,6);  
            ofVertex(3,5);  
            ofVertex(7,5);  
            ofVertex(10,6);  
            ofVertex(10,4);  
            ofVertex(8,3);  
            ofVertex(10,2);  
            ofVertex(10,0);  
            ofVertex(7,2);  
            ofVertex(3,2);  
            ofVertex(0,0);  
  
  
        ofEndShape;  
    ofPopMatrix();  
  
  
}  
  

finally, you never alter mybone.pos from testApp.

not sure what you are trying to do, but you seem to be missing some steps here.

take care,
zach