SlideShare ist ein Scribd-Unternehmen logo
1 von 57
000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID.      HELLOWORLD.
000300 DATE-WRITTEN.    02/05/96       21:04.
000400*AUTHOR    BRIAN COLLINS
000500 ENVIRONMENT DIVISION.
000600 CONFIGURATION SECTION.
000700 SOURCE-COMPUTER. RM-COBOL.
000800 OBJECT-COMPUTER. RM-COBOL.
000900
001000 DATA DIVISION.
001100 FILE SECTION.
001200
100000 PROCEDURE DIVISION.
100100
100200 MAIN-LOGIC SECTION.
100300 BEGIN.
100400     DISPLAY " " LINE 1 POSITION 1 ERASE EOS.
100500     DISPLAY "HELLO, WORLD." LINE 15 POSITION 10.
100600     STOP RUN.
100700 MAIN-LOGIC-EXIT.
100800     EXIT.
getName()   getName()
To invent programs, you need to be able to capture abstractions and ex
design. It’s the job of a programming language to help you do this. The
process of invention and design by letting you encode abstractions tha
It should let you make your ideas concrete in the code you write. Surf
the architecture of your program.

All programming languages provide devices that help express abstrac
are ways of grouping implementation details, hiding them, and giving
a common interface—much as a mechanical object separates its interfa
illustrated in “Interface and Implementation” .

Figure 2-1            Inte rfa ce a nd Im ple m e nta tion

interface                         implementation




                  11
             10
            9
             8
                  7
                          6
Spot
+ pos : ofPoint
+ loc : float
Spot sp; //


void setup() {
	   size(400, 400);
	   smooth();
	   noStroke();
	   sp = new Spot(); //           (              )
	   sp.x = 150; //            x   150
	   sp.y = 200; //            y   200
	   sp.diameter = 30; //              diameter   30
}

void draw() {
	   background(0);
	   ellipse(sp.x, sp.y, sp.diameter, sp.diameter);
}
Spot sp; //
void   setup() {
	      size(400, 400);
	      smooth();
	      noStroke();
	      sp = new Spot(); //            (              )
	      sp.x = 150; //             x   150
	      sp.y = 200; //             y   200
	      sp.diameter = 30; //               diameter   30
}
void draw() {
	    background(0);
	    ellipse(sp.x, sp.y, sp.diameter, sp.diameter);
}

class Spot {
	    float x, y; // x         y
	      float diameter; //
}
#ifndef _OF_SPOT
#define _OF_SPOT

#include "ofMain.h"

class Spot {
public:
	 ofPoint pos;
	 float diameter;
};

#endif
#pragma once
#include "ofMain.h"
#include "ofxAccelerometer.h"
#include "ofxMultiTouch.h"
#include "Spot.h"

class testApp : public ofSimpleApp, public ofxMultiTouchListener {
	
public:
	 void setup();
	 void update();
	 void draw();
	 void exit();

...(   )...


private:
	 Spot sp;
};
#include "testApp.h"
#include "Spot.h"

void testApp::setup(){	
	 sp.pos.x = ofGetWidth()/2;
	 sp.pos.y = ofGetHeight()/2;
	 sp.diameter = 100;
}

void testApp::update(){
}

void testApp::draw(){
	 ofEnableSmoothing();
	 ofSetColor(0, 127, 255);
	 ofCircle(sp.pos.x, sp.pos.y, sp.diameter);
}

...(   )...
Spot
+ pos : ofPoint
+ loc : float
+ display( )
#ifndef _OF_SPOT
#define _OF_SPOT

#include "ofMain.h"

class Spot {
public:
	 void display();
	 ofPoint pos;
	 float diameter;
};

#endif
#include "Spot.h"

void Spot::display()
{
	 ofSetColor(0, 127, 255);
	 ofCircle(pos.x, pos.y, diameter);
}
#include "testApp.h"
#include "Spot.h"

void testApp::setup(){	
	 sp.pos.x = ofGetWidth()/2;
	 sp.pos.y = ofGetHeight()/2;
	 sp.diameter = 100;
}

void testApp::update(){
}

void testApp::draw(){
	 sp.display();
}

...(   )...
Spot
+ pos : ofPoint
+ loc : float
+ Spot(pos:ofPoint, loc:float)
+ display() : void
#pragma once
#include "ofMain.h"
#include "ofxAccelerometer.h"
#include "ofxMultiTouch.h"
#include "Spot.h"

class testApp : public ofSimpleApp, public ofxMultiTouchListener {
	
public:
	 void setup();
	 void update();
	 void draw();
	 void exit();

...(   )...
	
private:
	 Spot *sp; //Spot                 sp          (*)
};
#include "testApp.h"
#include "Spot.h"

void testApp::setup(){	
	 ofPoint _pos;
	 _pos.x = ofGetWidth()/2;
	 _pos.y = ofGetHeight()/2;
	 sp = new Spot(_pos, 100.0); //
}

void testApp::update(){
}

void testApp::draw(){
	 sp->display(); //           "->"
}

...(   )...
#ifndef _OF_SPOT
#define _OF_SPOT

#include "ofMain.h"

class Spot {
public:
	 Spot(ofPoint pos, float diameter);
	 void display();
	 ofPoint pos;
	 float diameter;
};

#endif
#include "Spot.h"

Spot::Spot(ofPoint _pos, float _diameter)
{
	 pos = _pos;
	 diameter = _diameter;
}

void Spot::display()
{
	 ofSetColor(0, 127, 255);
	 ofCircle(pos.x, pos.y, diameter);
}
#pragma once
#include "ofMain.h"
#include "ofxAccelerometer.h"
#include "ofxMultiTouch.h"
#include "Spot.h"

class testApp : public ofSimpleApp, public ofxMultiTouchListener {
	
public:
	 void setup();
	 void update();
	 void draw();
	 void exit();

...(     )...
	
private:
	 Spot** sp; //Spot             sp                (**)
	    int numSpot; //     Spot
};
#include "testApp.h"
#include "Spot.h"
void testApp::setup(){	
	 numSpot = 100;
	 sp = new Spot*[numSpot]; //
	   for(int i = 0; i < numSpot; i++){
	   	    ofPoint _pos;
	   	    _pos.x = ofRandom(0, ofGetWidth());
	   	    _pos.y = ofRandom(0, ofGetHeight());
	   	    float _diameter = ofRandom(1, 20);
	   	    sp[i] = new Spot(_pos, _diameter); //   	
	 }
}
void testApp::update(){
}
void testApp::draw(){
	 for(int i = 0; i < numSpot; i++){
	 	      sp[i]->display();
	 }
}

...(   )...
#ifndef _OF_SPOT
#define _OF_SPOT

#include "ofMain.h"

class Spot {
public:
	 Spot(ofPoint pos, float diameter);
	 void display();
	 ofPoint pos;
	 float diameter;
};

#endif
#include "Spot.h"

Spot::Spot(ofPoint _pos, float _diameter)
{
	 pos = _pos;
	 diameter = _diameter;
}

void Spot::display()
{
	 ofSetColor(0, 127, 255);
	 ofCircle(pos.x, pos.y, diameter);
}
Spot
+ pos : ofPoint
+ loc : float
+Spot(pos:ofPoint, velocity:ofPoint, loc:float)
+update() : void
+ display() : void
#pragma once
#include "ofMain.h"
#include "ofxAccelerometer.h"
#include "ofxMultiTouch.h"
#include "Spot.h"

class testApp : public ofSimpleApp, public ofxMultiTouchListener {
	
public:
	 void setup();
	 void update();
	 void draw();
	 void exit();

...(     )...
	
private:
	 Spot** sp; //Spot             sp                (**)
	    int numSpot; //     Spot
};
#include "testApp.h"
#include "Spot.h"

void testApp::setup(){	
	 ofSetFrameRate(60);
	 ofEnableAlphaBlending();
	 ofSetBackgroundAuto(false);
	 numSpot = 100;
	 sp = new Spot*[numSpot]; //
	   for(int i = 0; i < numSpot; i++){
	   	    ofPoint _pos, _velocity;
	   	    _pos.x = ofRandom(0, ofGetWidth());
	   	    _pos.y = ofRandom(0, ofGetHeight());
	   	    _velocity.x = ofRandom(-10, 10);
	   	    _velocity.y = ofRandom(-30, -10);
	   	    float _diameter = ofRandom(1, 20);
	   	    sp[i] = new Spot(_pos, _velocity, _diameter); //   	
	   	    sp[i]->gravity = 0.5; //
	   	    sp[i]->friction = 0.999; //
	   }
}
void testApp::update(){
	 ofSetColor(0, 0, 0, 31);
	 ofRect(0, 0, ofGetWidth(), ofGetHeight());
	 for(int i = 0; i < numSpot; i++){
	 	      sp[i]->update();
	 }
}

void testApp::draw(){
	 for(int i = 0; i < numSpot; i++){
	 	      sp[i]->display();
	 }
}

...(   )...
#ifndef _OF_SPOT
#define _OF_SPOT

#include "ofMain.h"

class Spot {
public:
	 Spot(ofPoint pos, ofPoint velocity, float diameter);
	 void update();
	 void display();
	 ofPoint pos;
	 ofPoint velocity;
	 float diameter;
	 float gravity;
	 float friction;
};
#include "Spot.h"

Spot::Spot(ofPoint _pos, ofPoint _velocity, float _diameter)
{
	 pos = _pos;
	 velocity = _velocity;
	 diameter = _diameter;
}

void Spot::update()
{
	 velocity *= friction;
	 velocity.y += gravity;
	 pos.x += velocity.x;
	 pos.y += velocity.y;

	   if(pos.x < diameter || pos.x > ofGetWidth() - diameter){
	   	    velocity.x *= -1;
	   }
if(pos.y > ofGetHeight()-diameter){
	   	    velocity.y *= -1;
	   	    pos.y = ofGetHeight()-diameter;
	   }
}

void Spot::display()
{
	 ofSetColor(0, 127, 255, 200);
	 ofCircle(pos.x, pos.y, diameter);
}
Sbaw090623

Weitere ähnliche Inhalte

Was ist angesagt?

openFrameworks – 関数・クラス、オブジェクト指向プログラミング導入 - 多摩美メディアアートII
openFrameworks – 関数・クラス、オブジェクト指向プログラミング導入 - 多摩美メディアアートIIopenFrameworks – 関数・クラス、オブジェクト指向プログラミング導入 - 多摩美メディアアートII
openFrameworks – 関数・クラス、オブジェクト指向プログラミング導入 - 多摩美メディアアートIIAtsushi Tadokoro
 
Pratt Parser in Python
Pratt Parser in PythonPratt Parser in Python
Pratt Parser in PythonPercolate
 
Коварный code type ITGM #9
Коварный code type ITGM #9Коварный code type ITGM #9
Коварный code type ITGM #9Andrey Zakharevich
 
A simple snake game project
A simple snake game projectA simple snake game project
A simple snake game projectAmit Kumar
 
openFrameworks – パーティクルを動かす、静的配列と動的配列 - 多摩美メディアアートII
openFrameworks – パーティクルを動かす、静的配列と動的配列 - 多摩美メディアアートIIopenFrameworks – パーティクルを動かす、静的配列と動的配列 - 多摩美メディアアートII
openFrameworks – パーティクルを動かす、静的配列と動的配列 - 多摩美メディアアートIIAtsushi Tadokoro
 
Hangman Game Programming in C (coding)
Hangman Game Programming in C (coding)Hangman Game Programming in C (coding)
Hangman Game Programming in C (coding)hasan0812
 
Ping pong game
Ping pong  gamePing pong  game
Ping pong gameAmit Kumar
 
Data Structure in C Programming Language
Data Structure in C Programming LanguageData Structure in C Programming Language
Data Structure in C Programming LanguageArkadeep Dey
 
StackArray stack3
StackArray stack3StackArray stack3
StackArray stack3Rajendran
 
2 3. standard io
2 3. standard io2 3. standard io
2 3. standard io웅식 전
 
Double linked list
Double linked listDouble linked list
Double linked listSayantan Sur
 

Was ist angesagt? (20)

openFrameworks – 関数・クラス、オブジェクト指向プログラミング導入 - 多摩美メディアアートII
openFrameworks – 関数・クラス、オブジェクト指向プログラミング導入 - 多摩美メディアアートIIopenFrameworks – 関数・クラス、オブジェクト指向プログラミング導入 - 多摩美メディアアートII
openFrameworks – 関数・クラス、オブジェクト指向プログラミング導入 - 多摩美メディアアートII
 
C file
C fileC file
C file
 
Pratt Parser in Python
Pratt Parser in PythonPratt Parser in Python
Pratt Parser in Python
 
C program to implement linked list using array abstract data type
C program to implement linked list using array abstract data typeC program to implement linked list using array abstract data type
C program to implement linked list using array abstract data type
 
Коварный code type ITGM #9
Коварный code type ITGM #9Коварный code type ITGM #9
Коварный code type ITGM #9
 
003 - JavaFX Tutorial - Layouts
003 - JavaFX Tutorial - Layouts003 - JavaFX Tutorial - Layouts
003 - JavaFX Tutorial - Layouts
 
A simple snake game project
A simple snake game projectA simple snake game project
A simple snake game project
 
openFrameworks – パーティクルを動かす、静的配列と動的配列 - 多摩美メディアアートII
openFrameworks – パーティクルを動かす、静的配列と動的配列 - 多摩美メディアアートIIopenFrameworks – パーティクルを動かす、静的配列と動的配列 - 多摩美メディアアートII
openFrameworks – パーティクルを動かす、静的配列と動的配列 - 多摩美メディアアートII
 
Avl tree
Avl treeAvl tree
Avl tree
 
Hangman Game Programming in C (coding)
Hangman Game Programming in C (coding)Hangman Game Programming in C (coding)
Hangman Game Programming in C (coding)
 
โปรแกรมภาษาซีเบื้องต้น
โปรแกรมภาษาซีเบื้องต้นโปรแกรมภาษาซีเบื้องต้น
โปรแกรมภาษาซีเบื้องต้น
 
Ping pong game
Ping pong  gamePing pong  game
Ping pong game
 
Data Structure in C Programming Language
Data Structure in C Programming LanguageData Structure in C Programming Language
Data Structure in C Programming Language
 
StackArray stack3
StackArray stack3StackArray stack3
StackArray stack3
 
BCSL 058 solved assignment
BCSL 058 solved assignmentBCSL 058 solved assignment
BCSL 058 solved assignment
 
C lab programs
C lab programsC lab programs
C lab programs
 
F
FF
F
 
2 3. standard io
2 3. standard io2 3. standard io
2 3. standard io
 
Final ds record
Final ds recordFinal ds record
Final ds record
 
Double linked list
Double linked listDouble linked list
Double linked list
 

Andere mochten auch (7)

Proga 0622
Proga 0622Proga 0622
Proga 0622
 
Proga 0615
Proga 0615Proga 0615
Proga 0615
 
Proga 0601
Proga 0601Proga 0601
Proga 0601
 
Web Presen1 0625
Web Presen1 0625Web Presen1 0625
Web Presen1 0625
 
Web Presen1 0709
Web Presen1 0709Web Presen1 0709
Web Presen1 0709
 
Tau Web0609
Tau Web0609Tau Web0609
Tau Web0609
 
Meteor.js for DOers
Meteor.js for DOersMeteor.js for DOers
Meteor.js for DOers
 

Ähnlich wie Sbaw090623

Paradigmas de Linguagens de Programacao - Aula #4
Paradigmas de Linguagens de Programacao - Aula #4Paradigmas de Linguagens de Programacao - Aula #4
Paradigmas de Linguagens de Programacao - Aula #4Ismar Silveira
 
Pads lab manual final
Pads lab manual finalPads lab manual final
Pads lab manual finalAhalyaR
 
Implementing Software Machines in Go and C
Implementing Software Machines in Go and CImplementing Software Machines in Go and C
Implementing Software Machines in Go and CEleanor McHugh
 
Programming ppt files (final)
Programming ppt files (final)Programming ppt files (final)
Programming ppt files (final)yap_raiza
 
[SI] Ada Lovelace Day 2014 - Tampon Run
[SI] Ada Lovelace Day 2014  - Tampon Run[SI] Ada Lovelace Day 2014  - Tampon Run
[SI] Ada Lovelace Day 2014 - Tampon RunMaja Kraljič
 
L25-L26-Parameter passing techniques.pptx
L25-L26-Parameter passing techniques.pptxL25-L26-Parameter passing techniques.pptx
L25-L26-Parameter passing techniques.pptxhappycocoman
 
Roberto Gallea: Workshop Arduino, giorno #2 Arduino + Processing
Roberto Gallea: Workshop Arduino, giorno #2 Arduino + ProcessingRoberto Gallea: Workshop Arduino, giorno #2 Arduino + Processing
Roberto Gallea: Workshop Arduino, giorno #2 Arduino + ProcessingDemetrio Siragusa
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconftutorialsruby
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconftutorialsruby
 
Introduction to Coding
Introduction to CodingIntroduction to Coding
Introduction to CodingFabio506452
 

Ähnlich wie Sbaw090623 (20)

Ssaw08 0624
Ssaw08 0624Ssaw08 0624
Ssaw08 0624
 
Sbaw090519
Sbaw090519Sbaw090519
Sbaw090519
 
Paradigmas de Linguagens de Programacao - Aula #4
Paradigmas de Linguagens de Programacao - Aula #4Paradigmas de Linguagens de Programacao - Aula #4
Paradigmas de Linguagens de Programacao - Aula #4
 
Struct examples
Struct examplesStruct examples
Struct examples
 
662305 10
662305 10662305 10
662305 10
 
Pads lab manual final
Pads lab manual finalPads lab manual final
Pads lab manual final
 
Sbaw091006
Sbaw091006Sbaw091006
Sbaw091006
 
Implementing Software Machines in Go and C
Implementing Software Machines in Go and CImplementing Software Machines in Go and C
Implementing Software Machines in Go and C
 
Programming ppt files (final)
Programming ppt files (final)Programming ppt files (final)
Programming ppt files (final)
 
[SI] Ada Lovelace Day 2014 - Tampon Run
[SI] Ada Lovelace Day 2014  - Tampon Run[SI] Ada Lovelace Day 2014  - Tampon Run
[SI] Ada Lovelace Day 2014 - Tampon Run
 
7 functions
7  functions7  functions
7 functions
 
Proga 0608
Proga 0608Proga 0608
Proga 0608
 
L25-L26-Parameter passing techniques.pptx
L25-L26-Parameter passing techniques.pptxL25-L26-Parameter passing techniques.pptx
L25-L26-Parameter passing techniques.pptx
 
C++ programs
C++ programsC++ programs
C++ programs
 
Roberto Gallea: Workshop Arduino, giorno #2 Arduino + Processing
Roberto Gallea: Workshop Arduino, giorno #2 Arduino + ProcessingRoberto Gallea: Workshop Arduino, giorno #2 Arduino + Processing
Roberto Gallea: Workshop Arduino, giorno #2 Arduino + Processing
 
C Language Lecture 17
C Language Lecture 17C Language Lecture 17
C Language Lecture 17
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconf
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconf
 
Introduction to Coding
Introduction to CodingIntroduction to Coding
Introduction to Coding
 
JavaScript Gotchas
JavaScript GotchasJavaScript Gotchas
JavaScript Gotchas
 

Mehr von Atsushi Tadokoro

「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望
「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望
「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望Atsushi Tadokoro
 
プログラム初級講座 - メディア芸術をはじめよう
プログラム初級講座 - メディア芸術をはじめようプログラム初級講座 - メディア芸術をはじめよう
プログラム初級講座 - メディア芸術をはじめようAtsushi Tadokoro
 
Interactive Music II ProcessingとSuperColliderの連携 -2
Interactive Music II ProcessingとSuperColliderの連携 -2Interactive Music II ProcessingとSuperColliderの連携 -2
Interactive Music II ProcessingとSuperColliderの連携 -2Atsushi Tadokoro
 
coma Creators session vol.2
coma Creators session vol.2coma Creators session vol.2
coma Creators session vol.2Atsushi Tadokoro
 
Interactive Music II ProcessingとSuperColliderの連携1
Interactive Music II ProcessingとSuperColliderの連携1Interactive Music II ProcessingとSuperColliderの連携1
Interactive Music II ProcessingとSuperColliderの連携1Atsushi Tadokoro
 
Interactive Music II Processingによるアニメーション
Interactive Music II ProcessingによるアニメーションInteractive Music II Processingによるアニメーション
Interactive Music II ProcessingによるアニメーションAtsushi Tadokoro
 
Interactive Music II Processing基本
Interactive Music II Processing基本Interactive Music II Processing基本
Interactive Music II Processing基本Atsushi Tadokoro
 
Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携
Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携
Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携Atsushi Tadokoro
 
Media Art II openFrameworks アプリ間の通信とタンジブルなインターフェイス
Media Art II openFrameworks  アプリ間の通信とタンジブルなインターフェイス Media Art II openFrameworks  アプリ間の通信とタンジブルなインターフェイス
Media Art II openFrameworks アプリ間の通信とタンジブルなインターフェイス Atsushi Tadokoro
 
Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)
Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)
Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)Atsushi Tadokoro
 
iTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描く
iTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描くiTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描く
iTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描くAtsushi Tadokoro
 
メディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリ
メディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリメディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリ
メディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリAtsushi Tadokoro
 
芸術情報演習デザイン(Web) 第8回: CSSフレームワークを使う
芸術情報演習デザイン(Web)  第8回: CSSフレームワークを使う芸術情報演習デザイン(Web)  第8回: CSSフレームワークを使う
芸術情報演習デザイン(Web) 第8回: CSSフレームワークを使うAtsushi Tadokoro
 
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2Atsushi Tadokoro
 
iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得
iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得
iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得Atsushi Tadokoro
 
Webデザイン 第10回:HTML5実践 Three.jsで3Dプログラミング
Webデザイン 第10回:HTML5実践 Three.jsで3DプログラミングWebデザイン 第10回:HTML5実践 Three.jsで3Dプログラミング
Webデザイン 第10回:HTML5実践 Three.jsで3DプログラミングAtsushi Tadokoro
 
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1Atsushi Tadokoro
 
iTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画する
iTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画するiTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画する
iTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画するAtsushi Tadokoro
 
Media Art II openFrameworks 複数のシーンの管理・切替え
Media Art II openFrameworks 複数のシーンの管理・切替えMedia Art II openFrameworks 複数のシーンの管理・切替え
Media Art II openFrameworks 複数のシーンの管理・切替えAtsushi Tadokoro
 

Mehr von Atsushi Tadokoro (20)

「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望
「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望
「クリエイティブ・ミュージック・コーディング」- オーディオ・ビジュアル作品のための、オープンソースなソフトウエア・フレームワークの現状と展望
 
プログラム初級講座 - メディア芸術をはじめよう
プログラム初級講座 - メディア芸術をはじめようプログラム初級講座 - メディア芸術をはじめよう
プログラム初級講座 - メディア芸術をはじめよう
 
Interactive Music II ProcessingとSuperColliderの連携 -2
Interactive Music II ProcessingとSuperColliderの連携 -2Interactive Music II ProcessingとSuperColliderの連携 -2
Interactive Music II ProcessingとSuperColliderの連携 -2
 
coma Creators session vol.2
coma Creators session vol.2coma Creators session vol.2
coma Creators session vol.2
 
Interactive Music II ProcessingとSuperColliderの連携1
Interactive Music II ProcessingとSuperColliderの連携1Interactive Music II ProcessingとSuperColliderの連携1
Interactive Music II ProcessingとSuperColliderの連携1
 
Interactive Music II Processingによるアニメーション
Interactive Music II ProcessingによるアニメーションInteractive Music II Processingによるアニメーション
Interactive Music II Processingによるアニメーション
 
Interactive Music II Processing基本
Interactive Music II Processing基本Interactive Music II Processing基本
Interactive Music II Processing基本
 
Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携
Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携
Interactive Music II SuperCollider応用 2 - SuperColliderとPure Dataの連携
 
Media Art II openFrameworks アプリ間の通信とタンジブルなインターフェイス
Media Art II openFrameworks  アプリ間の通信とタンジブルなインターフェイス Media Art II openFrameworks  アプリ間の通信とタンジブルなインターフェイス
Media Art II openFrameworks アプリ間の通信とタンジブルなインターフェイス
 
Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)
Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)
Interactive Music II SuperCollider応用 - SuperColliderと OSC (Open Sound Control)
 
iTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描く
iTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描くiTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描く
iTamabi 13 ARTSAT API 実践 5 - 衛星の軌道を描く
 
メディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリ
メディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリメディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリ
メディア芸術基礎 II 第11回:HTML5実践 表現のための様々なJavaScriptライブラリ
 
芸術情報演習デザイン(Web) 第8回: CSSフレームワークを使う
芸術情報演習デザイン(Web)  第8回: CSSフレームワークを使う芸術情報演習デザイン(Web)  第8回: CSSフレームワークを使う
芸術情報演習デザイン(Web) 第8回: CSSフレームワークを使う
 
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 2
 
iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得
iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得
iTamabi 13 第9回:ARTSAT API 実践 3 ジオコーディングで衛星の位置を取得
 
Tamabi media131118
Tamabi media131118Tamabi media131118
Tamabi media131118
 
Webデザイン 第10回:HTML5実践 Three.jsで3Dプログラミング
Webデザイン 第10回:HTML5実践 Three.jsで3DプログラミングWebデザイン 第10回:HTML5実践 Three.jsで3Dプログラミング
Webデザイン 第10回:HTML5実践 Three.jsで3Dプログラミング
 
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1
Interactive Music II SuperCollider応用 JITLib - ライブコーディング 1
 
iTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画する
iTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画するiTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画する
iTamabi 13 第8回:ARTSAT API 実践 2 衛星アプリを企画する
 
Media Art II openFrameworks 複数のシーンの管理・切替え
Media Art II openFrameworks 複数のシーンの管理・切替えMedia Art II openFrameworks 複数のシーンの管理・切替え
Media Art II openFrameworks 複数のシーンの管理・切替え
 

Kürzlich hochgeladen

Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Association for Project Management
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsPooky Knightsmith
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWQuiz Club NITW
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...Nguyen Thanh Tu Collection
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQuiz Club NITW
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1GloryAnnCastre1
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfPrerana Jadhav
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDhatriParmar
 

Kürzlich hochgeladen (20)

Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young minds
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITW
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdf
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 

Sbaw090623

  • 1.
  • 2.
  • 3.
  • 4.
  • 5. 000100 IDENTIFICATION DIVISION. 000200 PROGRAM-ID. HELLOWORLD. 000300 DATE-WRITTEN. 02/05/96 21:04. 000400*AUTHOR BRIAN COLLINS 000500 ENVIRONMENT DIVISION. 000600 CONFIGURATION SECTION. 000700 SOURCE-COMPUTER. RM-COBOL. 000800 OBJECT-COMPUTER. RM-COBOL. 000900 001000 DATA DIVISION. 001100 FILE SECTION. 001200 100000 PROCEDURE DIVISION. 100100 100200 MAIN-LOGIC SECTION. 100300 BEGIN. 100400 DISPLAY " " LINE 1 POSITION 1 ERASE EOS. 100500 DISPLAY "HELLO, WORLD." LINE 15 POSITION 10. 100600 STOP RUN. 100700 MAIN-LOGIC-EXIT. 100800 EXIT.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12. getName() getName()
  • 13. To invent programs, you need to be able to capture abstractions and ex design. It’s the job of a programming language to help you do this. The process of invention and design by letting you encode abstractions tha It should let you make your ideas concrete in the code you write. Surf the architecture of your program. All programming languages provide devices that help express abstrac are ways of grouping implementation details, hiding them, and giving a common interface—much as a mechanical object separates its interfa illustrated in “Interface and Implementation” . Figure 2-1 Inte rfa ce a nd Im ple m e nta tion interface implementation 11 10 9 8 7 6
  • 14.
  • 15.
  • 16.
  • 17. Spot + pos : ofPoint + loc : float
  • 18. Spot sp; // void setup() { size(400, 400); smooth(); noStroke(); sp = new Spot(); // ( ) sp.x = 150; // x 150 sp.y = 200; // y 200 sp.diameter = 30; // diameter 30 } void draw() { background(0); ellipse(sp.x, sp.y, sp.diameter, sp.diameter); }
  • 19. Spot sp; // void setup() { size(400, 400); smooth(); noStroke(); sp = new Spot(); // ( ) sp.x = 150; // x 150 sp.y = 200; // y 200 sp.diameter = 30; // diameter 30 } void draw() { background(0); ellipse(sp.x, sp.y, sp.diameter, sp.diameter); } class Spot { float x, y; // x y float diameter; // }
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25. #ifndef _OF_SPOT #define _OF_SPOT #include "ofMain.h" class Spot { public: ofPoint pos; float diameter; }; #endif
  • 26. #pragma once #include "ofMain.h" #include "ofxAccelerometer.h" #include "ofxMultiTouch.h" #include "Spot.h" class testApp : public ofSimpleApp, public ofxMultiTouchListener { public: void setup(); void update(); void draw(); void exit(); ...( )... private: Spot sp; };
  • 27. #include "testApp.h" #include "Spot.h" void testApp::setup(){ sp.pos.x = ofGetWidth()/2; sp.pos.y = ofGetHeight()/2; sp.diameter = 100; } void testApp::update(){ } void testApp::draw(){ ofEnableSmoothing(); ofSetColor(0, 127, 255); ofCircle(sp.pos.x, sp.pos.y, sp.diameter); } ...( )...
  • 28.
  • 29.
  • 30. Spot + pos : ofPoint + loc : float + display( )
  • 31. #ifndef _OF_SPOT #define _OF_SPOT #include "ofMain.h" class Spot { public: void display(); ofPoint pos; float diameter; }; #endif
  • 32. #include "Spot.h" void Spot::display() { ofSetColor(0, 127, 255); ofCircle(pos.x, pos.y, diameter); }
  • 33. #include "testApp.h" #include "Spot.h" void testApp::setup(){ sp.pos.x = ofGetWidth()/2; sp.pos.y = ofGetHeight()/2; sp.diameter = 100; } void testApp::update(){ } void testApp::draw(){ sp.display(); } ...( )...
  • 34.
  • 35.
  • 36.
  • 37. Spot + pos : ofPoint + loc : float + Spot(pos:ofPoint, loc:float) + display() : void
  • 38. #pragma once #include "ofMain.h" #include "ofxAccelerometer.h" #include "ofxMultiTouch.h" #include "Spot.h" class testApp : public ofSimpleApp, public ofxMultiTouchListener { public: void setup(); void update(); void draw(); void exit(); ...( )... private: Spot *sp; //Spot sp (*) };
  • 39. #include "testApp.h" #include "Spot.h" void testApp::setup(){ ofPoint _pos; _pos.x = ofGetWidth()/2; _pos.y = ofGetHeight()/2; sp = new Spot(_pos, 100.0); // } void testApp::update(){ } void testApp::draw(){ sp->display(); // "->" } ...( )...
  • 40. #ifndef _OF_SPOT #define _OF_SPOT #include "ofMain.h" class Spot { public: Spot(ofPoint pos, float diameter); void display(); ofPoint pos; float diameter; }; #endif
  • 41. #include "Spot.h" Spot::Spot(ofPoint _pos, float _diameter) { pos = _pos; diameter = _diameter; } void Spot::display() { ofSetColor(0, 127, 255); ofCircle(pos.x, pos.y, diameter); }
  • 42.
  • 43.
  • 44. #pragma once #include "ofMain.h" #include "ofxAccelerometer.h" #include "ofxMultiTouch.h" #include "Spot.h" class testApp : public ofSimpleApp, public ofxMultiTouchListener { public: void setup(); void update(); void draw(); void exit(); ...( )... private: Spot** sp; //Spot sp (**) int numSpot; // Spot };
  • 45. #include "testApp.h" #include "Spot.h" void testApp::setup(){ numSpot = 100; sp = new Spot*[numSpot]; // for(int i = 0; i < numSpot; i++){ ofPoint _pos; _pos.x = ofRandom(0, ofGetWidth()); _pos.y = ofRandom(0, ofGetHeight()); float _diameter = ofRandom(1, 20); sp[i] = new Spot(_pos, _diameter); // } } void testApp::update(){ } void testApp::draw(){ for(int i = 0; i < numSpot; i++){ sp[i]->display(); } } ...( )...
  • 46. #ifndef _OF_SPOT #define _OF_SPOT #include "ofMain.h" class Spot { public: Spot(ofPoint pos, float diameter); void display(); ofPoint pos; float diameter; }; #endif
  • 47. #include "Spot.h" Spot::Spot(ofPoint _pos, float _diameter) { pos = _pos; diameter = _diameter; } void Spot::display() { ofSetColor(0, 127, 255); ofCircle(pos.x, pos.y, diameter); }
  • 48.
  • 49.
  • 50. Spot + pos : ofPoint + loc : float +Spot(pos:ofPoint, velocity:ofPoint, loc:float) +update() : void + display() : void
  • 51. #pragma once #include "ofMain.h" #include "ofxAccelerometer.h" #include "ofxMultiTouch.h" #include "Spot.h" class testApp : public ofSimpleApp, public ofxMultiTouchListener { public: void setup(); void update(); void draw(); void exit(); ...( )... private: Spot** sp; //Spot sp (**) int numSpot; // Spot };
  • 52. #include "testApp.h" #include "Spot.h" void testApp::setup(){ ofSetFrameRate(60); ofEnableAlphaBlending(); ofSetBackgroundAuto(false); numSpot = 100; sp = new Spot*[numSpot]; // for(int i = 0; i < numSpot; i++){ ofPoint _pos, _velocity; _pos.x = ofRandom(0, ofGetWidth()); _pos.y = ofRandom(0, ofGetHeight()); _velocity.x = ofRandom(-10, 10); _velocity.y = ofRandom(-30, -10); float _diameter = ofRandom(1, 20); sp[i] = new Spot(_pos, _velocity, _diameter); // sp[i]->gravity = 0.5; // sp[i]->friction = 0.999; // } }
  • 53. void testApp::update(){ ofSetColor(0, 0, 0, 31); ofRect(0, 0, ofGetWidth(), ofGetHeight()); for(int i = 0; i < numSpot; i++){ sp[i]->update(); } } void testApp::draw(){ for(int i = 0; i < numSpot; i++){ sp[i]->display(); } } ...( )...
  • 54. #ifndef _OF_SPOT #define _OF_SPOT #include "ofMain.h" class Spot { public: Spot(ofPoint pos, ofPoint velocity, float diameter); void update(); void display(); ofPoint pos; ofPoint velocity; float diameter; float gravity; float friction; };
  • 55. #include "Spot.h" Spot::Spot(ofPoint _pos, ofPoint _velocity, float _diameter) { pos = _pos; velocity = _velocity; diameter = _diameter; } void Spot::update() { velocity *= friction; velocity.y += gravity; pos.x += velocity.x; pos.y += velocity.y; if(pos.x < diameter || pos.x > ofGetWidth() - diameter){ velocity.x *= -1; }
  • 56. if(pos.y > ofGetHeight()-diameter){ velocity.y *= -1; pos.y = ofGetHeight()-diameter; } } void Spot::display() { ofSetColor(0, 127, 255, 200); ofCircle(pos.x, pos.y, diameter); }