本文整理汇总了C++中Food::setup方法的典型用法代码示例。如果您正苦于以下问题:C++ Food::setup方法的具体用法?C++ Food::setup怎么用?C++ Food::setup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Food
的用法示例。
在下文中一共展示了Food::setup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
//--------------------------------------------------------------
void testApp::setup(){
ofEnableAlphaBlending();
ofBackground(0);
bg.loadImage("bg3.png"); //artwork tim reynolds
bg.resize(ofGetWindowWidth(), ofGetWindowHeight());
ofSetVerticalSync(true);
timer = ofGetElapsedTimef();
for (int i=0; i<30; i++) {
Food bitesOfFood;
bitesOfFood.setup();
bites.push_back(bitesOfFood);
}
for(int i = 0; i< 10; i++) {
Prey prey;
prey.setup();
preys.push_back(prey);
}
for(int i = 0; i< 3; i++) {
Predator predator;
predator.setup();
predators.push_back(predator);
}
myVectorField.setup(ofGetWindowWidth(), ofGetWindowHeight(), 20);
for(int i = 0; i < 50000; i++){
Particle tmp;
particleList.push_back( tmp );
particleList[i].setParams(ofRandomWidth(), ofRandomHeight(), ofRandom(-1,1), ofRandom(-1,1));
}
}
示例2: setup
//--------------------------------------------------------------
void testApp::setup(){
for (int i=0; i<30; i++) {
Food bitesOfFood;
bitesOfFood.setup();
bites.push_back(bitesOfFood);
}
for(int i = 0; i< 5; i++) {
Prey prey;
prey.setup();
preys.push_back(prey);
}
}
示例3: update
//--------------------------------------------------------------
void testApp::update(){
mod();
addFoodAt = 5;
addElements = 60;
numFood = 6;
numPreys = 8;
numPredators = 2;
if(timer > addElements){
for (int i=0; i<numFood; i++) {
Food bitesOfFood;
bitesOfFood.setup();
//bitesOfFood.draw();
bites.push_back(bitesOfFood);
}
if(timer > 40){
for (int i=0; i<numPreys; i++) {
Prey morepreys;
morepreys.setup();
//bitesOfFood.draw();
preys.push_back(morepreys);
}
}
if(timer > 60){
for (int i=0; i<numPredators; i++) {
Predator morepreds;
morepreds.setup();
//bitesOfFood.draw();
predators.push_back(morepreds);
}
}
timer = 0;
}
for (int i=0; i<preys.size(); i++) {
preys[i].update(bites);
}
for (int i=0; i<predators.size(); i++) {
predators[i].update(preys);
}
timer++;
//
if (bHide) {
ofBackground(255);
} else {
ofBackground(0);
}
for (int i = 0; i < particleList.size(); i++) {
particleList[i].resetForce();
particleList[i].addForce(myVectorField.getForceAtScreenPos(particleList[i].pos)*0.005);
particleList[i].addDampingForce();
particleList[i].update();
}
}