Skip to content

Instantly share code, notes, and snippets.

@sheva29
Last active December 30, 2015 00:39
Show Gist options
  • Save sheva29/fa52bdf7f6830f6a915d to your computer and use it in GitHub Desktop.
Save sheva29/fa52bdf7f6830f6a915d to your computer and use it in GitHub Desktop.
oF - Including a variable form the main scope in a particular class
//testApp reference from another class:
//from a .cpp file, for example, "particle.cpp" you can do two things:
//a) include "testApp.h" (so you know what's inside the testApp)
//b) cast the ofGetAppPtr as a testApp ptr
//This is will be the .cpp of the class particle
#include "particle.h"
#include "testApp.h"
void particle::update(){
((testApp*) ofGetAppPtr())->someVariableThatsInTestApp = 100;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment