Is there a way I can draw using libcinder without having to put all my code on the draw() method of the main class. I'm working on a big app and it's not convenient in any way to have everything stuffed in one file.
This is an example of what the idea would be:
class MyApp : public AppBasic {
public:
void setup ();
void update ();
void draw ();
private:
vector<MyObject> myObjects;
};
MyApp::draw () {
for (int i = 0; i < myObjects.size(); ++i) {
myObjects[i].render ();
}
}
CINDER_APP_BASIC (MyApp, RendererGL)
/* ------------------ */
class MyObject {
public:
void render ();
};
void MyObject::render () {
Rectf rect (0, 0, 20, 20);
gl::drawSolidRoundedRect(rect, 15.0);
}