SlideShare a Scribd company logo
1 of 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

More Related Content

What's hot

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
 

What's hot (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
 

Viewers also liked (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
 

Similar to 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
 

Similar to 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
 

More from 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
 

More from 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 複数のシーンの管理・切替え
 

Recently uploaded

Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 

Recently uploaded (20)

Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 

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); }