Last active
December 28, 2015 06:29
-
-
Save swoogles/7457461 to your computer and use it in GitHub Desktop.
Random File
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
control_center.h | |
variables: | |
puOneShot * dec_dt_button; | |
methods | |
static void alterDT(puObject *); | |
void init( boost::shared_ptr<Simulation> residentSimulation ); | |
----------------------- | |
control_center.cpp | |
void control_center::alterDT(puObject * caller) { | |
cout << "\nRetrieving user Data from caller" <<endl; | |
boost::shared_ptr<Simulation> * spPointer = (boost::shared_ptr<Simulation> *)caller->getUserData(); | |
if ( spPointer == NULL ) | |
{ | |
cout << "Retrievd a stupid null value from puObject!" << endl; | |
} | |
// cout << "Control_center.simulation.dt: " << spPointer->getDT() << endl; | |
boost::shared_ptr<Simulation> curSimulation = boost::shared_ptr<Simulation>( *spPointer ); | |
cout << "Control_center.simulation.dt: " << curSimulation->getDT() << endl; | |
} | |
void control_center::init( boost::shared_ptr<Simulation> residentSimulation ) { | |
... | |
dec_dt_button = new puOneShot(curX, curHeight - elementHeight, curX+placementWidth, curHeight); | |
curX += (placementWidth +gap);dec_dt_button->setLegend("Slower"); | |
cout << "About to set user Data" << endl; | |
cout << "residentSimulation: " << residentSimulation << endl; | |
cout << "residentSimulation->dt: " << residentSimulation->getDT() << endl; | |
dec_dt_button->setUserData( &residentSimulation ); | |
dec_dt_button->setCallback( alterDT ); | |
boost::shared_ptr<Simulation> * spPointer = (boost::shared_ptr<Simulation> *)dec_dt_button->getUserData(); | |
cout << "\nRetrieving user Data from dec_dt_button after setting callback" << endl; | |
if ( spPointer == NULL ) | |
{ | |
cout << "Retrievd a stupid null value from dec_dt_button!" << endl; | |
} | |
cout << "userData: " << *spPointer << endl; | |
cout << "userData->dt: " << (*spPointer)->getDT() << endl; | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment