Commit 3b352aae authored by Kevin Dang's avatar Kevin Dang

replacing with updated files

parent 1367b67c
......@@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
0A521A451C675A9F004DC3ED /* Tree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0A521A441C675A9F004DC3ED /* Tree.cpp */; };
0A705FA21C558A1000F81E1B /* branch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0A705FA11C558A1000F81E1B /* branch.cpp */; };
E4328149138ABC9F0047C5CB /* openFrameworksDebug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E4328148138ABC890047C5CB /* openFrameworksDebug.a */; };
E4B69E200A3A1BDC003C02F2 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4B69E1D0A3A1BDC003C02F2 /* main.cpp */; };
......@@ -43,6 +44,8 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
0A521A431C675A97004DC3ED /* Tree.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Tree.h; sourceTree = "<group>"; };
0A521A441C675A9F004DC3ED /* Tree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Tree.cpp; sourceTree = "<group>"; };
0A705FA01C558A0500F81E1B /* branch.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = branch.h; sourceTree = "<group>"; };
0A705FA11C558A1000F81E1B /* branch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = branch.cpp; sourceTree = "<group>"; };
E4328143138ABC890047C5CB /* openFrameworksLib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = openFrameworksLib.xcodeproj; path = ../../../libs/openFrameworksCompiled/project/osx/openFrameworksLib.xcodeproj; sourceTree = SOURCE_ROOT; };
......@@ -110,6 +113,8 @@
E4B69E1E0A3A1BDC003C02F2 /* ofApp.cpp */,
0A705FA01C558A0500F81E1B /* branch.h */,
0A705FA11C558A1000F81E1B /* branch.cpp */,
0A521A431C675A97004DC3ED /* Tree.h */,
0A521A441C675A9F004DC3ED /* Tree.cpp */,
);
path = src;
sourceTree = SOURCE_ROOT;
......@@ -211,6 +216,7 @@
buildActionMask = 2147483647;
files = (
0A705FA21C558A1000F81E1B /* branch.cpp in Sources */,
0A521A451C675A9F004DC3ED /* Tree.cpp in Sources */,
E4B69E200A3A1BDC003C02F2 /* main.cpp in Sources */,
E4B69E210A3A1BDC003C02F2 /* ofApp.cpp in Sources */,
);
......
......@@ -27,7 +27,7 @@
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>7C68</string>
<string>7C1002</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
......@@ -35,8 +35,8 @@
<key>DTSDKName</key>
<string>macosx10.11</string>
<key>DTXcode</key>
<string>0720</string>
<string>0721</string>
<key>DTXcodeBuild</key>
<string>7C68</string>
<string>7C1002</string>
</dict>
</plist>
......@@ -9,33 +9,50 @@
#include <stdio.h>
#include "branch.h"
void Branch::setup() {
theta = 30.0;
rotate = 36.00;
branchValue = 180;
testX = 0;
testY = 0;
}
void Branch::draw() {
ofBackground(255);
ofBackground(192);
ofTranslate(ofGetWindowWidth()/2, ofGetWindowHeight());
ofSetColor(0);
branch(180);
ofSetColor(60);
branch(branchValue);
}
void Branch::keyPressed() {
theta = ofRandom(10.0, 30.0);
}
float Branch::branch(float len) {
float strokeWeight = ofMap(len, 4, 120, 0.5, 10);
ofSetLineWidth(strokeWeight/1.8);
ofLine(0,0,0,-len);
float Branch::branch(float len) {
float strokeWeight = ofMap(len, 4, 120, 0.5, 40);
ofSetLineWidth((strokeWeight*.5));
ofLine(testX,testY,0,-len);
ofTranslate(0, -len);
// shrink the length of each branch when it grows
len *= 0.72;
ofPushMatrix();
ofRotateY(rotate);
if (len > 2) {
if (len > 2.4) {
ofSetColor(60);
ofPushMatrix();
ofRotate(theta+10);
branch(len);
......@@ -44,9 +61,23 @@ float Branch::branch(float len) {
ofRotate(-theta);
branch(len);
ofPopMatrix();
} else {
ofSetColor(0,100,0);
ofFill();
ofCircle(testX, testY, 2);
}
ofPopMatrix();
return len;
}
......@@ -11,15 +11,17 @@
#include "ofMain.h"
class Branch {
public:
public:
float branch(float len);
void setup();
void draw();
void keyPressed();
float theta, rotate;
bool mousePressed;
float branchValue;
float testX, testY;
};
#endif /* branch_h */
......@@ -2,7 +2,11 @@
//--------------------------------------------------------------
void ofApp::setup(){
branches.setup();
// branches.setup();
// testing = 0;
tree = new Tree(0, 0, 0, 0);
}
//--------------------------------------------------------------
......@@ -12,7 +16,23 @@ void ofApp::update(){
//--------------------------------------------------------------
void ofApp::draw(){
branches.draw();
// ofPushMatrix();
// ofTranslate(ofGetWindowWidth()/2, ofGetWindowHeight()-800);
// ofRotateY(testing);
// branches.draw();
// testing+=0.5;
// ofPopMatrix();
// tree->render();
tree = new Tree(ofGetWidth()/2, ofGetHeight(), 480, 10);
tree->render();
}
//--------------------------------------------------------------
......@@ -22,50 +42,54 @@ void ofApp::keyPressed(int key){
//--------------------------------------------------------------
void ofApp::keyReleased(int key){
}
//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y ){
}
//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){
branches.mousePressed = true;
// branches.mousePressed = true;
}
//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){
branches.mousePressed = false;
// branches.mousePressed = false;
// tree = new Tree(ofGetWidth()/2, ofGetHeight(), 480, 10);
// tree->render();
}
//--------------------------------------------------------------
void ofApp::mouseEntered(int x, int y){
}
//--------------------------------------------------------------
void ofApp::mouseExited(int x, int y){
}
//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){
}
//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){
}
//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo){
void ofApp::dragEvent(ofDragInfo dragInfo){
}
......@@ -2,6 +2,7 @@
#include "ofMain.h"
#include "branch.h"
#include "Tree.h"
class ofApp : public ofBaseApp{
......@@ -25,7 +26,9 @@ class ofApp : public ofBaseApp{
void gotMessage(ofMessage msg);
Branch branches;
Tree* tree;
// float testing;
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment