Permalink
Browse files

added advanced example

  • Loading branch information...
NickHardeman committed Nov 9, 2011
1 parent 2ce1d89 commit 4c0cb227a6bd81ec64a80c031b1b27fceaa1655e

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,148 @@
+// !$*UTF8*$!
+{
+ E435DEE0138FE9CE0031C11E /* emptyExample */ = {
+ isa = PBXExecutable;
+ activeArgIndices = (
+ );
+ argumentStrings = (
+ );
+ autoAttachOnCrash = 1;
+ breakpointsEnabled = 0;
+ configStateDict = {
+ };
+ customDataFormattersEnabled = 1;
+ dataTipCustomDataFormattersEnabled = 1;
+ dataTipShowTypeColumn = 1;
+ dataTipSortType = 0;
+ debuggerPlugin = GDBDebugging;
+ disassemblyDisplayState = 0;
+ enableDebugStr = 1;
+ environmentEntries = (
+ );
+ executableSystemSymbolLevel = 0;
+ executableUserSymbolLevel = 0;
+ libgmallocEnabled = 0;
+ name = emptyExample;
+ showTypeColumn = 0;
+ sourceDirectories = (
+ );
+ };
+ E435DEEA138FE9E40031C11E /* Source Control */ = {
+ isa = PBXSourceControlManager;
+ fallbackIsa = XCSourceControlManager;
+ isSCMEnabled = 0;
+ scmConfiguration = {
+ repositoryNamesForRoots = {
+ "" = "";
+ };
+ };
+ };
+ E435DEEB138FE9E40031C11E /* Code sense */ = {
+ isa = PBXCodeSenseManager;
+ indexTemplatePath = "";
+ };
+ E4B69B4C0A3A1720003C02F2 /* Project object */ = {
+ activeBuildConfigurationName = Debug;
+ activeExecutable = E435DEE0138FE9CE0031C11E /* emptyExample */;
+ activeTarget = E4B69B5A0A3A1756003C02F2 /* emptyExample */;
+ codeSenseManager = E435DEEB138FE9E40031C11E /* Code sense */;
+ executables = (
+ E435DEE0138FE9CE0031C11E /* emptyExample */,
+ );
+ perUserDictionary = {
+ PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = {
+ PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
+ PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID;
+ PBXFileTableDataSourceColumnWidthsKey = (
+ 22,
+ 300,
+ 744,
+ );
+ PBXFileTableDataSourceColumnsKey = (
+ PBXExecutablesDataSource_ActiveFlagID,
+ PBXExecutablesDataSource_NameID,
+ PBXExecutablesDataSource_CommentsID,
+ );
+ };
+ PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
+ PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
+ PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
+ PBXFileTableDataSourceColumnWidthsKey = (
+ 20,
+ 856,
+ 20,
+ 48.16259765625,
+ 43,
+ 43,
+ 20,
+ );
+ PBXFileTableDataSourceColumnsKey = (
+ PBXFileDataSource_FiletypeID,
+ PBXFileDataSource_Filename_ColumnID,
+ PBXFileDataSource_Built_ColumnID,
+ PBXFileDataSource_ObjectSize_ColumnID,
+ PBXFileDataSource_Errors_ColumnID,
+ PBXFileDataSource_Warnings_ColumnID,
+ PBXFileDataSource_Target_ColumnID,
+ );
+ };
+ PBXConfiguration.PBXFileTableDataSource3.XCSCMDataSource = {
+ PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
+ PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
+ PBXFileTableDataSourceColumnWidthsKey = (
+ 20,
+ 20,
+ 832,
+ 20,
+ 48,
+ 43,
+ 43,
+ 20,
+ );
+ PBXFileTableDataSourceColumnsKey = (
+ PBXFileDataSource_SCM_ColumnID,
+ PBXFileDataSource_FiletypeID,
+ PBXFileDataSource_Filename_ColumnID,
+ PBXFileDataSource_Built_ColumnID,
+ PBXFileDataSource_ObjectSize_ColumnID,
+ PBXFileDataSource_Errors_ColumnID,
+ PBXFileDataSource_Warnings_ColumnID,
+ PBXFileDataSource_Target_ColumnID,
+ );
+ };
+ PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = {
+ PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
+ PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
+ PBXFileTableDataSourceColumnWidthsKey = (
+ 20,
+ 816,
+ 60,
+ 20,
+ 48,
+ 43,
+ 43,
+ );
+ PBXFileTableDataSourceColumnsKey = (
+ PBXFileDataSource_FiletypeID,
+ PBXFileDataSource_Filename_ColumnID,
+ PBXTargetDataSource_PrimaryAttribute,
+ PBXFileDataSource_Built_ColumnID,
+ PBXFileDataSource_ObjectSize_ColumnID,
+ PBXFileDataSource_Errors_ColumnID,
+ PBXFileDataSource_Warnings_ColumnID,
+ );
+ };
+ PBXPerProjectTemplateStateSaveDate = 330365424;
+ PBXWorkspaceStateSaveDate = 330365424;
+ };
+ sourceControlManager = E435DEEA138FE9E40031C11E /* Source Control */;
+ userBuildSettings = {
+ };
+ };
+ E4B69B5A0A3A1756003C02F2 /* emptyExample */ = {
+ activeExec = 0;
+ executables = (
+ E435DEE0138FE9CE0031C11E /* emptyExample */,
+ );
+ };
+}
@@ -0,0 +1,9 @@
+//THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT.
+//THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED
+OF_PATH = ../../..
+
+//THIS HAS ALL THE HEADER AND LIBS FOR OF CORE
+#include "../../../libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig"
+
+OTHER_LDFLAGS = $(OF_CORE_LIBS)
+HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS)
@@ -0,0 +1,3 @@
+# Ignore everything in here apart from the .gitignore file
+*
+!.gitignore
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.yourcompany.openFrameworks</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+</dict>
+</plist>
@@ -0,0 +1,16 @@
+#include "ofMain.h"
+#include "testApp.h"
+#include "ofAppGlutWindow.h"
+
+//========================================================================
+int main( ){
+
+ ofAppGlutWindow window;
+ ofSetupOpenGL(&window, 1024,768, OF_WINDOW); // <-------- setup the GL context
+
+ // this kicks off the running of my app
+ // can be OF_WINDOW or OF_FULLSCREEN
+ // pass in width and height too:
+ ofRunApp( new testApp());
+
+}
@@ -0,0 +1,194 @@
+#include "testApp.h"
+
+//--------------------------------------------------------------
+void testApp::setup() {
+ ofSetFrameRate(60);
+ ofSetVerticalSync(true);
+ ofBackground(40);
+ // must call this before adding any tweens //
+ Tweenzor::init();
+
+ ofSetCircleResolution(32);
+
+ paused = false;
+
+ center.set( ofGetWidth()*.5, ofGetHeight()*.5 );
+
+ _x1 = 200.f;
+ _x2 = ofRandom(11, 200);
+ _x3 = ofRandom(10, 100);
+ _x4 = ofRandom(120, 320);
+ _x5 = ofRandom(10, 80);
+ _x6 = 200.f;
+ _x7 = 200.f;
+ _x8 = ofRandom(250, 400);
+ _x9 = ofRandom(-100, 100);
+ _x10 = 0.f;
+
+ // save some params //
+ params.setup( &_x2, _x2, ofRandom(11, 200), 0.f, 2.f, EASE_IN_OUT_SINE );
+
+
+ Tweenzor::add(&_x1, 0.f, 255.f, 0.f, 2.f);
+ // set this to -1 to repeat forever //
+ Tweenzor::getTween( &_x1 )->setRepeat( -1, true );
+
+
+ Tweenzor::add(params);
+ //Tweenzor::getTween( params.property )->setRepeat( 1, true );
+ Tweenzor::addCompleteListener( Tweenzor::getTween( params.property ), this, &testApp::onComplete);
+
+ Tweenzor::add(&_x3, _x3, ofRandom(100, 400), 0.f, ofRandom(.5, 1.6), EASE_IN_OUT_QUAD);
+ //Tweenzor::getTween( &_x3 )->setRepeat( 1, true );
+ Tweenzor::addCompleteListener( Tweenzor::getTween(&_x3), this, &testApp::onComplete);
+
+
+ Tweenzor::add( &_x4, _x4, ofRandom(120, 320), .1f, ofRandom(.5, 1.), EASE_IN_OUT_QUART );
+ Tweenzor::addCompleteListener( Tweenzor::getTween(&_x4), this, &testApp::onComplete);
+
+ Tweenzor::add( &_x5, _x5, ofRandom(10, 80), 0.f, ofRandom(.75, 1.25f), EASE_IN_OUT_CUBIC );
+ Tweenzor::addCompleteListener( Tweenzor::getTween(&_x5), this, &testApp::onComplete);
+
+ Tweenzor::add( &_x9, _x9, ofRandom(-100, 100), 0.f, ofRandom(.75, 1.25f), EASE_IN_OUT_ELASTIC );
+ Tweenzor::addCompleteListener( Tweenzor::getTween(&_x9), this, &testApp::onComplete);
+
+ Tweenzor::add( &_x8, _x8, ofRandom(250, 400), 0.f, ofRandom(.75, 1.25f), EASE_IN_OUT_ELASTIC );
+ Tweenzor::addCompleteListener( Tweenzor::getTween(&_x8), this, &testApp::onComplete );
+
+ Tweenzor::add(&_x10, 100.f, 255.f, 0.f, 3.f);
+ // set this to -1 to repeat forever //
+ Tweenzor::getTween( &_x10 )->setRepeat( -1, true );
+}
+
+//--------------------------------------------------------------
+void testApp::onComplete(float* arg) {
+ //cout << "testApp :: onComplete : arg = " << *arg << endl;
+ float _tarX = 0.f;
+ float _begin = 0.f;
+ if (*arg > 300) {
+ _tarX = 200.f;
+ _begin = 900.f;
+ } else {
+ _tarX = 900.f;
+ _begin = 200.f;
+ }
+
+ if(arg == &_x3) {
+ //cout << "testApp :: onComplete : yup this is the _x3 var" << endl;
+ Tweenzor::add(&_x3, *arg, ofRandom(200, 400), 0.f, ofRandom(.5, 1.6), EASE_IN_OUT_QUAD);
+ Tweenzor::addCompleteListener( Tweenzor::getTween(&_x3), this, &testApp::onComplete);
+ } else if (arg == &_x2) {
+ // update the params //
+ params.begin = *params.property;
+ params.end = ofRandom(11, 200);
+ params.duration = ofRandom(.3, 1.1);
+ Tweenzor::add( params );
+ Tweenzor::addCompleteListener( Tweenzor::getTween(&_x2), this, &testApp::onComplete);
+ } else if (arg == &_x4) {
+ Tweenzor::add( &_x4, *arg, ofRandom(120, 320), 0.f, ofRandom(.5, 1.), EASE_IN_OUT_QUART );
+ Tweenzor::addCompleteListener( Tweenzor::getTween(&_x4), this, &testApp::onComplete);
+ } else if (arg == &_x5) {
+ Tweenzor::add( &_x5, _x5, ofRandom(10, 80), 0.f, ofRandom(.75, 1.25f), EASE_IN_OUT_CUBIC );
+ Tweenzor::addCompleteListener( Tweenzor::getTween(&_x5), this, &testApp::onComplete);
+
+ } else if (arg == &_x9) {
+ Tweenzor::add( &_x9, _x9, ofRandom(-200, 200), 0.f, ofRandom(1.75, 2.25f), EASE_IN_OUT_ELASTIC );
+ Tweenzor::addCompleteListener( Tweenzor::getTween(&_x9), this, &testApp::onComplete);
+ } else {
+ Tweenzor::add( &_x6, _x6, ofRandom(20, 100), 0.f, ofRandom(.75, 1.25f), EASE_IN_OUT_QUINT );
+ Tweenzor::add( &_x7, _x7, ofRandom(200, 300), 0.f, ofRandom(.75, 1.25f), EASE_IN_OUT_CIRC );
+ Tweenzor::add( &_x8, _x8, ofRandom(250, 400), 0.f, ofRandom(.75, 1.25f), EASE_IN_OUT_ELASTIC );
+ // add a complete listener to _x8, it will overwrite the other tweens, so they will stop abruptly when _x8 is done //
+ Tweenzor::addCompleteListener( Tweenzor::getTween(&_x8), this, &testApp::onComplete );
+ }
+
+}
+
+//--------------------------------------------------------------
+void testApp::update() {
+ Tweenzor::update( ofGetElapsedTimeMillis() );
+}
+
+//--------------------------------------------------------------
+void testApp::draw() {
+ ofSetColor(100, 100, 100);
+
+
+ ofDrawBitmapString("hit space to toggle all tweens\nhit r to reset tweens", 20, ofGetHeight()-80);
+
+ ofSetColor(223);
+ ofRect(_x1, 50., 5.f, 5.f);
+
+ ofSetColor(120, 120, 120);
+ ofCircle( center.x + (_x9*.1), center.y, _x3 );
+
+ ofSetColor(_x1, 150, 150);
+ ofCircle( center.x + (_x9*.3), center.y, _x4);
+
+ ofSetColor(190);
+ ofCircle( center.x + (_x9*.6), center.y, _x2);
+
+ ofSetColor(245);
+ ofCircle( center.x + (_x9*.9), center.y, _x5);
+
+ ofNoFill();
+ ofSetColor(_x10);
+ ofCircle(center.x + (_x9*.9), center.y, _x6);
+ ofCircle(center.x + (_x9*.6), center.y, _x7);
+ ofCircle(center.x + (_x9*.4), center.y, _x8);
+
+ ofFill();
+
+
+ ofSetColor(120);
+ ofCircle(center.x+_x9, center.y, 3);
+}
+
+//--------------------------------------------------------------
+void testApp::exit() {
+ Tweenzor::destroy();
+}
+
+//--------------------------------------------------------------
+void testApp::keyPressed(int key){
+ if (key == ' ') {
+ paused = !paused;
+ Tweenzor::toggleAllTweens();
+ } else if (key == 'r') {
+ Tweenzor::resetAllTweens();
+ } else if ( key == 't') {
+ float num = 0.f;
+ onComplete(&num);
+ }
+}
+
+//--------------------------------------------------------------
+void testApp::keyReleased(int key){
+
+}
+
+//--------------------------------------------------------------
+void testApp::mouseMoved(int x, int y ){
+
+}
+
+//--------------------------------------------------------------
+void testApp::mouseDragged(int x, int y, int button){
+
+}
+
+//--------------------------------------------------------------
+void testApp::mousePressed(int x, int y, int button){
+
+}
+
+//--------------------------------------------------------------
+void testApp::mouseReleased(int x, int y, int button){
+
+}
+
+//--------------------------------------------------------------
+void testApp::windowResized(int w, int h){
+
+}
+
Oops, something went wrong.

0 comments on commit 4c0cb22

Please sign in to comment.