Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
761 additions
and
1 deletion.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
//TODO: figure out how to do debug and release icons | ||
MAINICON ICON "../../../libs/openFrameworksCompiled/project/win_cb/icon.ico" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include "ofMain.h" | ||
#include "testApp.h" | ||
|
||
//======================================================================== | ||
int main( ){ | ||
ofSetupOpenGL(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()); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#include "testApp.h" | ||
|
||
//-------------------------------------------------------------- | ||
void testApp::setup(){ | ||
ofBackground( 0 ); | ||
ofSetColor( 255 ); | ||
|
||
|
||
} | ||
|
||
void testApp::drawDiamond(float x, float y, float size ){ | ||
ofSetRectMode( OF_RECTMODE_CENTER ); | ||
|
||
if( size > 16 ){ | ||
drawDiamond( x + size/2, y, size/2 ); | ||
drawDiamond( x - size/2, y, size/2 ); | ||
|
||
drawDiamond( x, y + size/2, size/2 ); | ||
drawDiamond( x, y - size/2, size/2 ); | ||
} | ||
|
||
ofPushMatrix();{ | ||
ofTranslate( x, y); | ||
ofRotate( 45 ); | ||
ofRect( 0, 0, size, size ); | ||
}ofPopMatrix(); | ||
|
||
} | ||
|
||
//-------------------------------------------------------------- | ||
void testApp::update(){ | ||
|
||
} | ||
|
||
//-------------------------------------------------------------- | ||
void testApp::draw(){ | ||
ofNoFill(); | ||
drawDiamond( ofGetWindowWidth()/2, ofGetWindowHeight()/2, ofGetWindowWidth()/2 ); | ||
} | ||
|
||
//-------------------------------------------------------------- | ||
void testApp::keyPressed(int key){ | ||
|
||
} | ||
|
||
//-------------------------------------------------------------- | ||
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){ | ||
|
||
} | ||
|
||
//-------------------------------------------------------------- | ||
void testApp::gotMessage(ofMessage msg){ | ||
|
||
} | ||
|
||
//-------------------------------------------------------------- | ||
void testApp::dragEvent(ofDragInfo dragInfo){ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#pragma once | ||
|
||
#include "ofMain.h" | ||
|
||
class testApp : public ofBaseApp{ | ||
|
||
public: | ||
void setup(); | ||
void update(); | ||
void draw(); | ||
|
||
void keyPressed(int key); | ||
void keyReleased(int key); | ||
void mouseMoved(int x, int y ); | ||
void mouseDragged(int x, int y, int button); | ||
void mousePressed(int x, int y, int button); | ||
void mouseReleased(int x, int y, int button); | ||
void windowResized(int w, int h); | ||
void dragEvent(ofDragInfo dragInfo); | ||
void gotMessage(ofMessage msg); | ||
|
||
void drawDiamond( float x, float y, float size ); | ||
}; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
//TODO: figure out how to do debug and release icons | ||
MAINICON ICON "../../../libs/openFrameworksCompiled/project/win_cb/icon.ico" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// KochLine.cpp | ||
// Koch | ||
// | ||
// Created by Charlie Whitney on 11/18/13. | ||
// | ||
// | ||
|
||
#include "KochLine.h" | ||
|
||
KochLine::KochLine( ofVec2f _start, ofVec2f _end ){ | ||
start = _start; | ||
end = _end; | ||
} | ||
|
||
void KochLine::draw() { | ||
ofLine( start, end ); | ||
} | ||
|
||
float KochLine::getLength() { | ||
return start.distance( end ); | ||
} | ||
|
||
ofVec2f KochLine::a(){ | ||
return start; | ||
} | ||
|
||
ofVec2f KochLine::b(){ | ||
ofVec2f dir = (end - start) * 0.333333333; | ||
return (start + dir); | ||
} | ||
|
||
ofVec2f KochLine::c(){ | ||
ofVec2f dir = (end - start) * 0.333333333; | ||
dir.rotate( -60 ); | ||
|
||
return b() + dir; | ||
} | ||
|
||
ofVec2f KochLine::d(){ | ||
ofVec2f dir = (end - start) * 0.666666667; | ||
return (start + dir); | ||
} | ||
|
||
ofVec2f KochLine::e(){ | ||
return end; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// KochLine.h | ||
// Koch | ||
// | ||
// Created by Charlie Whitney on 11/18/13. | ||
// | ||
// | ||
|
||
#pragma once | ||
|
||
#include "ofMain.h" | ||
|
||
class KochLine { | ||
public: | ||
KochLine( ofVec2f _start, ofVec2f _end ); | ||
void draw(); | ||
|
||
float getLength(); | ||
|
||
ofVec2f a(); | ||
ofVec2f b(); | ||
ofVec2f c(); | ||
ofVec2f d(); | ||
ofVec2f e(); | ||
|
||
ofVec2f start, end; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include "ofMain.h" | ||
#include "testApp.h" | ||
|
||
//======================================================================== | ||
int main( ){ | ||
ofSetupOpenGL(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()); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
#include "testApp.h" | ||
|
||
//-------------------------------------------------------------- | ||
void testApp::setup(){ | ||
KochLine line( ofVec2f(0, 500), ofVec2f( ofGetWindowWidth(), 500) ); | ||
|
||
lineList.push_back( line ); | ||
|
||
ofBackground(0); | ||
pct = 1.0; | ||
} | ||
|
||
//-------------------------------------------------------------- | ||
void testApp::update(){ | ||
|
||
} | ||
|
||
void testApp::addGeneration() { | ||
vector<KochLine> newLines; | ||
|
||
for( int i=0; i<lineList.size(); i++ ){ | ||
ofVec2f a = lineList[i].a(); | ||
ofVec2f b = lineList[i].b(); | ||
ofVec2f c = lineList[i].c(); | ||
ofVec2f d = lineList[i].d(); | ||
ofVec2f e = lineList[i].e(); | ||
|
||
newLines.push_back( KochLine(a, b) ); | ||
newLines.push_back( KochLine(b, c) ); | ||
newLines.push_back( KochLine(c, d) ); | ||
newLines.push_back( KochLine(d, e) ); | ||
} | ||
|
||
lineList = newLines; | ||
} | ||
|
||
//-------------------------------------------------------------- | ||
void testApp::draw(){ | ||
float coastLine = 0; | ||
|
||
int pos = ceil( lineList.size() * pct ); | ||
|
||
for( int i=0; i<pos; i++ ){ | ||
lineList[i].draw(); | ||
coastLine += lineList[i].getLength(); | ||
} | ||
|
||
ofDrawBitmapString("Dist: " + ofToString(coastLine), ofVec2f(10,10) ); | ||
} | ||
|
||
//-------------------------------------------------------------- | ||
void testApp::keyPressed(int key){ | ||
|
||
} | ||
|
||
//-------------------------------------------------------------- | ||
void testApp::keyReleased(int key){ | ||
|
||
} | ||
|
||
//-------------------------------------------------------------- | ||
void testApp::mouseMoved(int x, int y ){ | ||
pct = (float)x / ofGetWindowWidth(); | ||
pct = ofClamp(pct, 0.0, 1.0); | ||
} | ||
|
||
//-------------------------------------------------------------- | ||
void testApp::mouseDragged(int x, int y, int button){ | ||
|
||
} | ||
|
||
//-------------------------------------------------------------- | ||
void testApp::mousePressed(int x, int y, int button){ | ||
addGeneration(); | ||
} | ||
|
||
//-------------------------------------------------------------- | ||
void testApp::mouseReleased(int x, int y, int button){ | ||
|
||
} | ||
|
||
//-------------------------------------------------------------- | ||
void testApp::windowResized(int w, int h){ | ||
|
||
} | ||
|
||
//-------------------------------------------------------------- | ||
void testApp::gotMessage(ofMessage msg){ | ||
|
||
} | ||
|
||
//-------------------------------------------------------------- | ||
void testApp::dragEvent(ofDragInfo dragInfo){ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#pragma once | ||
|
||
#include "ofMain.h" | ||
#include "KochLine.h" | ||
|
||
class testApp : public ofBaseApp{ | ||
|
||
public: | ||
void setup(); | ||
void update(); | ||
void draw(); | ||
|
||
void keyPressed(int key); | ||
void keyReleased(int key); | ||
void mouseMoved(int x, int y ); | ||
void mouseDragged(int x, int y, int button); | ||
void mousePressed(int x, int y, int button); | ||
void mouseReleased(int x, int y, int button); | ||
void windowResized(int w, int h); | ||
void dragEvent(ofDragInfo dragInfo); | ||
void gotMessage(ofMessage msg); | ||
|
||
void addGeneration(); | ||
|
||
vector<KochLine> lineList; | ||
float pct; | ||
}; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
//TODO: figure out how to do debug and release icons | ||
MAINICON ICON "../../../libs/openFrameworksCompiled/project/win_cb/icon.ico" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include "ofMain.h" | ||
#include "testApp.h" | ||
|
||
//======================================================================== | ||
int main( ){ | ||
ofSetupOpenGL(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()); | ||
|
||
} |
Oops, something went wrong.