Skip to content

Instantly share code, notes, and snippets.

@tado
tado / Langton's ant - main.cpp
Last active December 23, 2015 07:49
Langton's ant for openFrameworks.
#include "ofMain.h"
#include "testApp.h"
//========================================================================
int main( ){
ofSetupOpenGL(1280,720,OF_WINDOW);
ofRunApp(new testApp());
}
#include "testApp.h"
//--------------------------------------------------------------
void testApp::setup(){
// 画面基本設定
ofSetFrameRate(60);
ofBackground(63);
ofSetCircleResolution(4);
// 摩擦係数を設定
#include "testApp.h"
//--------------------------------------------------------------
void testApp::setup(){
// 画面基本設定
ofSetFrameRate(60);
ofBackground(63);
ofSetCircleResolution(32);
// 画面内のランダムな場所を指定
#include "Particle.h" // 必ずヘッダーファイルを読み込む
void Particle::draw(){
// 円を描画
ofSetHexColor(0x3399cc);
ofCircle(position, 10);
}
#include "Particle.h"
void Particle::setup(ofVec2f _position){
position = _position;
}
void Particle::draw(){
ofSetHexColor(0x3399cc);
ofCircle(position, 10);
}
#include "Particle.h"
void Particle::setup(ofVec2f _position, ofVec2f _velocity){
// 位置を設定
position = _position;
// 初期速度を設定
velocity = _velocity;
}
// 力をリセット
#include "testApp.h"
//--------------------------------------------------------------
void testApp::setup(){
// 画面基本設定
ofSetFrameRate(60);
ofBackground(63);
}
//--------------------------------------------------------------
#include "testApp.h"
//--------------------------------------------------------------
void testApp::setup(){
// 画面基本設定
ofSetFrameRate(60);
ofBackground(63);
// 色の混合を加算合成に
ofEnableBlendMode(OF_BLENDMODE_ADD);
// 円の解像度
#include "testApp.h"
//--------------------------------------------------------------
void testApp::setup(){
// 画面基本設定
ofSetFrameRate(60);
ofBackground(63);
ofEnableBlendMode(OF_BLENDMODE_ADD);
// パーティクル画像読込み
#include "testApp.h"
//--------------------------------------------------------------
void testApp::setup(){
// 画面基本設定
ofSetFrameRate(60);
ofBackground(63);
ofEnableBlendMode(OF_BLENDMODE_ADD);
// パーティクル画像読込み