topical media & game development

talk show tell print

lib-of-vs-apps-examples-advancedEventsExample-src-eventsObject.h / h



  /*
   * ofxEventsAddon.h
   *
   *  Created on: 17-dic-2008
   *      Author: art
   */
  
  ifndef OFXEVENTSADDON_H_
  define OFXEVENTSADDON_H_
  
  include <ofMain.h>
  include <ofEvents.h>
  
  class eventsObject{
  public:
          eventsObject(){
          }
  
          void enable(){
              ofAddListener(ofEvents.update, this, &eventsObject::update);
          }
  
          void disable(){
              ofRemoveListener(ofEvents.update, this, &eventsObject::update);
          }
  
          void update(ofEventArgs & args){
                  counter+=0.3;
                  int intCounter=(int)counter;
                  ofNotifyEvent(newFloatEvent,counter,this);
                  ofNotifyEvent(newIntEvent,intCounter,this);
          }
  
          ofEvent<float> newFloatEvent;
          ofEvent<int> newIntEvent;
  
  private:
          float counter;
  };
  endif /* OFXEVENTSADDON_H_ */
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.