Skip to content

markkorput/ofxSemanticals

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ofxSemanticals

Semantic classes that wrap around low-level concepts and provides often used functionality.

Sattribute

This class functions as a smarter attribute (though originally the name was short for Super-attribute).

  • keeps a history of previous values
  • provides events to hook into to (beforeChange, afterChange, beforeSet, afterSet).

Quick Start

class Game {
	public: // constructor
		Game(){
			score.set(0);
			ofAddListener(score.afterChange, this, &Game::onScoreChange);
		}

	public: // (s)attributes
		Sattribute<int> score;

	private: // callbacks
		void onScoreChange(Sattribute<int> &sattr){
			int points = attr.get() - attr.prev();
			ofLog() << "You just scored " << ofToString(points) << " point(s)."
		}
};

About

Semantic objects that wrap around low-level basic concepts and provide common functionality

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages