Skip to content

Commit

Permalink
- Updated: Examples
Browse files Browse the repository at this point in the history
  • Loading branch information
DHaylock committed Mar 5, 2016
1 parent e93c6d4 commit 1dbe518
Show file tree
Hide file tree
Showing 19 changed files with 58 additions and 385 deletions.
7 changes: 5 additions & 2 deletions example_BigGrid/src/ofApp.cpp
Expand Up @@ -12,19 +12,23 @@ void ofApp::setup()
// You define the stage size and draw into the stage
opcClient.setupStage(320, 320);

defaultEffects.setup(opcClient.getStageCenterX(), opcClient.getStageCenterY(), opcClient.getStageWidth(), opcClient.getStageHeight());

grid32x32.setupLedGrid(32, 32, 1, 1, 10);
}
//--------------------------------------------------------------
void ofApp::update()
{
ofSetWindowTitle("example_BigGrid");

opcClient.update();

// Now Draw the effects to the stage
opcClient.beginStage();

// Draw what you want rendered here
// For now here are some default effects
opcClient.drawDefaultEffects(effect);
defaultEffects.draw(effect);

opcClient.endStage();

Expand All @@ -40,7 +44,6 @@ void ofApp::update()
// Write out the first set of data
// To do!
}
opcClient.update();
}
//--------------------------------------------------------------
void ofApp::draw()
Expand Down
2 changes: 2 additions & 0 deletions example_BigGrid/src/ofApp.h
Expand Up @@ -2,6 +2,7 @@

#include "ofMain.h"
#include "ofxOPC.h"
#include "Effects.h"

class ofApp : public ofBaseApp{

Expand All @@ -15,6 +16,7 @@ class ofApp : public ofBaseApp{
void exit();

ofxOPC opcClient;
Effects defaultEffects;
ofxNeoPixelGrid grid32x32;

int effect;
Expand Down
4 changes: 3 additions & 1 deletion example_chaining/src/ofApp.cpp
Expand Up @@ -12,6 +12,8 @@ void ofApp::setup()
// You define the stage size and draw into the stage
opcClient.setupStage(250, 250);

defaultEffects.setup(opcClient.getStageCenterX(), opcClient.getStageCenterY(), opcClient.getStageWidth(), opcClient.getStageHeight());

// Setup the Grabbing positions
for (int y = 0; y < 5; y++) {
for (int x = 0; x < 5; x++) {
Expand All @@ -35,7 +37,7 @@ void ofApp::update()

// Draw what you want rendered here
// For now here are some default effects
opcClient.drawDefaultEffects(effect);
defaultEffects.draw(effect);

opcClient.endStage();

Expand Down
2 changes: 2 additions & 0 deletions example_chaining/src/ofApp.h
Expand Up @@ -17,6 +17,8 @@ class ofApp : public ofBaseApp{
map<int,ofxNeoPixelObject*> neoPixels;
vector<ofVec2f> ringOrigins;

Effects defaultEffects;

int effect;
bool hide;
};
Expand Up @@ -65,6 +65,7 @@
3C98599F512D19BB57939D95 /* ofxNeoPixelGrid.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 30; name = ofxNeoPixelGrid.h; path = ../../../addons/ofxOPC/src/ofxNeoPixelGrid.h; sourceTree = SOURCE_ROOT; };
3EFD920E7CFE6B6B1066E3BA /* ofxNeoPixelRing.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 30; name = ofxNeoPixelRing.cpp; path = ../../../addons/ofxOPC/src/ofxNeoPixelRing.cpp; sourceTree = SOURCE_ROOT; };
5E31517C6C120F6DEBCCB9CC /* ofxNeoPixelRing.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 30; name = ofxNeoPixelRing.h; path = ../../../addons/ofxOPC/src/ofxNeoPixelRing.h; sourceTree = SOURCE_ROOT; };
63E65F661C8B56FF00C2E22A /* Effects.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Effects.h; path = ../src/Effects.h; sourceTree = "<group>"; };
BF88F02779DD820913ACEA06 /* ofxTCPClient.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 30; name = ofxTCPClient.cpp; path = ../../../addons/ofxNetwork/src/ofxTCPClient.cpp; sourceTree = SOURCE_ROOT; };
C8C9B823D7872F9CBF03A813 /* ofxTCPClient.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 30; name = ofxTCPClient.h; path = ../../../addons/ofxNetwork/src/ofxTCPClient.h; sourceTree = SOURCE_ROOT; };
C8E2BE30E0CBB25AA8972B43 /* ofxNeoPixels.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 30; name = ofxNeoPixels.h; path = ../../../addons/ofxOPC/src/ofxNeoPixels.h; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -141,6 +142,7 @@
FDDA157BEF92629BF3E6A80D /* ofxNeoPixelStrip.h */,
2C24C81D88B85EC85495F7CA /* ofxOPC.cpp */,
33F3EFB014D3C27B5DEAB7C8 /* ofxOPC.h */,
63E65F661C8B56FF00C2E22A /* Effects.h */,
);
name = src;
sourceTree = "<group>";
Expand Down
8 changes: 5 additions & 3 deletions example_generic_neopixels/src/ofApp.cpp
Expand Up @@ -13,6 +13,8 @@ void ofApp::setup()
// You define the stage size and draw into the stage
opcClient.setupStage(500, 500);

defaultEffects.setup(opcClient.getStageCenterX(), opcClient.getStageCenterY(), opcClient.getStageWidth(), opcClient.getStageHeight());

// Construct the objects
neoPixelObjects.insert( std::pair<int, ofxNeoPixelObject*>(0,new ofxNeoPixelStrip(50, opcClient.getStageCenterY()-(30*5), 60, 5)) );
neoPixelObjects.insert( std::pair<int, ofxNeoPixelObject*>(1,new ofxNeoPixelStrip(opcClient.getStageWidth()-50, opcClient.getStageCenterY()-(30*5), 60, 5)) );
Expand All @@ -26,9 +28,11 @@ void ofApp::update()
{
ofSetWindowTitle("example_generic_neopixels");

opcClient.update();

// Now Draw the effects to the stage
opcClient.beginStage();
opcClient.drawDefaultEffects(effect);
defaultEffects.draw(effect);
opcClient.endStage();

// Get Objects
Expand All @@ -47,8 +51,6 @@ void ofApp::update()
opcClient.writeChannel(i, neoPixelObjects[i]->colorData());
}
}

opcClient.update();
}
//--------------------------------------------------------------
void ofApp::draw()
Expand Down
1 change: 1 addition & 0 deletions example_generic_neopixels/src/ofApp.h
Expand Up @@ -15,6 +15,7 @@ class ofApp : public ofBaseApp{
void exit();

ofxOPC opcClient;
Effects defaultEffects;
map<int, ofxNeoPixelObject*> neoPixelObjects;

int effect;
Expand Down
8 changes: 5 additions & 3 deletions example_multiple_ofxNeoPixelStrips/src/ofApp.cpp
Expand Up @@ -12,6 +12,8 @@ void ofApp::setup()
// You define the stage size and draw into the stage
opcClient.setupStage(500, 500);

defaultEffects.setup(opcClient.getStageCenterX(), opcClient.getStageCenterY(), opcClient.getStageWidth(), opcClient.getStageHeight());

for (int x = 0; x < 8; x++) {
strips.push_back(ofxNeoPixelStrip(((opcClient.getStageWidth()/8)/2)+(x*(opcClient.getStageWidth()/8)), opcClient.getStageCenterY()-(30*5), 60, 5));
}
Expand All @@ -22,12 +24,14 @@ void ofApp::update()
{
ofSetWindowTitle("example_ofxNeoPixelStrips");

opcClient.update();

// Now Draw the effects to the stage
opcClient.beginStage();

// Draw what you want rendered here
// For now here are some default effects
opcClient.drawDefaultEffects(effect);
defaultEffects.draw(effect);

opcClient.endStage();

Expand All @@ -47,8 +51,6 @@ void ofApp::update()
opcClient.writeChannel(i, strips[i].colorData());
}
}

opcClient.update();
}
//--------------------------------------------------------------
void ofApp::draw()
Expand Down
1 change: 1 addition & 0 deletions example_multiple_ofxNeoPixelStrips/src/ofApp.h
Expand Up @@ -16,6 +16,7 @@ class ofApp : public ofBaseApp{
ofxOPC opcClient;

deque <ofxNeoPixelStrip> strips;
Effects defaultEffects;

int effect;
bool hide;
Expand Down
9 changes: 5 additions & 4 deletions example_ofxNeoPixelGrids/src/ofApp.cpp
Expand Up @@ -12,6 +12,8 @@ void ofApp::setup()
// You define the stage size and draw into the stage
opcClient.setupStage(500, 500);

defaultEffects.setup(opcClient.getStageCenterX(), opcClient.getStageCenterY(), opcClient.getStageWidth(), opcClient.getStageHeight());

grid5x7.setupLedGrid(5, 7, 10, 10, 8);
grid8x8.setupLedGrid(8, 8, 10+(7*8), 10, 8);
grid32x32.setupLedGrid(32, 32, 10, 10+(10*8), 8);
Expand All @@ -21,13 +23,14 @@ void ofApp::update()
{
ofSetWindowTitle("example_ofxNeoPixelGrids");

opcClient.update();

// Now Draw the effects to the stage
opcClient.beginStage();

// Draw what you want rendered here

// For now here are some default effects
opcClient.drawDefaultEffects(effect);
defaultEffects.draw(effect);

opcClient.endStage();

Expand All @@ -46,8 +49,6 @@ void ofApp::update()
opcClient.writeChannelOne(grid5x7.colorData());
opcClient.writeChannelTwo(grid8x8.colorData());
}

opcClient.update();
}
//--------------------------------------------------------------
void ofApp::draw()
Expand Down
2 changes: 2 additions & 0 deletions example_ofxNeoPixelGrids/src/ofApp.h
Expand Up @@ -17,6 +17,8 @@ class ofApp : public ofBaseApp{
ofxNeoPixelGrid grid5x7;
ofxNeoPixelGrid grid32x32;

Effects defaultEffects;

int effect;
bool hide;
};
7 changes: 5 additions & 2 deletions example_ofxNeoPixelRings/src/ofApp.cpp
Expand Up @@ -12,6 +12,8 @@ void ofApp::setup()
// You define the stage size and draw into the stage
opcClient.setupStage(500, 500);

defaultEffects.setup(opcClient.getStageCenterX(), opcClient.getStageCenterY(), opcClient.getStageWidth(), opcClient.getStageHeight());

// Setup the rings
ring12px.setupLedRing(opcClient.getStageCenterX(),opcClient.getStageCenterY(), 12, 12);
jewel.setupLedJewel(opcClient.getStageCenterX(),opcClient.getStageCenterY(), 28);
Expand All @@ -24,13 +26,14 @@ void ofApp::setup()
void ofApp::update()
{
ofSetWindowTitle("example_ofxNeoPixelRings");
opcClient.update();

// Now Draw the effects to the stage
opcClient.beginStage();

// Draw what you want rendered here
// For now here are some default effects
opcClient.drawDefaultEffects(effect);
defaultEffects.draw(effect);

opcClient.endStage();

Expand All @@ -55,7 +58,7 @@ void ofApp::update()
opcClient.writeChannelFive(jewel.colorData());
}

opcClient.update();

}
//--------------------------------------------------------------
void ofApp::draw()
Expand Down
3 changes: 2 additions & 1 deletion example_ofxNeoPixelRings/src/ofApp.h
Expand Up @@ -18,9 +18,10 @@ class ofApp : public ofBaseApp{
ofxNeoPixelRing ring16px;
ofxNeoPixelRing ring24px;
ofxNeoPixelRing ring60px;

ofxNeoPixelJewel jewel;

Effects defaultEffects;

int effect;
bool hide;
};
8 changes: 5 additions & 3 deletions example_ofxNeoPixelStrips/src/ofApp.cpp
Expand Up @@ -12,6 +12,8 @@ void ofApp::setup()
// You define the stage size and draw into the stage
opcClient.setupStage(500, 500);

defaultEffects.setup(opcClient.getStageCenterX(), opcClient.getStageCenterY(), opcClient.getStageWidth(), opcClient.getStageHeight());

stick.setupLedStrip(50, 50, 8, 7);
strip40px.setupLedStrip(100,50, 40, 7);
strip60px.setupLedStrip(150,50, 60, 7);
Expand All @@ -22,13 +24,15 @@ void ofApp::update()
{
ofSetWindowTitle("example_ofxNeoPixelStrips");

opcClient.update();

// Now Draw the effects to the stage
opcClient.beginStage();

// Draw what you want rendered here

// For now here are some default effects
opcClient.drawDefaultEffects(effect);
defaultEffects.draw(effect);

opcClient.endStage();

Expand All @@ -49,8 +53,6 @@ void ofApp::update()
opcClient.writeChannelTwo(strip40px.colorData());
opcClient.writeChannelThree(strip60px.colorData());
}

opcClient.update();
}
//--------------------------------------------------------------
void ofApp::draw()
Expand Down
2 changes: 2 additions & 0 deletions example_ofxNeoPixelStrips/src/ofApp.h
Expand Up @@ -19,6 +19,8 @@ class ofApp : public ofBaseApp{
ofxNeoPixelStrip strip60px;
ofxNeoPixelStrip strip144px;

Effects defaultEffects;

int effect;
bool hide;
};
10 changes: 5 additions & 5 deletions example_syphon_input/src/ofApp.cpp
Expand Up @@ -14,6 +14,8 @@ void ofApp::setup()
// You define the stage size and draw into the stage
opcClient.setupStage(500, 500);

defaultEffects.setup(opcClient.getStageCenterX(), opcClient.getStageCenterY(), opcClient.getStageWidth(), opcClient.getStageHeight());

//Construct the objects
leftStrip.setupLedStrip(50, opcClient.getStageCenterY()-(30*5), 60, 5);
rightStrip.setupLedStrip(opcClient.getStageWidth()-50, opcClient.getStageCenterY()-(30*5), 60, 5);
Expand All @@ -22,8 +24,6 @@ void ofApp::setup()
centerRing.setupLedRing(opcClient.getStageCenterX(), opcClient.getStageCenterY(), 60, 50);
centerGrid.setupLedGrid(8, 8, opcClient.getStageCenterX()-(4*25)+(25/2), opcClient.getStageCenterY()-(4*25)+(25/2), 25);



// Setup Syphon
dir.setup();
ofAddListener(dir.events.serverAnnounced, this, &ofApp::serverAnnounced);
Expand All @@ -38,6 +38,8 @@ void ofApp::update()
{
ofSetWindowTitle("example_syphon_input");

opcClient.update();

// Now Draw the effects to the stage
opcClient.beginStage();
if (syphonActive) {
Expand All @@ -47,7 +49,7 @@ void ofApp::update()
syphonClient.draw(0, 0);
}
else {
opcClient.drawDefaultEffects(effect);
defaultEffects.draw(effect);
}

opcClient.endStage();
Expand Down Expand Up @@ -78,8 +80,6 @@ void ofApp::update()
opcClient.writeChannelFive(rightStrip.colorData());
opcClient.writeChannelSix(centerGrid.colorData());
}

opcClient.update();
}
//--------------------------------------------------------------
void ofApp::draw()
Expand Down
2 changes: 2 additions & 0 deletions example_syphon_input/src/ofApp.h
Expand Up @@ -31,6 +31,8 @@ class ofApp : public ofBaseApp{
ofxNeoPixelRing rightRing;
ofxNeoPixelGrid centerGrid;

Effects defaultEffects;

int effect;
bool hide;
bool syphonActive;
Expand Down

0 comments on commit 1dbe518

Please sign in to comment.